Skip to content

Commit 649b995

Browse files
committed
Auto merge of #135893 - matthiaskrgr:rollup-2qqo647, r=matthiaskrgr
Rollup of 10 pull requests Successful merges: - #133372 (Refactor dyn-compatibility error and suggestions) - #134396 (AIX: use align 8 for byval parameter) - #135156 (Make our `DIFlags` match `LLVMDIFlags` in the LLVM-C API) - #135816 (Use `structurally_normalize` instead of manual `normalizes-to` goals in alias relate errors) - #135823 (make UI tests that use `--test` work on panic=abort targets) - #135850 (Update the `wasm-component-ld` tool) - #135858 (rustdoc: Finalize dyn compatibility renaming) - #135866 (Don't pick `T: FnPtr` nested goals as the leaf goal in diagnostics for new solver) - #135874 (Enforce that all spans are lowered in ast lowering) - #135875 (Remove `Copy` bound from `enter_forall`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents dee7d0e + e0b4ba3 commit 649b995

File tree

244 files changed

+2141
-1461
lines changed

Some content is hidden

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

244 files changed

+2141
-1461
lines changed

Cargo.lock

+20-21
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

+1-1
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

+24-17
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

+1
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

+10-14
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

+2-2
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_codegen_llvm/Cargo.toml

+2
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

+17-3
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_error_codes/src/error_codes/E0038.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -264,15 +264,15 @@ trait Foo {
264264
### Trait contains associated constants
265265

266266
Just like static functions, associated constants aren't stored on the method
267-
table. If the trait or any subtrait contain an associated constant, they cannot
268-
be made into an object.
267+
table. If the trait or any subtrait contain an associated constant, they are not
268+
dyn compatible.
269269

270270
```compile_fail,E0038
271271
trait Foo {
272272
const X: i32;
273273
}
274274
275-
impl Foo {}
275+
impl dyn Foo {}
276276
```
277277

278278
A simple workaround is to use a helper method instead:

compiler/rustc_feature/src/removed.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ declare_features! (
163163
/// then removed. But there was no utility storing it separately, so now
164164
/// it's in this list.
165165
(removed, no_stack_check, "1.0.0", None, None),
166-
/// Allows making `dyn Trait` well-formed even if `Trait` is not dyn-compatible (object safe).
166+
/// Allows making `dyn Trait` well-formed even if `Trait` is not dyn compatible (object safe).
167167
/// Renamed to `dyn_compatible_for_dispatch`.
168168
(removed, object_safe_for_dispatch, "1.83.0", Some(43561),
169169
Some("renamed to `dyn_compatible_for_dispatch`")),

compiler/rustc_feature/src/unstable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ declare_features! (
272272
(unstable, doc_notable_trait, "1.52.0", Some(45040)),
273273
/// Allows using the `may_dangle` attribute (RFC 1327).
274274
(unstable, dropck_eyepatch, "1.10.0", Some(34761)),
275-
/// Allows making `dyn Trait` well-formed even if `Trait` is not dyn-compatible[^1].
275+
/// Allows making `dyn Trait` well-formed even if `Trait` is not dyn compatible[^1].
276276
/// In that case, `dyn Trait: Trait` does not hold. Moreover, coercions and
277277
/// casts in safe Rust to `dyn Trait` for such a `Trait` is also forbidden.
278278
///

0 commit comments

Comments
 (0)