mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Auto merge of #92482 - matthiaskrgr:rollup-uso1zi0, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #84083 (Clarify the guarantees that ThreadId does and doesn't make.) - #91593 (Remove unnecessary bounds for some Hash{Map,Set} methods) - #92297 (Reduce compile time of rustbuild) - #92332 (Add test for where clause order) - #92438 (Enforce formatting for rustc_codegen_cranelift) - #92463 (Remove pronunciation guide from Vec<T>) - #92468 (Emit an error for `--cfg=)`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
7b13c628a2
24
Cargo.lock
24
Cargo.lock
@ -175,9 +175,7 @@ dependencies = [
|
||||
"filetime",
|
||||
"getopts",
|
||||
"ignore",
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"merge",
|
||||
"num_cpus",
|
||||
"once_cell",
|
||||
"opener",
|
||||
@ -2221,28 +2219,6 @@ dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "merge"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "10bbef93abb1da61525bbc45eeaff6473a41907d19f8f9aa5168d214e10693e9"
|
||||
dependencies = [
|
||||
"merge_derive",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "merge_derive"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "209d075476da2e63b4b29e72a2ef627b840589588e71400a25e3565c4f849d07"
|
||||
dependencies = [
|
||||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "minifier"
|
||||
version = "0.0.41"
|
||||
|
@ -11,7 +11,7 @@ use rustc_errors::registry::Registry;
|
||||
use rustc_errors::{ErrorReported, Handler};
|
||||
use rustc_lint::LintStore;
|
||||
use rustc_middle::ty;
|
||||
use rustc_parse::new_parser_from_source_str;
|
||||
use rustc_parse::maybe_new_parser_from_source_str;
|
||||
use rustc_query_impl::QueryCtxt;
|
||||
use rustc_session::config::{self, ErrorOutputType, Input, OutputFilenames};
|
||||
use rustc_session::early_error;
|
||||
@ -91,7 +91,6 @@ pub fn parse_cfgspecs(cfgspecs: Vec<String>) -> FxHashSet<(String, Option<String
|
||||
s
|
||||
)));
|
||||
let filename = FileName::cfg_spec_source_code(&s);
|
||||
let mut parser = new_parser_from_source_str(&sess, filename, s.to_string());
|
||||
|
||||
macro_rules! error {
|
||||
($reason: expr) => {
|
||||
@ -102,26 +101,27 @@ pub fn parse_cfgspecs(cfgspecs: Vec<String>) -> FxHashSet<(String, Option<String
|
||||
};
|
||||
}
|
||||
|
||||
match &mut parser.parse_meta_item() {
|
||||
Ok(meta_item) if parser.token == token::Eof => {
|
||||
if meta_item.path.segments.len() != 1 {
|
||||
error!("argument key must be an identifier");
|
||||
}
|
||||
match &meta_item.kind {
|
||||
MetaItemKind::List(..) => {
|
||||
error!(r#"expected `key` or `key="value"`"#);
|
||||
match maybe_new_parser_from_source_str(&sess, filename, s.to_string()) {
|
||||
Ok(mut parser) => match &mut parser.parse_meta_item() {
|
||||
Ok(meta_item) if parser.token == token::Eof => {
|
||||
if meta_item.path.segments.len() != 1 {
|
||||
error!("argument key must be an identifier");
|
||||
}
|
||||
MetaItemKind::NameValue(lit) if !lit.kind.is_str() => {
|
||||
error!("argument value must be a string");
|
||||
}
|
||||
MetaItemKind::NameValue(..) | MetaItemKind::Word => {
|
||||
let ident = meta_item.ident().expect("multi-segment cfg key");
|
||||
return (ident.name, meta_item.value_str());
|
||||
match &meta_item.kind {
|
||||
MetaItemKind::List(..) => {}
|
||||
MetaItemKind::NameValue(lit) if !lit.kind.is_str() => {
|
||||
error!("argument value must be a string");
|
||||
}
|
||||
MetaItemKind::NameValue(..) | MetaItemKind::Word => {
|
||||
let ident = meta_item.ident().expect("multi-segment cfg key");
|
||||
return (ident.name, meta_item.value_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(..) => {}
|
||||
Err(err) => err.cancel(),
|
||||
Ok(..) => {}
|
||||
Err(err) => err.cancel(),
|
||||
},
|
||||
Err(errs) => errs.into_iter().for_each(|mut err| err.cancel()),
|
||||
}
|
||||
|
||||
error!(r#"expected `key` or `key="value"`"#);
|
||||
|
@ -148,7 +148,7 @@ use self::spec_extend::SpecExtend;
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
mod spec_extend;
|
||||
|
||||
/// A contiguous growable array type, written as `Vec<T>` and pronounced 'vector'.
|
||||
/// A contiguous growable array type, written as `Vec<T>`, short for 'vector'.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
@ -349,6 +349,33 @@ impl<K, V, S> HashMap<K, V, S> {
|
||||
Keys { inner: self.iter() }
|
||||
}
|
||||
|
||||
/// Creates a consuming iterator visiting all the keys in arbitrary order.
|
||||
/// The map cannot be used after calling this.
|
||||
/// The iterator element type is `K`.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashMap;
|
||||
///
|
||||
/// let map = HashMap::from([
|
||||
/// ("a", 1),
|
||||
/// ("b", 2),
|
||||
/// ("c", 3),
|
||||
/// ]);
|
||||
///
|
||||
/// let mut vec: Vec<&str> = map.into_keys().collect();
|
||||
/// // The `IntoKeys` iterator produces keys in arbitrary order, so the
|
||||
/// // keys must be sorted to test them against a sorted array.
|
||||
/// vec.sort_unstable();
|
||||
/// assert_eq!(vec, ["a", "b", "c"]);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "map_into_keys_values", since = "1.54.0")]
|
||||
pub fn into_keys(self) -> IntoKeys<K, V> {
|
||||
IntoKeys { inner: self.into_iter() }
|
||||
}
|
||||
|
||||
/// An iterator visiting all values in arbitrary order.
|
||||
/// The iterator element type is `&'a V`.
|
||||
///
|
||||
@ -399,6 +426,33 @@ impl<K, V, S> HashMap<K, V, S> {
|
||||
ValuesMut { inner: self.iter_mut() }
|
||||
}
|
||||
|
||||
/// Creates a consuming iterator visiting all the values in arbitrary order.
|
||||
/// The map cannot be used after calling this.
|
||||
/// The iterator element type is `V`.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashMap;
|
||||
///
|
||||
/// let map = HashMap::from([
|
||||
/// ("a", 1),
|
||||
/// ("b", 2),
|
||||
/// ("c", 3),
|
||||
/// ]);
|
||||
///
|
||||
/// let mut vec: Vec<i32> = map.into_values().collect();
|
||||
/// // The `IntoValues` iterator produces values in arbitrary order, so
|
||||
/// // the values must be sorted to test them against a sorted array.
|
||||
/// vec.sort_unstable();
|
||||
/// assert_eq!(vec, [1, 2, 3]);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "map_into_keys_values", since = "1.54.0")]
|
||||
pub fn into_values(self) -> IntoValues<K, V> {
|
||||
IntoValues { inner: self.into_iter() }
|
||||
}
|
||||
|
||||
/// An iterator visiting all key-value pairs in arbitrary order.
|
||||
/// The iterator element type is `(&'a K, &'a V)`.
|
||||
///
|
||||
@ -555,6 +609,29 @@ impl<K, V, S> HashMap<K, V, S> {
|
||||
DrainFilter { base: self.base.drain_filter(pred) }
|
||||
}
|
||||
|
||||
/// Retains only the elements specified by the predicate.
|
||||
///
|
||||
/// In other words, remove all pairs `(k, v)` such that `f(&k, &mut v)` returns `false`.
|
||||
/// The elements are visited in unsorted (and unspecified) order.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashMap;
|
||||
///
|
||||
/// let mut map: HashMap<i32, i32> = (0..8).map(|x| (x, x*10)).collect();
|
||||
/// map.retain(|&k, _| k % 2 == 0);
|
||||
/// assert_eq!(map.len(), 4);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "retain_hash_collection", since = "1.18.0")]
|
||||
pub fn retain<F>(&mut self, f: F)
|
||||
where
|
||||
F: FnMut(&K, &mut V) -> bool,
|
||||
{
|
||||
self.base.retain(f)
|
||||
}
|
||||
|
||||
/// Clears the map, removing all key-value pairs. Keeps the allocated memory
|
||||
/// for reuse.
|
||||
///
|
||||
@ -937,83 +1014,6 @@ where
|
||||
{
|
||||
self.base.remove_entry(k)
|
||||
}
|
||||
|
||||
/// Retains only the elements specified by the predicate.
|
||||
///
|
||||
/// In other words, remove all pairs `(k, v)` such that `f(&k, &mut v)` returns `false`.
|
||||
/// The elements are visited in unsorted (and unspecified) order.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashMap;
|
||||
///
|
||||
/// let mut map: HashMap<i32, i32> = (0..8).map(|x| (x, x*10)).collect();
|
||||
/// map.retain(|&k, _| k % 2 == 0);
|
||||
/// assert_eq!(map.len(), 4);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "retain_hash_collection", since = "1.18.0")]
|
||||
pub fn retain<F>(&mut self, f: F)
|
||||
where
|
||||
F: FnMut(&K, &mut V) -> bool,
|
||||
{
|
||||
self.base.retain(f)
|
||||
}
|
||||
|
||||
/// Creates a consuming iterator visiting all the keys in arbitrary order.
|
||||
/// The map cannot be used after calling this.
|
||||
/// The iterator element type is `K`.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashMap;
|
||||
///
|
||||
/// let map = HashMap::from([
|
||||
/// ("a", 1),
|
||||
/// ("b", 2),
|
||||
/// ("c", 3),
|
||||
/// ]);
|
||||
///
|
||||
/// let mut vec: Vec<&str> = map.into_keys().collect();
|
||||
/// // The `IntoKeys` iterator produces keys in arbitrary order, so the
|
||||
/// // keys must be sorted to test them against a sorted array.
|
||||
/// vec.sort_unstable();
|
||||
/// assert_eq!(vec, ["a", "b", "c"]);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "map_into_keys_values", since = "1.54.0")]
|
||||
pub fn into_keys(self) -> IntoKeys<K, V> {
|
||||
IntoKeys { inner: self.into_iter() }
|
||||
}
|
||||
|
||||
/// Creates a consuming iterator visiting all the values in arbitrary order.
|
||||
/// The map cannot be used after calling this.
|
||||
/// The iterator element type is `V`.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashMap;
|
||||
///
|
||||
/// let map = HashMap::from([
|
||||
/// ("a", 1),
|
||||
/// ("b", 2),
|
||||
/// ("c", 3),
|
||||
/// ]);
|
||||
///
|
||||
/// let mut vec: Vec<i32> = map.into_values().collect();
|
||||
/// // The `IntoValues` iterator produces values in arbitrary order, so
|
||||
/// // the values must be sorted to test them against a sorted array.
|
||||
/// vec.sort_unstable();
|
||||
/// assert_eq!(vec, [1, 2, 3]);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "map_into_keys_values", since = "1.54.0")]
|
||||
pub fn into_values(self) -> IntoValues<K, V> {
|
||||
IntoValues { inner: self.into_iter() }
|
||||
}
|
||||
}
|
||||
|
||||
impl<K, V, S> HashMap<K, V, S>
|
||||
|
@ -290,6 +290,28 @@ impl<T, S> HashSet<T, S> {
|
||||
DrainFilter { base: self.base.drain_filter(pred) }
|
||||
}
|
||||
|
||||
/// Retains only the elements specified by the predicate.
|
||||
///
|
||||
/// In other words, remove all elements `e` such that `f(&e)` returns `false`.
|
||||
/// The elements are visited in unsorted (and unspecified) order.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashSet;
|
||||
///
|
||||
/// let mut set = HashSet::from([1, 2, 3, 4, 5, 6]);
|
||||
/// set.retain(|&k| k % 2 == 0);
|
||||
/// assert_eq!(set.len(), 3);
|
||||
/// ```
|
||||
#[stable(feature = "retain_hash_collection", since = "1.18.0")]
|
||||
pub fn retain<F>(&mut self, f: F)
|
||||
where
|
||||
F: FnMut(&T) -> bool,
|
||||
{
|
||||
self.base.retain(f)
|
||||
}
|
||||
|
||||
/// Clears the set, removing all values.
|
||||
///
|
||||
/// # Examples
|
||||
@ -906,28 +928,6 @@ where
|
||||
{
|
||||
self.base.take(value)
|
||||
}
|
||||
|
||||
/// Retains only the elements specified by the predicate.
|
||||
///
|
||||
/// In other words, remove all elements `e` such that `f(&e)` returns `false`.
|
||||
/// The elements are visited in unsorted (and unspecified) order.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashSet;
|
||||
///
|
||||
/// let mut set = HashSet::from([1, 2, 3, 4, 5, 6]);
|
||||
/// set.retain(|&k| k % 2 == 0);
|
||||
/// assert_eq!(set.len(), 3);
|
||||
/// ```
|
||||
#[stable(feature = "retain_hash_collection", since = "1.18.0")]
|
||||
pub fn retain<F>(&mut self, f: F)
|
||||
where
|
||||
F: FnMut(&T) -> bool,
|
||||
{
|
||||
self.base.retain(f)
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
|
@ -972,10 +972,13 @@ pub fn park_timeout(dur: Duration) {
|
||||
|
||||
/// A unique identifier for a running thread.
|
||||
///
|
||||
/// A `ThreadId` is an opaque object that has a unique value for each thread
|
||||
/// that creates one. `ThreadId`s are not guaranteed to correspond to a thread's
|
||||
/// system-designated identifier. A `ThreadId` can be retrieved from the [`id`]
|
||||
/// method on a [`Thread`].
|
||||
/// A `ThreadId` is an opaque object that uniquely identifies each thread
|
||||
/// created during the lifetime of a process. `ThreadId`s are guaranteed not to
|
||||
/// be reused, even when a thread terminates. `ThreadId`s are under the control
|
||||
/// of Rust's standard library and there may not be any relationship between
|
||||
/// `ThreadId` and the underlying platform's notion of a thread identifier --
|
||||
/// the two concepts cannot, therefore, be used interchangeably. A `ThreadId`
|
||||
/// can be retrieved from the [`id`] method on a [`Thread`].
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
@ -19,7 +19,6 @@ ignore = [
|
||||
"library/backtrace",
|
||||
"library/portable-simd",
|
||||
"library/stdarch",
|
||||
"compiler/rustc_codegen_cranelift",
|
||||
"compiler/rustc_codegen_gcc",
|
||||
"src/doc/book",
|
||||
"src/doc/edition-guide",
|
||||
@ -36,4 +35,9 @@ ignore = [
|
||||
"src/tools/rust-analyzer",
|
||||
"src/tools/rustfmt",
|
||||
"src/tools/rust-installer",
|
||||
|
||||
# these are ignored by a standard cargo fmt run
|
||||
"compiler/rustc_codegen_cranelift/y.rs", # running rustfmt breaks this file
|
||||
"compiler/rustc_codegen_cranelift/example",
|
||||
"compiler/rustc_codegen_cranelift/scripts",
|
||||
]
|
||||
|
@ -44,11 +44,9 @@ libc = "0.2"
|
||||
serde = { version = "1.0.8", features = ["derive"] }
|
||||
serde_json = "1.0.2"
|
||||
toml = "0.5"
|
||||
lazy_static = "1.3.0"
|
||||
time = "0.1"
|
||||
ignore = "0.4.10"
|
||||
opener = "0.5"
|
||||
merge = "0.1.0"
|
||||
once_cell = "1.7.2"
|
||||
|
||||
[target.'cfg(windows)'.dependencies.winapi]
|
||||
|
@ -15,6 +15,8 @@
|
||||
//! switching compilers for the bootstrap and for build scripts will probably
|
||||
//! never get replaced.
|
||||
|
||||
include!("../dylib_util.rs");
|
||||
|
||||
use std::env;
|
||||
use std::path::PathBuf;
|
||||
use std::process::{Child, Command};
|
||||
@ -50,11 +52,11 @@ fn main() {
|
||||
|
||||
let rustc = env::var_os(rustc).unwrap_or_else(|| panic!("{:?} was not set", rustc));
|
||||
let libdir = env::var_os(libdir).unwrap_or_else(|| panic!("{:?} was not set", libdir));
|
||||
let mut dylib_path = bootstrap::util::dylib_path();
|
||||
let mut dylib_path = dylib_path();
|
||||
dylib_path.insert(0, PathBuf::from(&libdir));
|
||||
|
||||
let mut cmd = Command::new(rustc);
|
||||
cmd.args(&args).env(bootstrap::util::dylib_path_var(), env::join_paths(&dylib_path).unwrap());
|
||||
cmd.args(&args).env(dylib_path_var(), env::join_paths(&dylib_path).unwrap());
|
||||
|
||||
// Get the name of the crate we're compiling, if any.
|
||||
let crate_name =
|
||||
@ -161,7 +163,7 @@ fn main() {
|
||||
eprintln!(
|
||||
"{} command: {:?}={:?} {:?}",
|
||||
prefix,
|
||||
bootstrap::util::dylib_path_var(),
|
||||
dylib_path_var(),
|
||||
env::join_paths(&dylib_path).unwrap(),
|
||||
cmd,
|
||||
);
|
||||
|
@ -7,6 +7,8 @@ use std::ffi::OsString;
|
||||
use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
|
||||
include!("../dylib_util.rs");
|
||||
|
||||
fn main() {
|
||||
let args = env::args_os().skip(1).collect::<Vec<_>>();
|
||||
let rustdoc = env::var_os("RUSTDOC_REAL").expect("RUSTDOC_REAL was not set");
|
||||
@ -20,14 +22,14 @@ fn main() {
|
||||
Err(_) => 0,
|
||||
};
|
||||
|
||||
let mut dylib_path = bootstrap::util::dylib_path();
|
||||
let mut dylib_path = dylib_path();
|
||||
dylib_path.insert(0, PathBuf::from(libdir.clone()));
|
||||
|
||||
let mut cmd = Command::new(rustdoc);
|
||||
cmd.args(&args)
|
||||
.arg("--sysroot")
|
||||
.arg(&sysroot)
|
||||
.env(bootstrap::util::dylib_path_var(), env::join_paths(&dylib_path).unwrap());
|
||||
.env(dylib_path_var(), env::join_paths(&dylib_path).unwrap());
|
||||
|
||||
// Force all crates compiled by this compiler to (a) be unstable and (b)
|
||||
// allow the `rustc_private` feature to link to other unstable crates
|
||||
@ -59,7 +61,7 @@ fn main() {
|
||||
if verbose > 1 {
|
||||
eprintln!(
|
||||
"rustdoc command: {:?}={:?} {:?}",
|
||||
bootstrap::util::dylib_path_var(),
|
||||
dylib_path_var(),
|
||||
env::join_paths(&dylib_path).unwrap(),
|
||||
cmd,
|
||||
);
|
||||
|
@ -351,7 +351,6 @@ pub enum Kind {
|
||||
Check,
|
||||
Clippy,
|
||||
Fix,
|
||||
Format,
|
||||
Test,
|
||||
Bench,
|
||||
Dist,
|
||||
@ -399,7 +398,7 @@ impl<'a> Builder<'a> {
|
||||
native::Lld,
|
||||
native::CrtBeginEnd
|
||||
),
|
||||
Kind::Check | Kind::Clippy { .. } | Kind::Fix | Kind::Format => describe!(
|
||||
Kind::Check | Kind::Clippy { .. } | Kind::Fix => describe!(
|
||||
check::Std,
|
||||
check::Rustc,
|
||||
check::Rustdoc,
|
||||
|
@ -13,7 +13,8 @@ use std::ops::Deref;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::Mutex;
|
||||
|
||||
use lazy_static::lazy_static;
|
||||
// FIXME: replace with std::lazy after it gets stabilized and reaches beta
|
||||
use once_cell::sync::Lazy;
|
||||
|
||||
use crate::builder::Step;
|
||||
|
||||
@ -222,9 +223,7 @@ impl Interner {
|
||||
}
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
pub static ref INTERNER: Interner = Interner::default();
|
||||
}
|
||||
pub static INTERNER: Lazy<Interner> = Lazy::new(Interner::default);
|
||||
|
||||
/// This is essentially a `HashMap` which allows storing any type in its input and
|
||||
/// any type in its output. It is a write-once cache; values are never evicted,
|
||||
|
@ -18,7 +18,6 @@ pub use crate::flags::Subcommand;
|
||||
use crate::flags::{Color, Flags};
|
||||
use crate::util::exe;
|
||||
use build_helper::t;
|
||||
use merge::Merge;
|
||||
use serde::Deserialize;
|
||||
|
||||
macro_rules! check_ci_llvm {
|
||||
@ -334,6 +333,10 @@ struct TomlConfig {
|
||||
profile: Option<String>,
|
||||
}
|
||||
|
||||
trait Merge {
|
||||
fn merge(&mut self, other: Self);
|
||||
}
|
||||
|
||||
impl Merge for TomlConfig {
|
||||
fn merge(
|
||||
&mut self,
|
||||
@ -357,105 +360,136 @@ impl Merge for TomlConfig {
|
||||
}
|
||||
}
|
||||
|
||||
/// TOML representation of various global build decisions.
|
||||
#[derive(Deserialize, Default, Clone, Merge)]
|
||||
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
|
||||
struct Build {
|
||||
build: Option<String>,
|
||||
host: Option<Vec<String>>,
|
||||
target: Option<Vec<String>>,
|
||||
// This is ignored, the rust code always gets the build directory from the `BUILD_DIR` env variable
|
||||
build_dir: Option<String>,
|
||||
cargo: Option<String>,
|
||||
rustc: Option<String>,
|
||||
rustfmt: Option<PathBuf>,
|
||||
docs: Option<bool>,
|
||||
compiler_docs: Option<bool>,
|
||||
docs_minification: Option<bool>,
|
||||
submodules: Option<bool>,
|
||||
fast_submodules: Option<bool>,
|
||||
gdb: Option<String>,
|
||||
nodejs: Option<String>,
|
||||
npm: Option<String>,
|
||||
python: Option<String>,
|
||||
locked_deps: Option<bool>,
|
||||
vendor: Option<bool>,
|
||||
full_bootstrap: Option<bool>,
|
||||
extended: Option<bool>,
|
||||
tools: Option<HashSet<String>>,
|
||||
verbose: Option<usize>,
|
||||
sanitizers: Option<bool>,
|
||||
profiler: Option<bool>,
|
||||
cargo_native_static: Option<bool>,
|
||||
low_priority: Option<bool>,
|
||||
configure_args: Option<Vec<String>>,
|
||||
local_rebuild: Option<bool>,
|
||||
print_step_timings: Option<bool>,
|
||||
print_step_rusage: Option<bool>,
|
||||
check_stage: Option<u32>,
|
||||
doc_stage: Option<u32>,
|
||||
build_stage: Option<u32>,
|
||||
test_stage: Option<u32>,
|
||||
install_stage: Option<u32>,
|
||||
dist_stage: Option<u32>,
|
||||
bench_stage: Option<u32>,
|
||||
patch_binaries_for_nix: Option<bool>,
|
||||
// We are using a decl macro instead of a derive proc macro here to reduce the compile time of
|
||||
// rustbuild.
|
||||
macro_rules! derive_merge {
|
||||
($(#[$attr:meta])* struct $name:ident {
|
||||
$($field:ident: $field_ty:ty,)*
|
||||
}) => {
|
||||
$(#[$attr])*
|
||||
struct $name {
|
||||
$($field: $field_ty,)*
|
||||
}
|
||||
|
||||
impl Merge for $name {
|
||||
fn merge(&mut self, other: Self) {
|
||||
$(
|
||||
if !self.$field.is_some() {
|
||||
self.$field = other.$field;
|
||||
}
|
||||
)*
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// TOML representation of various global install decisions.
|
||||
#[derive(Deserialize, Default, Clone, Merge)]
|
||||
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
|
||||
struct Install {
|
||||
prefix: Option<String>,
|
||||
sysconfdir: Option<String>,
|
||||
docdir: Option<String>,
|
||||
bindir: Option<String>,
|
||||
libdir: Option<String>,
|
||||
mandir: Option<String>,
|
||||
datadir: Option<String>,
|
||||
derive_merge! {
|
||||
/// TOML representation of various global build decisions.
|
||||
#[derive(Deserialize, Default, Clone)]
|
||||
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
|
||||
struct Build {
|
||||
build: Option<String>,
|
||||
host: Option<Vec<String>>,
|
||||
target: Option<Vec<String>>,
|
||||
// This is ignored, the rust code always gets the build directory from the `BUILD_DIR` env variable
|
||||
build_dir: Option<String>,
|
||||
cargo: Option<String>,
|
||||
rustc: Option<String>,
|
||||
rustfmt: Option<PathBuf>,
|
||||
docs: Option<bool>,
|
||||
compiler_docs: Option<bool>,
|
||||
docs_minification: Option<bool>,
|
||||
submodules: Option<bool>,
|
||||
fast_submodules: Option<bool>,
|
||||
gdb: Option<String>,
|
||||
nodejs: Option<String>,
|
||||
npm: Option<String>,
|
||||
python: Option<String>,
|
||||
locked_deps: Option<bool>,
|
||||
vendor: Option<bool>,
|
||||
full_bootstrap: Option<bool>,
|
||||
extended: Option<bool>,
|
||||
tools: Option<HashSet<String>>,
|
||||
verbose: Option<usize>,
|
||||
sanitizers: Option<bool>,
|
||||
profiler: Option<bool>,
|
||||
cargo_native_static: Option<bool>,
|
||||
low_priority: Option<bool>,
|
||||
configure_args: Option<Vec<String>>,
|
||||
local_rebuild: Option<bool>,
|
||||
print_step_timings: Option<bool>,
|
||||
print_step_rusage: Option<bool>,
|
||||
check_stage: Option<u32>,
|
||||
doc_stage: Option<u32>,
|
||||
build_stage: Option<u32>,
|
||||
test_stage: Option<u32>,
|
||||
install_stage: Option<u32>,
|
||||
dist_stage: Option<u32>,
|
||||
bench_stage: Option<u32>,
|
||||
patch_binaries_for_nix: Option<bool>,
|
||||
}
|
||||
}
|
||||
|
||||
/// TOML representation of how the LLVM build is configured.
|
||||
#[derive(Deserialize, Default, Merge)]
|
||||
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
|
||||
struct Llvm {
|
||||
skip_rebuild: Option<bool>,
|
||||
optimize: Option<bool>,
|
||||
thin_lto: Option<bool>,
|
||||
release_debuginfo: Option<bool>,
|
||||
assertions: Option<bool>,
|
||||
tests: Option<bool>,
|
||||
plugins: Option<bool>,
|
||||
ccache: Option<StringOrBool>,
|
||||
version_check: Option<bool>,
|
||||
static_libstdcpp: Option<bool>,
|
||||
ninja: Option<bool>,
|
||||
targets: Option<String>,
|
||||
experimental_targets: Option<String>,
|
||||
link_jobs: Option<u32>,
|
||||
link_shared: Option<bool>,
|
||||
version_suffix: Option<String>,
|
||||
clang_cl: Option<String>,
|
||||
cflags: Option<String>,
|
||||
cxxflags: Option<String>,
|
||||
ldflags: Option<String>,
|
||||
use_libcxx: Option<bool>,
|
||||
use_linker: Option<String>,
|
||||
allow_old_toolchain: Option<bool>,
|
||||
polly: Option<bool>,
|
||||
clang: Option<bool>,
|
||||
download_ci_llvm: Option<StringOrBool>,
|
||||
derive_merge! {
|
||||
/// TOML representation of various global install decisions.
|
||||
#[derive(Deserialize, Default, Clone)]
|
||||
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
|
||||
struct Install {
|
||||
prefix: Option<String>,
|
||||
sysconfdir: Option<String>,
|
||||
docdir: Option<String>,
|
||||
bindir: Option<String>,
|
||||
libdir: Option<String>,
|
||||
mandir: Option<String>,
|
||||
datadir: Option<String>,
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Default, Clone, Merge)]
|
||||
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
|
||||
struct Dist {
|
||||
sign_folder: Option<String>,
|
||||
gpg_password_file: Option<String>,
|
||||
upload_addr: Option<String>,
|
||||
src_tarball: Option<bool>,
|
||||
missing_tools: Option<bool>,
|
||||
compression_formats: Option<Vec<String>>,
|
||||
derive_merge! {
|
||||
/// TOML representation of how the LLVM build is configured.
|
||||
#[derive(Deserialize, Default)]
|
||||
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
|
||||
struct Llvm {
|
||||
skip_rebuild: Option<bool>,
|
||||
optimize: Option<bool>,
|
||||
thin_lto: Option<bool>,
|
||||
release_debuginfo: Option<bool>,
|
||||
assertions: Option<bool>,
|
||||
tests: Option<bool>,
|
||||
plugins: Option<bool>,
|
||||
ccache: Option<StringOrBool>,
|
||||
version_check: Option<bool>,
|
||||
static_libstdcpp: Option<bool>,
|
||||
ninja: Option<bool>,
|
||||
targets: Option<String>,
|
||||
experimental_targets: Option<String>,
|
||||
link_jobs: Option<u32>,
|
||||
link_shared: Option<bool>,
|
||||
version_suffix: Option<String>,
|
||||
clang_cl: Option<String>,
|
||||
cflags: Option<String>,
|
||||
cxxflags: Option<String>,
|
||||
ldflags: Option<String>,
|
||||
use_libcxx: Option<bool>,
|
||||
use_linker: Option<String>,
|
||||
allow_old_toolchain: Option<bool>,
|
||||
polly: Option<bool>,
|
||||
clang: Option<bool>,
|
||||
download_ci_llvm: Option<StringOrBool>,
|
||||
}
|
||||
}
|
||||
|
||||
derive_merge! {
|
||||
#[derive(Deserialize, Default, Clone)]
|
||||
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
|
||||
struct Dist {
|
||||
sign_folder: Option<String>,
|
||||
gpg_password_file: Option<String>,
|
||||
upload_addr: Option<String>,
|
||||
src_tarball: Option<bool>,
|
||||
missing_tools: Option<bool>,
|
||||
compression_formats: Option<Vec<String>>,
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
@ -471,80 +505,84 @@ impl Default for StringOrBool {
|
||||
}
|
||||
}
|
||||
|
||||
/// TOML representation of how the Rust build is configured.
|
||||
#[derive(Deserialize, Default, Merge)]
|
||||
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
|
||||
struct Rust {
|
||||
optimize: Option<bool>,
|
||||
debug: Option<bool>,
|
||||
codegen_units: Option<u32>,
|
||||
codegen_units_std: Option<u32>,
|
||||
debug_assertions: Option<bool>,
|
||||
debug_assertions_std: Option<bool>,
|
||||
overflow_checks: Option<bool>,
|
||||
overflow_checks_std: Option<bool>,
|
||||
debug_logging: Option<bool>,
|
||||
debuginfo_level: Option<u32>,
|
||||
debuginfo_level_rustc: Option<u32>,
|
||||
debuginfo_level_std: Option<u32>,
|
||||
debuginfo_level_tools: Option<u32>,
|
||||
debuginfo_level_tests: Option<u32>,
|
||||
run_dsymutil: Option<bool>,
|
||||
backtrace: Option<bool>,
|
||||
incremental: Option<bool>,
|
||||
parallel_compiler: Option<bool>,
|
||||
default_linker: Option<String>,
|
||||
channel: Option<String>,
|
||||
description: Option<String>,
|
||||
musl_root: Option<String>,
|
||||
rpath: Option<bool>,
|
||||
verbose_tests: Option<bool>,
|
||||
optimize_tests: Option<bool>,
|
||||
codegen_tests: Option<bool>,
|
||||
ignore_git: Option<bool>,
|
||||
dist_src: Option<bool>,
|
||||
save_toolstates: Option<String>,
|
||||
codegen_backends: Option<Vec<String>>,
|
||||
lld: Option<bool>,
|
||||
use_lld: Option<bool>,
|
||||
llvm_tools: Option<bool>,
|
||||
deny_warnings: Option<bool>,
|
||||
backtrace_on_ice: Option<bool>,
|
||||
verify_llvm_ir: Option<bool>,
|
||||
thin_lto_import_instr_limit: Option<u32>,
|
||||
remap_debuginfo: Option<bool>,
|
||||
jemalloc: Option<bool>,
|
||||
test_compare_mode: Option<bool>,
|
||||
llvm_libunwind: Option<String>,
|
||||
control_flow_guard: Option<bool>,
|
||||
new_symbol_mangling: Option<bool>,
|
||||
profile_generate: Option<String>,
|
||||
profile_use: Option<String>,
|
||||
// ignored; this is set from an env var set by bootstrap.py
|
||||
download_rustc: Option<StringOrBool>,
|
||||
derive_merge! {
|
||||
/// TOML representation of how the Rust build is configured.
|
||||
#[derive(Deserialize, Default)]
|
||||
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
|
||||
struct Rust {
|
||||
optimize: Option<bool>,
|
||||
debug: Option<bool>,
|
||||
codegen_units: Option<u32>,
|
||||
codegen_units_std: Option<u32>,
|
||||
debug_assertions: Option<bool>,
|
||||
debug_assertions_std: Option<bool>,
|
||||
overflow_checks: Option<bool>,
|
||||
overflow_checks_std: Option<bool>,
|
||||
debug_logging: Option<bool>,
|
||||
debuginfo_level: Option<u32>,
|
||||
debuginfo_level_rustc: Option<u32>,
|
||||
debuginfo_level_std: Option<u32>,
|
||||
debuginfo_level_tools: Option<u32>,
|
||||
debuginfo_level_tests: Option<u32>,
|
||||
run_dsymutil: Option<bool>,
|
||||
backtrace: Option<bool>,
|
||||
incremental: Option<bool>,
|
||||
parallel_compiler: Option<bool>,
|
||||
default_linker: Option<String>,
|
||||
channel: Option<String>,
|
||||
description: Option<String>,
|
||||
musl_root: Option<String>,
|
||||
rpath: Option<bool>,
|
||||
verbose_tests: Option<bool>,
|
||||
optimize_tests: Option<bool>,
|
||||
codegen_tests: Option<bool>,
|
||||
ignore_git: Option<bool>,
|
||||
dist_src: Option<bool>,
|
||||
save_toolstates: Option<String>,
|
||||
codegen_backends: Option<Vec<String>>,
|
||||
lld: Option<bool>,
|
||||
use_lld: Option<bool>,
|
||||
llvm_tools: Option<bool>,
|
||||
deny_warnings: Option<bool>,
|
||||
backtrace_on_ice: Option<bool>,
|
||||
verify_llvm_ir: Option<bool>,
|
||||
thin_lto_import_instr_limit: Option<u32>,
|
||||
remap_debuginfo: Option<bool>,
|
||||
jemalloc: Option<bool>,
|
||||
test_compare_mode: Option<bool>,
|
||||
llvm_libunwind: Option<String>,
|
||||
control_flow_guard: Option<bool>,
|
||||
new_symbol_mangling: Option<bool>,
|
||||
profile_generate: Option<String>,
|
||||
profile_use: Option<String>,
|
||||
// ignored; this is set from an env var set by bootstrap.py
|
||||
download_rustc: Option<StringOrBool>,
|
||||
}
|
||||
}
|
||||
|
||||
/// TOML representation of how each build target is configured.
|
||||
#[derive(Deserialize, Default, Merge)]
|
||||
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
|
||||
struct TomlTarget {
|
||||
cc: Option<String>,
|
||||
cxx: Option<String>,
|
||||
ar: Option<String>,
|
||||
ranlib: Option<String>,
|
||||
default_linker: Option<PathBuf>,
|
||||
linker: Option<String>,
|
||||
llvm_config: Option<String>,
|
||||
llvm_filecheck: Option<String>,
|
||||
android_ndk: Option<String>,
|
||||
sanitizers: Option<bool>,
|
||||
profiler: Option<bool>,
|
||||
crt_static: Option<bool>,
|
||||
musl_root: Option<String>,
|
||||
musl_libdir: Option<String>,
|
||||
wasi_root: Option<String>,
|
||||
qemu_rootfs: Option<String>,
|
||||
no_std: Option<bool>,
|
||||
derive_merge! {
|
||||
/// TOML representation of how each build target is configured.
|
||||
#[derive(Deserialize, Default)]
|
||||
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
|
||||
struct TomlTarget {
|
||||
cc: Option<String>,
|
||||
cxx: Option<String>,
|
||||
ar: Option<String>,
|
||||
ranlib: Option<String>,
|
||||
default_linker: Option<PathBuf>,
|
||||
linker: Option<String>,
|
||||
llvm_config: Option<String>,
|
||||
llvm_filecheck: Option<String>,
|
||||
android_ndk: Option<String>,
|
||||
sanitizers: Option<bool>,
|
||||
profiler: Option<bool>,
|
||||
crt_static: Option<bool>,
|
||||
musl_root: Option<String>,
|
||||
musl_libdir: Option<String>,
|
||||
wasi_root: Option<String>,
|
||||
qemu_rootfs: Option<String>,
|
||||
no_std: Option<bool>,
|
||||
}
|
||||
}
|
||||
|
||||
impl Config {
|
||||
@ -1111,10 +1149,6 @@ impl Config {
|
||||
self.verbose > 0
|
||||
}
|
||||
|
||||
pub fn very_verbose(&self) -> bool {
|
||||
self.verbose > 1
|
||||
}
|
||||
|
||||
pub fn sanitizers_enabled(&self, target: TargetSelection) -> bool {
|
||||
self.target_config.get(&target).map(|t| t.sanitizers).flatten().unwrap_or(self.sanitizers)
|
||||
}
|
||||
|
28
src/bootstrap/dylib_util.rs
Normal file
28
src/bootstrap/dylib_util.rs
Normal file
@ -0,0 +1,28 @@
|
||||
// Various utilities for working with dylib paths.
|
||||
//
|
||||
// This file is meant to be included directly to avoid a dependency on the bootstrap library from
|
||||
// the rustc and rustdoc wrappers. This improves compilation time by reducing the linking time.
|
||||
|
||||
/// Returns the environment variable which the dynamic library lookup path
|
||||
/// resides in for this platform.
|
||||
pub fn dylib_path_var() -> &'static str {
|
||||
if cfg!(target_os = "windows") {
|
||||
"PATH"
|
||||
} else if cfg!(target_os = "macos") {
|
||||
"DYLD_LIBRARY_PATH"
|
||||
} else if cfg!(target_os = "haiku") {
|
||||
"LIBRARY_PATH"
|
||||
} else {
|
||||
"LD_LIBRARY_PATH"
|
||||
}
|
||||
}
|
||||
|
||||
/// Parses the `dylib_path_var()` environment variable, returning a list of
|
||||
/// paths that are members of this lookup path.
|
||||
pub fn dylib_path() -> Vec<PathBuf> {
|
||||
let var = match env::var_os(dylib_path_var()) {
|
||||
Some(v) => v,
|
||||
None => return vec![],
|
||||
};
|
||||
env::split_paths(&var).collect()
|
||||
}
|
@ -110,7 +110,6 @@ use std::fs::{self, File, OpenOptions};
|
||||
use std::io::{Read, Seek, SeekFrom, Write};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::{self, Command};
|
||||
use std::slice;
|
||||
use std::str;
|
||||
|
||||
#[cfg(unix)]
|
||||
@ -472,10 +471,6 @@ impl Build {
|
||||
build
|
||||
}
|
||||
|
||||
pub fn build_triple(&self) -> &[Interned<String>] {
|
||||
slice::from_ref(&self.build.triple)
|
||||
}
|
||||
|
||||
// modified from `check_submodule` and `update_submodule` in bootstrap.py
|
||||
/// Given a path to the directory of a submodule, update it.
|
||||
///
|
||||
|
@ -16,11 +16,6 @@ use build_helper::t;
|
||||
use crate::builder::Builder;
|
||||
use crate::config::{Config, TargetSelection};
|
||||
|
||||
/// Returns the `name` as the filename of a static library for `target`.
|
||||
pub fn staticlib(name: &str, target: TargetSelection) -> String {
|
||||
if target.contains("windows") { format!("{}.lib", name) } else { format!("lib{}.a", name) }
|
||||
}
|
||||
|
||||
/// Given an executable called `name`, return the filename for the
|
||||
/// executable for a particular target.
|
||||
pub fn exe(name: &str, target: TargetSelection) -> String {
|
||||
@ -54,29 +49,7 @@ pub fn add_dylib_path(path: Vec<PathBuf>, cmd: &mut Command) {
|
||||
cmd.env(dylib_path_var(), t!(env::join_paths(list)));
|
||||
}
|
||||
|
||||
/// Returns the environment variable which the dynamic library lookup path
|
||||
/// resides in for this platform.
|
||||
pub fn dylib_path_var() -> &'static str {
|
||||
if cfg!(target_os = "windows") {
|
||||
"PATH"
|
||||
} else if cfg!(target_os = "macos") {
|
||||
"DYLD_LIBRARY_PATH"
|
||||
} else if cfg!(target_os = "haiku") {
|
||||
"LIBRARY_PATH"
|
||||
} else {
|
||||
"LD_LIBRARY_PATH"
|
||||
}
|
||||
}
|
||||
|
||||
/// Parses the `dylib_path_var()` environment variable, returning a list of
|
||||
/// paths that are members of this lookup path.
|
||||
pub fn dylib_path() -> Vec<PathBuf> {
|
||||
let var = match env::var_os(dylib_path_var()) {
|
||||
Some(v) => v,
|
||||
None => return vec![],
|
||||
};
|
||||
env::split_paths(&var).collect()
|
||||
}
|
||||
include!("dylib_util.rs");
|
||||
|
||||
/// Adds a list of lookup paths to `cmd`'s link library lookup path.
|
||||
pub fn add_link_lib_path(path: Vec<PathBuf>, cmd: &mut Command) {
|
||||
@ -103,21 +76,6 @@ fn link_lib_path() -> Vec<PathBuf> {
|
||||
env::split_paths(&var).collect()
|
||||
}
|
||||
|
||||
/// `push` all components to `buf`. On windows, append `.exe` to the last component.
|
||||
pub fn push_exe_path(mut buf: PathBuf, components: &[&str]) -> PathBuf {
|
||||
let (&file, components) = components.split_last().expect("at least one component required");
|
||||
let mut file = file.to_owned();
|
||||
|
||||
if cfg!(windows) {
|
||||
file.push_str(".exe");
|
||||
}
|
||||
|
||||
buf.extend(components);
|
||||
buf.push(file);
|
||||
|
||||
buf
|
||||
}
|
||||
|
||||
pub struct TimeIt(bool, Instant);
|
||||
|
||||
/// Returns an RAII structure that prints out how long it took to drop.
|
||||
|
15
src/test/rustdoc/where-clause-order.rs
Normal file
15
src/test/rustdoc/where-clause-order.rs
Normal file
@ -0,0 +1,15 @@
|
||||
#![crate_name = "foo"]
|
||||
|
||||
pub trait SomeTrait<Rhs = Self>
|
||||
where Rhs: ?Sized
|
||||
{}
|
||||
|
||||
// @has 'foo/trait.SomeTrait.html'
|
||||
// @has - "//div[@id='impl-SomeTrait%3C(A%2C%20B%2C%20C%2C%20D%2C%20E)%3E-for-(A%2C%20B%2C%20C%2C%20D%2C%20E)']/h3" "impl<A, B, C, D, E> SomeTrait<(A, B, C, D, E)> for (A, B, C, D, E) where A: PartialOrd<A> + PartialEq<A>, B: PartialOrd<B> + PartialEq<B>, C: PartialOrd<C> + PartialEq<C>, D: PartialOrd<D> + PartialEq<D>, E: PartialOrd<E> + PartialEq<E> + ?Sized, "
|
||||
impl<A, B, C, D, E> SomeTrait<(A, B, C, D, E)> for (A, B, C, D, E) where
|
||||
A: PartialOrd<A> + PartialEq<A>,
|
||||
B: PartialOrd<B> + PartialEq<B>,
|
||||
C: PartialOrd<C> + PartialEq<C>,
|
||||
D: PartialOrd<D> + PartialEq<D>,
|
||||
E: PartialOrd<E> + PartialEq<E> + ?Sized
|
||||
{}
|
3
src/test/ui/conditional-compilation/cfg-arg-invalid-8.rs
Normal file
3
src/test/ui/conditional-compilation/cfg-arg-invalid-8.rs
Normal file
@ -0,0 +1,3 @@
|
||||
// compile-flags: --cfg )
|
||||
// error-pattern: invalid `--cfg` argument: `)` (expected `key` or `key="value"`)
|
||||
fn main() {}
|
@ -0,0 +1,2 @@
|
||||
error: invalid `--cfg` argument: `)` (expected `key` or `key="value"`)
|
||||
|
Loading…
Reference in New Issue
Block a user