Skip to content

Commit 96897df

Browse files
committed
Auto merge of rust-lang#141595 - bjorn3:rustc_no_sysroot_proc_macro, r=onur-ozkan
Do not get proc_macro from the sysroot in rustc With the stage0 refactor the proc_macro version found in the sysroot will no longer always match the proc_macro version that proc-macros get compiled with by the rustc executable that uses this proc_macro. This will cause problems as soon as the ABI of the bridge gets changed to implement new features or change the way existing features work. To fix this, this commit changes rustc crates to depend directly on the local version of proc_macro which will also be used in the sysroot that rustc will build.
2 parents 3be7537 + 8a60737 commit 96897df

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

proc_macro/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@ std = { path = "../std" }
1010
# loaded from sysroot causing duplicate lang items and other similar errors.
1111
core = { path = "../core" }
1212
rustc-literal-escaper = { version = "0.0.2", features = ["rustc-dep-of-std"] }
13+
14+
[features]
15+
default = ["rustc-dep-of-std"]
16+
rustc-dep-of-std = []

proc_macro/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#![recursion_limit = "256"]
3333
#![allow(internal_features)]
3434
#![deny(ffi_unwind_calls)]
35+
#![allow(rustc::internal)] // Can't use FxHashMap when compiled as part of the standard library
3536
#![warn(rustdoc::unescaped_backticks)]
3637
#![warn(unreachable_pub)]
3738
#![deny(unsafe_op_in_unsafe_fn)]
@@ -95,7 +96,7 @@ pub fn is_available() -> bool {
9596
///
9697
/// This is both the input and output of `#[proc_macro]`, `#[proc_macro_attribute]`
9798
/// and `#[proc_macro_derive]` definitions.
98-
#[rustc_diagnostic_item = "TokenStream"]
99+
#[cfg_attr(feature = "rustc-dep-of-std", rustc_diagnostic_item = "TokenStream")]
99100
#[stable(feature = "proc_macro_lib", since = "1.15.0")]
100101
#[derive(Clone)]
101102
pub struct TokenStream(Option<bridge::client::TokenStream>);

0 commit comments

Comments
 (0)