Skip to content

Commit d1f6052

Browse files
authored
Merge branch 'rust-lang:master' into dep_graph_cap
2 parents e2a8bc0 + 96cfc75 commit d1f6052

File tree

1,409 files changed

+18320
-13691
lines changed

Some content is hidden

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

1,409 files changed

+18320
-13691
lines changed

Cargo.lock

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2751,9 +2751,9 @@ dependencies = [
27512751

27522752
[[package]]
27532753
name = "psm"
2754-
version = "0.1.24"
2754+
version = "0.1.25"
27552755
source = "registry+https://github.com/rust-lang/crates.io-index"
2756-
checksum = "200b9ff220857e53e184257720a14553b2f4aa02577d2ed9842d45d4b9654810"
2756+
checksum = "f58e5423e24c18cc840e1c98370b3993c6649cd1678b4d24318bcf0a083cbe88"
27572757
dependencies = [
27582758
"cc",
27592759
]
@@ -3207,6 +3207,7 @@ dependencies = [
32073207
"rustc_abi",
32083208
"rustc_ast",
32093209
"rustc_ast_pretty",
3210+
"rustc_attr_parsing",
32103211
"rustc_data_structures",
32113212
"rustc_errors",
32123213
"rustc_feature",
@@ -3215,6 +3216,7 @@ dependencies = [
32153216
"rustc_index",
32163217
"rustc_macros",
32173218
"rustc_middle",
3219+
"rustc_parse",
32183220
"rustc_session",
32193221
"rustc_span",
32203222
"rustc_target",
@@ -3263,14 +3265,10 @@ dependencies = [
32633265
"rustc_ast",
32643266
"rustc_ast_pretty",
32653267
"rustc_data_structures",
3266-
"rustc_errors",
3267-
"rustc_feature",
3268-
"rustc_fluent_macro",
3269-
"rustc_lexer",
32703268
"rustc_macros",
32713269
"rustc_serialize",
3272-
"rustc_session",
32733270
"rustc_span",
3271+
"thin-vec",
32743272
]
32753273

32763274
[[package]]
@@ -3285,11 +3283,13 @@ dependencies = [
32853283
"rustc_errors",
32863284
"rustc_feature",
32873285
"rustc_fluent_macro",
3286+
"rustc_hir",
32883287
"rustc_lexer",
32893288
"rustc_macros",
32903289
"rustc_serialize",
32913290
"rustc_session",
32923291
"rustc_span",
3292+
"thin-vec",
32933293
]
32943294

32953295
[[package]]
@@ -3342,6 +3342,7 @@ dependencies = [
33423342
"rustc_expand",
33433343
"rustc_feature",
33443344
"rustc_fluent_macro",
3345+
"rustc_hir",
33453346
"rustc_index",
33463347
"rustc_lexer",
33473348
"rustc_lint_defs",
@@ -3598,6 +3599,7 @@ dependencies = [
35983599
"rustc_abi",
35993600
"rustc_ast",
36003601
"rustc_ast_pretty",
3602+
"rustc_attr_data_structures",
36013603
"rustc_data_structures",
36023604
"rustc_error_codes",
36033605
"rustc_error_messages",
@@ -3632,6 +3634,7 @@ dependencies = [
36323634
"rustc_errors",
36333635
"rustc_feature",
36343636
"rustc_fluent_macro",
3637+
"rustc_hir",
36353638
"rustc_lexer",
36363639
"rustc_lint_defs",
36373640
"rustc_macros",
@@ -3690,6 +3693,7 @@ dependencies = [
36903693
"rustc_abi",
36913694
"rustc_arena",
36923695
"rustc_ast",
3696+
"rustc_attr_data_structures",
36933697
"rustc_data_structures",
36943698
"rustc_hashes",
36953699
"rustc_index",
@@ -3737,6 +3741,7 @@ dependencies = [
37373741
"rustc_abi",
37383742
"rustc_ast",
37393743
"rustc_ast_pretty",
3744+
"rustc_attr_parsing",
37403745
"rustc_hir",
37413746
"rustc_span",
37423747
]
@@ -3779,6 +3784,7 @@ dependencies = [
37793784
"rustc_fluent_macro",
37803785
"rustc_fs_util",
37813786
"rustc_graphviz",
3787+
"rustc_hashes",
37823788
"rustc_hir",
37833789
"rustc_macros",
37843790
"rustc_middle",
@@ -4243,6 +4249,7 @@ name = "rustc_query_impl"
42434249
version = "0.0.0"
42444250
dependencies = [
42454251
"measureme",
4252+
"rustc_attr_data_structures",
42464253
"rustc_data_structures",
42474254
"rustc_errors",
42484255
"rustc_hashes",
@@ -4265,6 +4272,7 @@ dependencies = [
42654272
"rustc-rayon-core",
42664273
"rustc_abi",
42674274
"rustc_ast",
4275+
"rustc_attr_data_structures",
42684276
"rustc_data_structures",
42694277
"rustc_errors",
42704278
"rustc_feature",
@@ -4315,6 +4323,7 @@ version = "0.0.0"
43154323
dependencies = [
43164324
"bitflags",
43174325
"rustc_abi",
4326+
"rustc_ast",
43184327
"rustc_data_structures",
43194328
"rustc_hir",
43204329
"rustc_middle",
@@ -4411,6 +4420,7 @@ dependencies = [
44114420
"punycode",
44124421
"rustc-demangle",
44134422
"rustc_abi",
4423+
"rustc_ast",
44144424
"rustc_data_structures",
44154425
"rustc_errors",
44164426
"rustc_hashes",
@@ -4570,6 +4580,7 @@ dependencies = [
45704580
"itertools",
45714581
"minifier",
45724582
"pulldown-cmark 0.9.6",
4583+
"pulldown-cmark-escape",
45734584
"regex",
45744585
"rinja",
45754586
"rustdoc-json-types",
@@ -4947,9 +4958,9 @@ dependencies = [
49474958

49484959
[[package]]
49494960
name = "stacker"
4950-
version = "0.1.17"
4961+
version = "0.1.18"
49514962
source = "registry+https://github.com/rust-lang/crates.io-index"
4952-
checksum = "799c883d55abdb5e98af1a7b3f23b9b6de8ecada0ecac058672d7635eb48ca7b"
4963+
checksum = "1d08feb8f695b465baed819b03c128dc23f57a694510ab1f06c77f763975685e"
49534964
dependencies = [
49544965
"cc",
49554966
"cfg-if",

compiler/rustc/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "rustc-main"
33
version = "0.0.0"
4-
edition = "2021"
4+
edition = "2024"
55

66
[dependencies]
77
# tidy-alphabetical-start

compiler/rustc/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ fn main() {
6565
// linking, so we need to explicitly depend on the function.
6666
#[cfg(target_os = "macos")]
6767
{
68-
extern "C" {
68+
unsafe extern "C" {
6969
fn _rjem_je_zone_register();
7070
}
7171

compiler/rustc_abi/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "rustc_abi"
33
version = "0.0.0"
4-
edition = "2021"
4+
edition = "2024"
55

66
[dependencies]
77
# tidy-alphabetical-start

compiler/rustc_abi/src/callconv.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ impl<'a, Ty> TyAndLayout<'a, Ty> {
6565
Ty: TyAbiInterface<'a, C> + Copy,
6666
{
6767
match self.backend_repr {
68-
BackendRepr::Uninhabited => Err(Heterogeneous),
69-
7068
// The primitive for this algorithm.
7169
BackendRepr::Scalar(scalar) => {
7270
let kind = match scalar.primitive() {

compiler/rustc_abi/src/callconv/reg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl Reg {
5757
128 => dl.f128_align.abi,
5858
_ => panic!("unsupported float: {self:?}"),
5959
},
60-
RegKind::Vector => dl.vector_align(self.size).abi,
60+
RegKind::Vector => dl.llvmlike_vector_align(self.size).abi,
6161
}
6262
}
6363
}

compiler/rustc_abi/src/layout.rs

Lines changed: 35 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
130130
},
131131
backend_repr: BackendRepr::ScalarPair(a, b),
132132
largest_niche,
133+
uninhabited: false,
133134
align,
134135
size,
135136
max_repr_align: None,
@@ -221,8 +222,9 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
221222
LayoutData {
222223
variants: Variants::Empty,
223224
fields: FieldsShape::Primitive,
224-
backend_repr: BackendRepr::Uninhabited,
225+
backend_repr: BackendRepr::Memory { sized: true },
225226
largest_niche: None,
227+
uninhabited: true,
226228
align: dl.i8_align,
227229
size: Size::ZERO,
228230
max_repr_align: None,
@@ -308,10 +310,10 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
308310
let mut align = if repr.pack.is_some() { dl.i8_align } else { dl.aggregate_align };
309311
let mut max_repr_align = repr.align;
310312

311-
// If all the non-ZST fields have the same ABI and union ABI optimizations aren't
312-
// disabled, we can use that common ABI for the union as a whole.
313+
// If all the non-ZST fields have the same repr and union repr optimizations aren't
314+
// disabled, we can use that common repr for the union as a whole.
313315
struct AbiMismatch;
314-
let mut common_non_zst_abi_and_align = if repr.inhibits_union_abi_opt() {
316+
let mut common_non_zst_repr_and_align = if repr.inhibits_union_abi_opt() {
315317
// Can't optimize
316318
Err(AbiMismatch)
317319
} else {
@@ -335,14 +337,14 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
335337
continue;
336338
}
337339

338-
if let Ok(common) = common_non_zst_abi_and_align {
340+
if let Ok(common) = common_non_zst_repr_and_align {
339341
// Discard valid range information and allow undef
340342
let field_abi = field.backend_repr.to_union();
341343

342344
if let Some((common_abi, common_align)) = common {
343345
if common_abi != field_abi {
344346
// Different fields have different ABI: disable opt
345-
common_non_zst_abi_and_align = Err(AbiMismatch);
347+
common_non_zst_repr_and_align = Err(AbiMismatch);
346348
} else {
347349
// Fields with the same non-Aggregate ABI should also
348350
// have the same alignment
@@ -355,7 +357,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
355357
}
356358
} else {
357359
// First non-ZST field: record its ABI and alignment
358-
common_non_zst_abi_and_align = Ok(Some((field_abi, field.align.abi)));
360+
common_non_zst_repr_and_align = Ok(Some((field_abi, field.align.abi)));
359361
}
360362
}
361363
}
@@ -374,16 +376,25 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
374376

375377
// If all non-ZST fields have the same ABI, we may forward that ABI
376378
// for the union as a whole, unless otherwise inhibited.
377-
let abi = match common_non_zst_abi_and_align {
379+
let backend_repr = match common_non_zst_repr_and_align {
378380
Err(AbiMismatch) | Ok(None) => BackendRepr::Memory { sized: true },
379-
Ok(Some((abi, _))) => {
380-
if abi.inherent_align(dl).map(|a| a.abi) != Some(align.abi) {
381-
// Mismatched alignment (e.g. union is #[repr(packed)]): disable opt
381+
Ok(Some((repr, _))) => match repr {
382+
// Mismatched alignment (e.g. union is #[repr(packed)]): disable opt
383+
BackendRepr::Scalar(_) | BackendRepr::ScalarPair(_, _)
384+
if repr.scalar_align(dl).unwrap() != align.abi =>
385+
{
382386
BackendRepr::Memory { sized: true }
383-
} else {
384-
abi
385387
}
386-
}
388+
// Vectors require at least element alignment, else disable the opt
389+
BackendRepr::Vector { element, count: _ } if element.align(dl).abi > align.abi => {
390+
BackendRepr::Memory { sized: true }
391+
}
392+
// the alignment tests passed and we can use this
393+
BackendRepr::Scalar(..)
394+
| BackendRepr::ScalarPair(..)
395+
| BackendRepr::Vector { .. }
396+
| BackendRepr::Memory { .. } => repr,
397+
},
387398
};
388399

389400
let Some(union_field_count) = NonZeroUsize::new(only_variant.len()) else {
@@ -398,8 +409,9 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
398409
Ok(LayoutData {
399410
variants: Variants::Single { index: only_variant_idx },
400411
fields: FieldsShape::Union(union_field_count),
401-
backend_repr: abi,
412+
backend_repr,
402413
largest_niche: None,
414+
uninhabited: false,
403415
align,
404416
size: size.align_to(align.abi),
405417
max_repr_align,
@@ -447,7 +459,6 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
447459
Scalar::Union { .. } => {}
448460
};
449461
match &mut st.backend_repr {
450-
BackendRepr::Uninhabited => {}
451462
BackendRepr::Scalar(scalar) => hide_niches(scalar),
452463
BackendRepr::ScalarPair(a, b) => {
453464
hide_niches(a);
@@ -639,9 +650,8 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
639650
let same_size = size == variant_layouts[largest_variant_index].size;
640651
let same_align = align == variant_layouts[largest_variant_index].align;
641652

642-
let abi = if variant_layouts.iter().all(|v| v.is_uninhabited()) {
643-
BackendRepr::Uninhabited
644-
} else if same_size && same_align && others_zst {
653+
let uninhabited = variant_layouts.iter().all(|v| v.is_uninhabited());
654+
let abi = if same_size && same_align && others_zst {
645655
match variant_layouts[largest_variant_index].backend_repr {
646656
// When the total alignment and size match, we can use the
647657
// same ABI as the scalar variant with the reserved niche.
@@ -683,6 +693,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
683693
},
684694
backend_repr: abi,
685695
largest_niche,
696+
uninhabited,
686697
size,
687698
align,
688699
max_repr_align,
@@ -853,9 +864,8 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
853864
};
854865
let mut abi = BackendRepr::Memory { sized: true };
855866

856-
if layout_variants.iter().all(|v| v.is_uninhabited()) {
857-
abi = BackendRepr::Uninhabited;
858-
} else if tag.size(dl) == size {
867+
let uninhabited = layout_variants.iter().all(|v| v.is_uninhabited());
868+
if tag.size(dl) == size {
859869
// Make sure we only use scalar layout when the enum is entirely its
860870
// own tag (i.e. it has no padding nor any non-ZST variant fields).
861871
abi = BackendRepr::Scalar(tag);
@@ -995,6 +1005,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
9951005
memory_index: [0].into(),
9961006
},
9971007
largest_niche,
1008+
uninhabited,
9981009
backend_repr: abi,
9991010
align,
10001011
size,
@@ -1355,9 +1366,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
13551366
_ => {}
13561367
}
13571368
}
1358-
if fields.iter().any(|f| f.is_uninhabited()) {
1359-
abi = BackendRepr::Uninhabited;
1360-
}
1369+
let uninhabited = fields.iter().any(|f| f.is_uninhabited());
13611370

13621371
let unadjusted_abi_align = if repr.transparent() {
13631372
match layout_of_single_non_zst_field {
@@ -1378,6 +1387,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
13781387
fields: FieldsShape::Arbitrary { offsets, memory_index },
13791388
backend_repr: abi,
13801389
largest_niche,
1390+
uninhabited,
13811391
align,
13821392
size,
13831393
max_repr_align,

0 commit comments

Comments
 (0)