Skip to content

Commit f6d6cdb

Browse files
authored
Merge branch 'rust-lang:master' into master
2 parents 3e074fd + cf577f3 commit f6d6cdb

File tree

322 files changed

+3568
-2197
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

322 files changed

+3568
-2197
lines changed

Cargo.lock

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1525,7 +1525,6 @@ checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
15251525
dependencies = [
15261526
"ahash",
15271527
"allocator-api2",
1528-
"serde",
15291528
]
15301529

15311530
[[package]]
@@ -1535,6 +1534,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
15351534
checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289"
15361535
dependencies = [
15371536
"foldhash",
1537+
"serde",
15381538
]
15391539

15401540
[[package]]
@@ -5880,9 +5880,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
58805880

58815881
[[package]]
58825882
name = "wasi-preview1-component-adapter-provider"
5883-
version = "24.0.1"
5883+
version = "29.0.1"
58845884
source = "registry+https://github.com/rust-lang/crates.io-index"
5885-
checksum = "0f76d9fa52234153eeb40b088de91a8c13dc28a912cf6f31cd89ca4bac9024e0"
5885+
checksum = "dcd9f21bbde82ba59e415a8725e6ad0d0d7e9e460b1a3ccbca5bdee952c1a324"
58865886

58875887
[[package]]
58885888
name = "wasm-bindgen"
@@ -5944,17 +5944,17 @@ dependencies = [
59445944

59455945
[[package]]
59465946
name = "wasm-component-ld"
5947-
version = "0.5.11"
5947+
version = "0.5.12"
59485948
source = "registry+https://github.com/rust-lang/crates.io-index"
5949-
checksum = "a2b05c3820968b335f10e703218459e4fd2cc91fdfc8f7936a993f1aacaa0938"
5949+
checksum = "580305a8e3f1b7a79859a8db897de643533b2851c5eb080fe5800233f16dec88"
59505950
dependencies = [
59515951
"anyhow",
59525952
"clap",
59535953
"lexopt",
59545954
"libc",
59555955
"tempfile",
59565956
"wasi-preview1-component-adapter-provider",
5957-
"wasmparser 0.219.1",
5957+
"wasmparser 0.223.0",
59585958
"wat",
59595959
"windows-sys 0.59.0",
59605960
"winsplit",
@@ -5991,18 +5991,19 @@ dependencies = [
59915991

59925992
[[package]]
59935993
name = "wasm-metadata"
5994-
version = "0.219.1"
5994+
version = "0.223.0"
59955995
source = "registry+https://github.com/rust-lang/crates.io-index"
5996-
checksum = "2af5a8e37a5e996861e1813f8de30911c47609c9ff51a7284f7dbd754dc3a9f3"
5996+
checksum = "5c730c3379d3d20e5a0245b0724b924483e853588ca8fba547c1e21f19e7d735"
59975997
dependencies = [
59985998
"anyhow",
59995999
"indexmap",
60006000
"serde",
60016001
"serde_derive",
60026002
"serde_json",
60036003
"spdx",
6004-
"wasm-encoder 0.219.1",
6005-
"wasmparser 0.219.1",
6004+
"url",
6005+
"wasm-encoder 0.223.0",
6006+
"wasmparser 0.223.0",
60066007
]
60076008

60086009
[[package]]
@@ -6011,12 +6012,8 @@ version = "0.219.1"
60116012
source = "registry+https://github.com/rust-lang/crates.io-index"
60126013
checksum = "5c771866898879073c53b565a6c7b49953795159836714ac56a5befb581227c5"
60136014
dependencies = [
6014-
"ahash",
60156015
"bitflags",
6016-
"hashbrown 0.14.5",
60176016
"indexmap",
6018-
"semver",
6019-
"serde",
60206017
]
60216018

60226019
[[package]]
@@ -6035,8 +6032,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
60356032
checksum = "d5a99faceb1a5a84dd6084ec4bfa4b2ab153b5793b43fd8f58b89232634afc35"
60366033
dependencies = [
60376034
"bitflags",
6035+
"hashbrown 0.15.2",
60386036
"indexmap",
60396037
"semver",
6038+
"serde",
60406039
]
60416040

60426041
[[package]]
@@ -6476,9 +6475,9 @@ checksum = "3ab703352da6a72f35c39a533526393725640575bb211f61987a2748323ad956"
64766475

64776476
[[package]]
64786477
name = "wit-component"
6479-
version = "0.219.1"
6478+
version = "0.223.0"
64806479
source = "registry+https://github.com/rust-lang/crates.io-index"
6481-
checksum = "ad1673163c0cb14a6a19ddbf44dd4efe6f015ec1ebb8156710ac32501f19fba2"
6480+
checksum = "c10ed2aeee4c8ec5715875f62f4a3de3608d6987165c116810d8c2908aa9d93b"
64826481
dependencies = [
64836482
"anyhow",
64846483
"bitflags",
@@ -6487,17 +6486,17 @@ dependencies = [
64876486
"serde",
64886487
"serde_derive",
64896488
"serde_json",
6490-
"wasm-encoder 0.219.1",
6489+
"wasm-encoder 0.223.0",
64916490
"wasm-metadata",
6492-
"wasmparser 0.219.1",
6491+
"wasmparser 0.223.0",
64936492
"wit-parser",
64946493
]
64956494

64966495
[[package]]
64976496
name = "wit-parser"
6498-
version = "0.219.1"
6497+
version = "0.223.0"
64996498
source = "registry+https://github.com/rust-lang/crates.io-index"
6500-
checksum = "4a86f669283257e8e424b9a4fc3518e3ade0b95deb9fbc0f93a1876be3eda598"
6499+
checksum = "92772f4dcacb804b275981eea1d920b12b377993b53307f1e33d87404e080281"
65016500
dependencies = [
65026501
"anyhow",
65036502
"id-arena",
@@ -6508,7 +6507,7 @@ dependencies = [
65086507
"serde_derive",
65096508
"serde_json",
65106509
"unicode-xid",
6511-
"wasmparser 0.219.1",
6510+
"wasmparser 0.223.0",
65126511
]
65136512

65146513
[[package]]

compiler/rustc_ast_lowering/src/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2159,7 +2159,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
21592159
let path = hir::ExprKind::Path(hir::QPath::TypeRelative(
21602160
self.arena.alloc(self.ty(span, hir::TyKind::Path(qpath))),
21612161
self.arena.alloc(hir::PathSegment::new(
2162-
Ident::new(name, span),
2162+
Ident::new(name, self.lower_span(span)),
21632163
self.next_id(),
21642164
Res::Err,
21652165
)),

compiler/rustc_ast_lowering/src/index.rs

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -78,24 +78,31 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
7878

7979
// Make sure that the DepNode of some node coincides with the HirId
8080
// owner of that node.
81-
if cfg!(debug_assertions) && hir_id.owner != self.owner {
82-
span_bug!(
83-
span,
84-
"inconsistent HirId at `{:?}` for `{:?}`: \
81+
if cfg!(debug_assertions) {
82+
if hir_id.owner != self.owner {
83+
span_bug!(
84+
span,
85+
"inconsistent HirId at `{:?}` for `{node:?}`: \
8586
current_dep_node_owner={} ({:?}), hir_id.owner={} ({:?})",
86-
self.tcx.sess.source_map().span_to_diagnostic_string(span),
87-
node,
88-
self.tcx
89-
.definitions_untracked()
90-
.def_path(self.owner.def_id)
91-
.to_string_no_crate_verbose(),
92-
self.owner,
93-
self.tcx
94-
.definitions_untracked()
95-
.def_path(hir_id.owner.def_id)
96-
.to_string_no_crate_verbose(),
97-
hir_id.owner,
98-
)
87+
self.tcx.sess.source_map().span_to_diagnostic_string(span),
88+
self.tcx
89+
.definitions_untracked()
90+
.def_path(self.owner.def_id)
91+
.to_string_no_crate_verbose(),
92+
self.owner,
93+
self.tcx
94+
.definitions_untracked()
95+
.def_path(hir_id.owner.def_id)
96+
.to_string_no_crate_verbose(),
97+
hir_id.owner,
98+
)
99+
}
100+
if self.tcx.sess.opts.incremental.is_some()
101+
&& span.parent().is_none()
102+
&& !span.is_dummy()
103+
{
104+
span_bug!(span, "span without a parent: {:#?}, {node:?}", span.data())
105+
}
99106
}
100107

101108
self.nodes[hir_id.local_id] = ParentedNode { parent: self.parent_node, node };

compiler/rustc_ast_lowering/src/item.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,6 +1092,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
10921092
// this as a special case.
10931093
return self.lower_fn_body(decl, |this| {
10941094
if attrs.iter().any(|a| a.name_or_empty() == sym::rustc_intrinsic) {
1095+
let span = this.lower_span(span);
10951096
let empty_block = hir::Block {
10961097
hir_id: this.next_id(),
10971098
stmts: &[],

compiler/rustc_ast_lowering/src/pat.rs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -375,24 +375,24 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
375375
expr: &Expr,
376376
allow_paths: bool,
377377
) -> &'hir hir::PatExpr<'hir> {
378+
let span = self.lower_span(expr.span);
378379
let err = |guar| hir::PatExprKind::Lit {
379-
lit: self.arena.alloc(respan(self.lower_span(expr.span), LitKind::Err(guar))),
380+
lit: self.arena.alloc(respan(span, LitKind::Err(guar))),
380381
negated: false,
381382
};
382383
let kind = match &expr.kind {
383384
ExprKind::Lit(lit) => {
384-
hir::PatExprKind::Lit { lit: self.lower_lit(lit, expr.span), negated: false }
385+
hir::PatExprKind::Lit { lit: self.lower_lit(lit, span), negated: false }
385386
}
386387
ExprKind::ConstBlock(c) => hir::PatExprKind::ConstBlock(self.lower_const_block(c)),
387388
ExprKind::IncludedBytes(bytes) => hir::PatExprKind::Lit {
388-
lit: self.arena.alloc(respan(
389-
self.lower_span(expr.span),
390-
LitKind::ByteStr(Arc::clone(bytes), StrStyle::Cooked),
391-
)),
389+
lit: self
390+
.arena
391+
.alloc(respan(span, LitKind::ByteStr(Arc::clone(bytes), StrStyle::Cooked))),
392392
negated: false,
393393
},
394394
ExprKind::Err(guar) => err(*guar),
395-
ExprKind::Dummy => span_bug!(expr.span, "lowered ExprKind::Dummy"),
395+
ExprKind::Dummy => span_bug!(span, "lowered ExprKind::Dummy"),
396396
ExprKind::Path(qself, path) if allow_paths => hir::PatExprKind::Path(self.lower_qpath(
397397
expr.id,
398398
qself,
@@ -403,21 +403,17 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
403403
None,
404404
)),
405405
ExprKind::Unary(UnOp::Neg, inner) if let ExprKind::Lit(lit) = &inner.kind => {
406-
hir::PatExprKind::Lit { lit: self.lower_lit(lit, expr.span), negated: true }
406+
hir::PatExprKind::Lit { lit: self.lower_lit(lit, span), negated: true }
407407
}
408408
_ => {
409409
let pattern_from_macro = expr.is_approximately_pattern();
410410
let guar = self.dcx().emit_err(ArbitraryExpressionInPattern {
411-
span: expr.span,
411+
span,
412412
pattern_from_macro_note: pattern_from_macro,
413413
});
414414
err(guar)
415415
}
416416
};
417-
self.arena.alloc(hir::PatExpr {
418-
hir_id: self.lower_node_id(expr.id),
419-
span: expr.span,
420-
kind,
421-
})
417+
self.arena.alloc(hir::PatExpr { hir_id: self.lower_node_id(expr.id), span, kind })
422418
}
423419
}

compiler/rustc_borrowck/src/type_check/canonical.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
185185
CustomTypeOp::new(
186186
|ocx| {
187187
let structurally_normalize = |ty| {
188-
ocx.structurally_normalize(
188+
ocx.structurally_normalize_ty(
189189
&ObligationCause::misc(
190190
location.to_locations().span(body),
191191
body.source.def_id().expect_local(),
@@ -230,7 +230,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
230230
ConstraintCategory::Boring,
231231
CustomTypeOp::new(
232232
|ocx| {
233-
ocx.structurally_normalize(
233+
ocx.structurally_normalize_ty(
234234
&ObligationCause::misc(
235235
location.to_locations().span(body),
236236
body.source.def_id().expect_local(),

compiler/rustc_builtin_macros/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#![feature(proc_macro_internals)]
1717
#![feature(proc_macro_quote)]
1818
#![feature(rustdoc_internals)]
19+
#![feature(string_from_utf8_lossy_owned)]
1920
#![feature(try_blocks)]
2021
#![warn(unreachable_pub)]
2122
// tidy-alphabetical-end

compiler/rustc_builtin_macros/src/source_util.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use rustc_expand::base::{
1313
use rustc_expand::module::DirOwnership;
1414
use rustc_lint_defs::BuiltinLintDiag;
1515
use rustc_parse::parser::{ForceCollect, Parser};
16-
use rustc_parse::{new_parser_from_file, unwrap_or_emit_fatal};
16+
use rustc_parse::{new_parser_from_file, unwrap_or_emit_fatal, utf8_error};
1717
use rustc_session::lint::builtin::INCOMPLETE_INCLUDE;
1818
use rustc_span::source_map::SourceMap;
1919
use rustc_span::{Pos, Span, Symbol};
@@ -209,9 +209,10 @@ pub(crate) fn expand_include_str(
209209
let interned_src = Symbol::intern(src);
210210
MacEager::expr(cx.expr_str(cx.with_def_site_ctxt(bsp), interned_src))
211211
}
212-
Err(_) => {
213-
let guar = cx.dcx().span_err(sp, format!("`{path}` wasn't a utf-8 file"));
214-
DummyResult::any(sp, guar)
212+
Err(utf8err) => {
213+
let mut err = cx.dcx().struct_span_err(sp, format!("`{path}` wasn't a utf-8 file"));
214+
utf8_error(cx.source_map(), path.as_str(), None, &mut err, utf8err, &bytes[..]);
215+
DummyResult::any(sp, err.emit())
215216
}
216217
},
217218
Err(dummy) => dummy,
@@ -273,7 +274,7 @@ fn load_binary_file(
273274
.and_then(|path| path.into_os_string().into_string().ok());
274275

275276
if let Some(new_path) = new_path {
276-
err.span_suggestion(
277+
err.span_suggestion_verbose(
277278
path_span,
278279
"there is a file with the same name in a different directory",
279280
format!("\"{}\"", new_path.replace('\\', "/").escape_debug()),

compiler/rustc_codegen_llvm/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ test = false
99
[dependencies]
1010
# tidy-alphabetical-start
1111
bitflags = "2.4.1"
12+
# To avoid duplicate dependencies, this should match the version of gimli used
13+
# by `rustc_codegen_ssa` via its `thorin-dwp` dependency.
1214
gimli = "0.30"
1315
itertools = "0.12"
1416
libc = "0.2"

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -741,8 +741,11 @@ pub mod debuginfo {
741741
pub type DIEnumerator = DIDescriptor;
742742
pub type DITemplateTypeParameter = DIDescriptor;
743743

744-
// These values **must** match with LLVMRustDIFlags!!
745744
bitflags! {
745+
/// Must match the layout of `LLVMDIFlags` in the LLVM-C API.
746+
///
747+
/// Each value declared here must also be covered by the static
748+
/// assertions in `RustWrapper.cpp` used by `fromRust(LLVMDIFlags)`.
746749
#[repr(transparent)]
747750
#[derive(Clone, Copy, Default)]
748751
pub struct DIFlags: u32 {
@@ -752,7 +755,7 @@ pub mod debuginfo {
752755
const FlagPublic = 3;
753756
const FlagFwdDecl = (1 << 2);
754757
const FlagAppleBlock = (1 << 3);
755-
const FlagBlockByrefStruct = (1 << 4);
758+
const FlagReservedBit4 = (1 << 4);
756759
const FlagVirtual = (1 << 5);
757760
const FlagArtificial = (1 << 6);
758761
const FlagExplicit = (1 << 7);
@@ -763,10 +766,21 @@ pub mod debuginfo {
763766
const FlagStaticMember = (1 << 12);
764767
const FlagLValueReference = (1 << 13);
765768
const FlagRValueReference = (1 << 14);
766-
const FlagExternalTypeRef = (1 << 15);
769+
const FlagReserved = (1 << 15);
770+
const FlagSingleInheritance = (1 << 16);
771+
const FlagMultipleInheritance = (2 << 16);
772+
const FlagVirtualInheritance = (3 << 16);
767773
const FlagIntroducedVirtual = (1 << 18);
768774
const FlagBitField = (1 << 19);
769775
const FlagNoReturn = (1 << 20);
776+
// The bit at (1 << 21) is unused, but was `LLVMDIFlagMainSubprogram`.
777+
const FlagTypePassByValue = (1 << 22);
778+
const FlagTypePassByReference = (1 << 23);
779+
const FlagEnumClass = (1 << 24);
780+
const FlagThunk = (1 << 25);
781+
const FlagNonTrivial = (1 << 26);
782+
const FlagBigEndian = (1 << 27);
783+
const FlagLittleEndian = (1 << 28);
770784
}
771785
}
772786

compiler/rustc_driver_impl/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,9 +1528,9 @@ fn report_ice(
15281528
// If backtraces are enabled, also print the query stack
15291529
let backtrace = env::var_os("RUST_BACKTRACE").is_some_and(|x| &x != "0");
15301530

1531-
let num_frames = if backtrace { None } else { Some(2) };
1531+
let limit_frames = if backtrace { None } else { Some(2) };
15321532

1533-
interface::try_print_query_stack(dcx, num_frames, file);
1533+
interface::try_print_query_stack(dcx, limit_frames, file);
15341534

15351535
// We don't trust this callback not to panic itself, so run it at the end after we're sure we've
15361536
// printed all the relevant info.

0 commit comments

Comments
 (0)