/// A "suite" of paths.
///
/// These can match as a path suffix (like `Set`), or as a prefix. For
- /// example, a command-line value of `src/test/ui/abi/variadic-ffi.rs`
- /// will match `src/test/ui`. A command-line value of `ui` would also
- /// match `src/test/ui`.
+ /// example, a command-line value of `tests/ui/abi/variadic-ffi.rs`
+ /// will match `tests/ui`. A command-line value of `ui` would also
+ /// match `tests/ui`.
Suite(TaskPath),
}
// this), as well as #63012 which is the tracking issue for this
// feature on the rustc side.
cargo.arg("-Zbinary-dep-depinfo");
- match mode {
- Mode::ToolBootstrap => {
- // Restrict the allowed features to those passed by rustbuild, so we don't depend on nightly accidentally.
- rustflags.arg("-Zallow-features=binary-dep-depinfo");
- }
- Mode::ToolStd => {
- // Right now this is just compiletest and a few other tools that build on stable.
- // Allow them to use `feature(test)`, but nothing else.
- rustflags.arg("-Zallow-features=binary-dep-depinfo,test,proc_macro_internals,proc_macro_diagnostic,proc_macro_span");
+ let allow_features = match mode {
+ Mode::ToolBootstrap | Mode::ToolStd => {
+ // Restrict the allowed features so we don't depend on nightly
+ // accidentally.
+ //
+ // binary-dep-depinfo is used by rustbuild itself for all
+ // compilations.
+ //
+ // Lots of tools depend on proc_macro2 and proc-macro-error.
+ // Those have build scripts which assume nightly features are
+ // available if the `rustc` version is "nighty" or "dev". See
+ // bin/rustc.rs for why that is a problem. Instead of labeling
+ // those features for each individual tool that needs them,
+ // just blanket allow them here.
+ //
+ // If this is ever removed, be sure to add something else in
+ // its place to keep the restrictions in place (or make a way
+ // to unset RUSTC_BOOTSTRAP).
+ "binary-dep-depinfo,proc_macro_span,proc_macro_span_shrink,proc_macro_diagnostic"
+ .to_string()
}
- Mode::Std | Mode::Rustc | Mode::Codegen | Mode::ToolRustc => {}
- }
+ Mode::Std | Mode::Rustc | Mode::Codegen | Mode::ToolRustc => String::new(),
+ };
cargo.arg("-j").arg(self.jobs().to_string());
}
}
- Cargo { command: cargo, rustflags, rustdocflags }
+ Cargo { command: cargo, rustflags, rustdocflags, allow_features }
}
/// Ensure that a given step is built, returning its output. This will
command: Command,
rustflags: Rustflags,
rustdocflags: Rustflags,
+ allow_features: String,
}
impl Cargo {
self.command.current_dir(dir);
self
}
+
+ /// Adds nightly-only features that this invocation is allowed to use.
+ ///
+ /// By default, all nightly features are allowed. Once this is called, it
+ /// will be restricted to the given set.
+ pub fn allow_features(&mut self, features: &str) -> &mut Cargo {
+ if !self.allow_features.is_empty() {
+ self.allow_features.push(',');
+ }
+ self.allow_features.push_str(features);
+ self
+ }
}
impl From<Cargo> for Command {
cargo.command.env("RUSTDOCFLAGS", rustdocflags);
}
+ if !cargo.allow_features.is_empty() {
+ cargo.command.env("RUSTC_ALLOW_FEATURES", cargo.allow_features);
+ }
+
cargo.command
}
}