From 2b533e6b49e6c918389f7a38e6b6e7e030f30fed Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 4 Apr 2025 15:05:44 +0200 Subject: [PATCH] bootstrap: Only add `rustc_randomized_layouts` if the crate has it --- library/Cargo.lock | 5 +++++ library/proc_macro/Cargo.toml | 2 +- library/proc_macro/src/lib.rs | 1 + src/bootstrap/src/lib.rs | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/library/Cargo.lock b/library/Cargo.lock index 23d9d926eba3..c45a84b2e340 100644 --- a/library/Cargo.lock +++ b/library/Cargo.lock @@ -235,6 +235,7 @@ name = "proc_macro" version = "0.0.0" dependencies = [ "core", + "rustc-literal-escaper", "std", ] @@ -310,6 +311,10 @@ dependencies = [ "rustc-std-workspace-core", ] +[[package]] +name = "rustc-literal-escaper" +version = "0.0.1" + [[package]] name = "rustc-std-workspace-alloc" version = "1.99.0" diff --git a/library/proc_macro/Cargo.toml b/library/proc_macro/Cargo.toml index f65c5e1a330c..b8bc2a3af4cd 100644 --- a/library/proc_macro/Cargo.toml +++ b/library/proc_macro/Cargo.toml @@ -9,4 +9,4 @@ std = { path = "../std" } # `core` when resolving doc links. Without this line a different `core` will be # loaded from sysroot causing duplicate lang items and other similar errors. core = { path = "../core" } -rustc-literal-escaper = "0.0.1" +rustc-literal-escaper = { version = "0.0.2", features = ["rustc-dep-of-std"] } diff --git a/library/proc_macro/src/lib.rs b/library/proc_macro/src/lib.rs index 35a8af03ba43..f1cf0c5a2db7 100644 --- a/library/proc_macro/src/lib.rs +++ b/library/proc_macro/src/lib.rs @@ -27,6 +27,7 @@ #![feature(panic_can_unwind)] #![feature(restricted_std)] #![feature(rustc_attrs)] +#![feature(stmt_expr_attributes)] #![feature(extend_one)] #![recursion_limit = "256"] #![allow(internal_features)] diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs index 843d474f92de..7c60e0421421 100644 --- a/src/bootstrap/src/lib.rs +++ b/src/bootstrap/src/lib.rs @@ -748,7 +748,7 @@ impl Build { features.push("llvm"); } // keep in sync with `bootstrap/compile.rs:rustc_cargo_env` - if self.config.rust_randomize_layout { + if self.config.rust_randomize_layout && check("rustc_randomized_layouts") { features.push("rustc_randomized_layouts"); }