Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: f4daa80d6be7 ("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>

authored by

Tamir Duberstein and committed by
Miguel Ojeda
ac3c50b9 bc83834c

+26 -3
+26 -3
scripts/generate_rust_analyzer.py
··· 61 61 display_name, 62 62 deps, 63 63 cfg=[], 64 - edition="2021", 65 64 ): 66 65 append_crate( 67 66 display_name, ··· 68 69 deps, 69 70 cfg, 70 71 is_workspace_member=False, 71 - edition=edition, 72 + # Miguel Ojeda writes: 73 + # 74 + # > ... in principle even the sysroot crates may have different 75 + # > editions. 76 + # > 77 + # > For instance, in the move to 2024, it seems all happened at once 78 + # > in 1.87.0 in these upstream commits: 79 + # > 80 + # > 0e071c2c6a58 ("Migrate core to Rust 2024") 81 + # > f505d4e8e380 ("Migrate alloc to Rust 2024") 82 + # > 0b2489c226c3 ("Migrate proc_macro to Rust 2024") 83 + # > 993359e70112 ("Migrate std to Rust 2024") 84 + # > 85 + # > But in the previous move to 2021, `std` moved in 1.59.0, while 86 + # > the others in 1.60.0: 87 + # > 88 + # > b656384d8398 ("Update stdlib to the 2021 edition") 89 + # > 06a1c14d52a8 ("Switch all libraries to the 2021 edition") 90 + # 91 + # Link: https://lore.kernel.org/all/CANiq72kd9bHdKaAm=8xCUhSHMy2csyVed69bOc4dXyFAW4sfuw@mail.gmail.com/ 92 + # 93 + # At the time of writing all rust versions we support build the 94 + # sysroot crates with the same edition. We may need to relax this 95 + # assumption if future edition moves span multiple rust versions. 96 + edition=core_edition, 72 97 ) 73 98 74 99 # NB: sysroot crates reexport items from one another so setting up our transitive dependencies 75 100 # here is important for ensuring that rust-analyzer can resolve symbols. The sources of truth 76 101 # for this dependency graph are `(sysroot_src / crate / "Cargo.toml" for crate in crates)`. 77 - append_sysroot_crate("core", [], cfg=crates_cfgs.get("core", []), edition=core_edition) 102 + append_sysroot_crate("core", [], cfg=crates_cfgs.get("core", [])) 78 103 append_sysroot_crate("alloc", ["core"]) 79 104 append_sysroot_crate("std", ["alloc", "core"]) 80 105 append_sysroot_crate("proc_macro", ["core", "std"])