Skip to content

Commit ac3c50b

Browse files
tamirdojeda
authored andcommitted
scripts: generate_rust_analyzer: compile sysroot with correct edition
Use `core_edition` for all sysroot crates rather than just core as all were updated to edition 2024 in Rust 1.87. Fixes: f4daa80 ("rust: compile libcore with edition 2024 for 1.87+") Signed-off-by: Tamir Duberstein <tamird@kernel.org> Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20260116-rust-analyzer-sysroot-v2-1-094aedc33208@kernel.org [ Added `>`s to make the quote a single block. - Miguel ] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
1 parent bc83834 commit ac3c50b

1 file changed

Lines changed: 26 additions & 3 deletions

File tree

scripts/generate_rust_analyzer.py

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,21 +61,44 @@ def append_sysroot_crate(
6161
display_name,
6262
deps,
6363
cfg=[],
64-
edition="2021",
6564
):
6665
append_crate(
6766
display_name,
6867
sysroot_src / display_name / "src" / "lib.rs",
6968
deps,
7069
cfg,
7170
is_workspace_member=False,
72-
edition=edition,
71+
# Miguel Ojeda writes:
72+
#
73+
# > ... in principle even the sysroot crates may have different
74+
# > editions.
75+
# >
76+
# > For instance, in the move to 2024, it seems all happened at once
77+
# > in 1.87.0 in these upstream commits:
78+
# >
79+
# > 0e071c2c6a58 ("Migrate core to Rust 2024")
80+
# > f505d4e8e380 ("Migrate alloc to Rust 2024")
81+
# > 0b2489c226c3 ("Migrate proc_macro to Rust 2024")
82+
# > 993359e70112 ("Migrate std to Rust 2024")
83+
# >
84+
# > But in the previous move to 2021, `std` moved in 1.59.0, while
85+
# > the others in 1.60.0:
86+
# >
87+
# > b656384d8398 ("Update stdlib to the 2021 edition")
88+
# > 06a1c14d52a8 ("Switch all libraries to the 2021 edition")
89+
#
90+
# Link: https://lore.kernel.org/all/CANiq72kd9bHdKaAm=8xCUhSHMy2csyVed69bOc4dXyFAW4sfuw@mail.gmail.com/
91+
#
92+
# At the time of writing all rust versions we support build the
93+
# sysroot crates with the same edition. We may need to relax this
94+
# assumption if future edition moves span multiple rust versions.
95+
edition=core_edition,
7396
)
7497

7598
# NB: sysroot crates reexport items from one another so setting up our transitive dependencies
7699
# here is important for ensuring that rust-analyzer can resolve symbols. The sources of truth
77100
# for this dependency graph are `(sysroot_src / crate / "Cargo.toml" for crate in crates)`.
78-
append_sysroot_crate("core", [], cfg=crates_cfgs.get("core", []), edition=core_edition)
101+
append_sysroot_crate("core", [], cfg=crates_cfgs.get("core", []))
79102
append_sysroot_crate("alloc", ["core"])
80103
append_sysroot_crate("std", ["alloc", "core"])
81104
append_sysroot_crate("proc_macro", ["core", "std"])

0 commit comments

Comments
 (0)