Skip to content

Commit bba9663

Browse files
authored
Merge pull request rust-lang#4203 from RalfJung/rustup
Rustup
2 parents 13ff65e + 18e19b9 commit bba9663

File tree

1,038 files changed

+12619
-8006
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,038 files changed

+12619
-8006
lines changed

.github/workflows/ci.yml

+6
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ jobs:
7070
HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
7171
DOCKER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7272
SCCACHE_BUCKET: rust-lang-ci-sccache2
73+
SCCACHE_REGION: us-west-1
7374
CACHE_DOMAIN: ci-caches.rust-lang.org
7475
continue-on-error: ${{ matrix.continue_on_error || false }}
7576
strategy:
@@ -173,6 +174,11 @@ jobs:
173174
- name: ensure the stable version number is correct
174175
run: src/ci/scripts/verify-stable-version-number.sh
175176

177+
# Show the environment just before we run the build
178+
# This makes it easier to diagnose problems with the above install scripts.
179+
- name: show the current environment
180+
run: src/ci/scripts/dump-environment.sh
181+
176182
- name: run the build
177183
# Redirect stderr to stdout to avoid reordering the two streams in the GHA logs.
178184
run: src/ci/scripts/run-build-from-ci.sh 2>&1

Cargo.lock

+5-11
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
]
@@ -3748,7 +3748,6 @@ dependencies = [
37483748
"itertools",
37493749
"rustc_abi",
37503750
"rustc_ast",
3751-
"rustc_ast_ir",
37523751
"rustc_attr_parsing",
37533752
"rustc_data_structures",
37543753
"rustc_errors",
@@ -3780,6 +3779,7 @@ dependencies = [
37803779
"rustc_fluent_macro",
37813780
"rustc_fs_util",
37823781
"rustc_graphviz",
3782+
"rustc_hashes",
37833783
"rustc_hir",
37843784
"rustc_macros",
37853785
"rustc_middle",
@@ -3813,7 +3813,6 @@ dependencies = [
38133813
name = "rustc_infer"
38143814
version = "0.0.0"
38153815
dependencies = [
3816-
"rustc_ast_ir",
38173816
"rustc_data_structures",
38183817
"rustc_errors",
38193818
"rustc_fluent_macro",
@@ -4004,7 +4003,6 @@ dependencies = [
40044003
"rustc_apfloat",
40054004
"rustc_arena",
40064005
"rustc_ast",
4007-
"rustc_ast_ir",
40084006
"rustc_attr_parsing",
40094007
"rustc_data_structures",
40104008
"rustc_error_messages",
@@ -4134,7 +4132,6 @@ name = "rustc_next_trait_solver"
41344132
version = "0.0.0"
41354133
dependencies = [
41364134
"derive-where",
4137-
"rustc_ast_ir",
41384135
"rustc_data_structures",
41394136
"rustc_index",
41404137
"rustc_macros",
@@ -4454,7 +4451,6 @@ dependencies = [
44544451
"itertools",
44554452
"rustc_abi",
44564453
"rustc_ast",
4457-
"rustc_ast_ir",
44584454
"rustc_attr_parsing",
44594455
"rustc_data_structures",
44604456
"rustc_errors",
@@ -4493,7 +4489,6 @@ version = "0.0.0"
44934489
dependencies = [
44944490
"itertools",
44954491
"rustc_abi",
4496-
"rustc_ast_ir",
44974492
"rustc_data_structures",
44984493
"rustc_hir",
44994494
"rustc_infer",
@@ -4509,7 +4504,6 @@ version = "0.0.0"
45094504
dependencies = [
45104505
"itertools",
45114506
"rustc_abi",
4512-
"rustc_ast_ir",
45134507
"rustc_data_structures",
45144508
"rustc_errors",
45154509
"rustc_fluent_macro",
@@ -4954,9 +4948,9 @@ dependencies = [
49544948

49554949
[[package]]
49564950
name = "stacker"
4957-
version = "0.1.17"
4951+
version = "0.1.18"
49584952
source = "registry+https://github.com/rust-lang/crates.io-index"
4959-
checksum = "799c883d55abdb5e98af1a7b3f23b9b6de8ecada0ecac058672d7635eb48ca7b"
4953+
checksum = "1d08feb8f695b465baed819b03c128dc23f57a694510ab1f06c77f763975685e"
49604954
dependencies = [
49614955
"cc",
49624956
"cfg-if",

compiler/rustc/Cargo.toml

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

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

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

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

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

+35-25
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)