Closed
Description
The feature detection just checks RUSTFLAGS
directly, which does not include configuration added by Cargo itself. This causes problems in environments where that configuration may change whether or not backtrace is available (or compiles):
cargo new proc-macro2-issue
cd proc-macro2-issue
mkdir .cargo
echo '[build]' >> .cargo/config.toml
echo 'rustflags = ["-Zallow-features="]' >> .cargo/config.toml
echo 'proc-macro2 = "1"' >> Cargo.toml
rustup override set nightly
cargo check
produces
Updating crates.io index
Compiling proc-macro2 v1.0.27
Checking unicode-xid v0.2.2
error[E0725]: the feature `proc_macro_span` is not in the list of allowed features
--> /Users/jongje/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.27/src/lib.rs:82:59
|
82 | #![cfg_attr(any(proc_macro_span, super_unstable), feature(proc_macro_span))]
| ^^^^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'proc_macro_span'
--> /Users/jongje/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.27/src/wrapper.rs:517:72
|
517 | (Span::Compiler(a), Span::Compiler(b)) => Span::Compiler(a.join(b)?),
| ^^^^
|
= note: see issue #54725 <https://github.com/rust-lang/rust/issues/54725> for more information
= help: add `#![feature(proc_macro_span)]` to the crate attributes to enable
...
To fix this, we'll need Cargo to expose its final configuration for rustc, which is rust-lang/cargo#9600. A fix for that is pending in rust-lang/cargo#9601.
Metadata
Metadata
Assignees
Labels
No labels