Skip to content

Commit ba4b8b2

Browse files
Allow required unstable features for RA sysroot ABI
1 parent b189b49 commit ba4b8b2

File tree

4 files changed

+27
-3
lines changed

4 files changed

+27
-3
lines changed

src/bootstrap/builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1558,7 +1558,7 @@ impl<'a> Builder<'a> {
15581558
Mode::ToolStd => {
15591559
// Right now this is just compiletest and a few other tools that build on stable.
15601560
// Allow them to use `feature(test)`, but nothing else.
1561-
rustflags.arg("-Zallow-features=binary-dep-depinfo,test,backtrace");
1561+
rustflags.arg("-Zallow-features=binary-dep-depinfo,test,backtrace,proc_macro_internals,proc_macro_diagnostic,proc_macro_span");
15621562
}
15631563
Mode::Std | Mode::Rustc | Mode::Codegen | Mode::ToolRustc => {}
15641564
}

src/bootstrap/dist.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1058,7 +1058,11 @@ impl Step for RustAnalyzer {
10581058
}
10591059

10601060
let rust_analyzer = builder
1061-
.ensure(tool::RustAnalyzer { compiler, target, extra_features: Vec::new() })
1061+
.ensure(tool::RustAnalyzer {
1062+
compiler,
1063+
target,
1064+
extra_features: vec!["in-rust-tree".to_owned()]
1065+
})
10621066
.expect("rust-analyzer always builds");
10631067

10641068
let mut tarball = Tarball::new(builder, "rust-analyzer", &target.triple);

src/bootstrap/test.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,11 @@ impl Step for RustAnalyzer {
378378
let compiler = builder.compiler(stage, host);
379379

380380
builder
381-
.ensure(tool::RustAnalyzer { compiler, target: self.host, extra_features: Vec::new() })
381+
.ensure(tool::RustAnalyzer {
382+
compiler,
383+
target: self.host,
384+
extra_features: vec!["in-rust-tree".to_owned()]
385+
})
382386
.expect("in-tree tool");
383387

384388
let mut cargo = tool::prepare_tool_cargo(

src/tools/rust-analyzer/crates/proc-macro-srv/src/abis/mod.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@
2222
//! need to update the conditionals in `Abi::from_lib` to return your new ABI
2323
//! for the relevant versions of the rust compiler
2424
25+
#[cfg(not(feature = "in-rust-tree"))]
2526
mod abi_1_58;
27+
#[cfg(not(feature = "in-rust-tree"))]
2628
mod abi_1_63;
29+
#[cfg(not(feature = "in-rust-tree"))]
2730
mod abi_1_64;
2831
#[cfg(feature = "in-rust-tree")]
2932
mod abi_sysroot;
@@ -33,8 +36,11 @@ mod abi_sysroot;
3336
pub(crate) use abi_1_64::TokenStream as TestTokenStream;
3437

3538
use super::dylib::LoadProcMacroDylibError;
39+
#[cfg(not(feature = "in-rust-tree"))]
3640
pub(crate) use abi_1_58::Abi as Abi_1_58;
41+
#[cfg(not(feature = "in-rust-tree"))]
3742
pub(crate) use abi_1_63::Abi as Abi_1_63;
43+
#[cfg(not(feature = "in-rust-tree"))]
3844
pub(crate) use abi_1_64::Abi as Abi_1_64;
3945
#[cfg(feature = "in-rust-tree")]
4046
pub(crate) use abi_sysroot::Abi as AbiSysroot;
@@ -52,8 +58,11 @@ impl PanicMessage {
5258
}
5359

5460
pub(crate) enum Abi {
61+
#[cfg(not(feature = "in-rust-tree"))]
5562
Abi1_58(Abi_1_58),
63+
#[cfg(not(feature = "in-rust-tree"))]
5664
Abi1_63(Abi_1_63),
65+
#[cfg(not(feature = "in-rust-tree"))]
5766
Abi1_64(Abi_1_64),
5867
#[cfg(feature = "in-rust-tree")]
5968
Sysroot(AbiSysroot),
@@ -82,6 +91,7 @@ impl Abi {
8291

8392
// FIXME: this should use exclusive ranges when they're stable
8493
// https://github.com/rust-lang/rust/issues/37854
94+
#[cfg(not(feature = "in-rust-tree"))]
8595
match (info.version.0, info.version.1) {
8696
(1, 58..=62) => {
8797
let inner = unsafe { Abi_1_58::from_lib(lib, symbol_name) }?;
@@ -106,8 +116,11 @@ impl Abi {
106116
attributes: Option<&tt::Subtree>,
107117
) -> Result<tt::Subtree, PanicMessage> {
108118
match self {
119+
#[cfg(not(feature = "in-rust-tree"))]
109120
Self::Abi1_58(abi) => abi.expand(macro_name, macro_body, attributes),
121+
#[cfg(not(feature = "in-rust-tree"))]
110122
Self::Abi1_63(abi) => abi.expand(macro_name, macro_body, attributes),
123+
#[cfg(not(feature = "in-rust-tree"))]
111124
Self::Abi1_64(abi) => abi.expand(macro_name, macro_body, attributes),
112125
#[cfg(feature = "in-rust-tree")]
113126
Self::AbiSysroot(abi) => abi.expand(macro_name, macro_body, attributes),
@@ -116,8 +129,11 @@ impl Abi {
116129

117130
pub fn list_macros(&self) -> Vec<(String, ProcMacroKind)> {
118131
match self {
132+
#[cfg(not(feature = "in-rust-tree"))]
119133
Self::Abi1_58(abi) => abi.list_macros(),
134+
#[cfg(not(feature = "in-rust-tree"))]
120135
Self::Abi1_63(abi) => abi.list_macros(),
136+
#[cfg(not(feature = "in-rust-tree"))]
121137
Self::Abi1_64(abi) => abi.list_macros(),
122138
#[cfg(feature = "in-rust-tree")]
123139
Self::AbiSysroot(abi) => abi.list_macros(),

0 commit comments

Comments
 (0)