Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 15 pull requests #77001

Closed
wants to merge 39 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
b1375cd
Deny unsafe op in unsafe fns without the unsafe keyword, first part f…
poliorcetics Jul 10, 2020
3a22b21
Finished documenting all unsafe op inside unsafe fn
poliorcetics Jul 10, 2020
ee289d2
Improve some SAFETY comments following suggestions
poliorcetics Aug 29, 2020
4675a31
Use intra-doc links in core/src/iter when possible
poliorcetics Sep 18, 2020
bffd211
Finish moving to intra doc links for std::sync
poliorcetics Sep 18, 2020
982ec0d
Fix broken link
poliorcetics Sep 18, 2020
b534d9f
Fix broken link
poliorcetics Sep 18, 2020
0bc405e
Remove DeclareMethods
khyperia Sep 18, 2020
65edf54
Add a regression test for copy propagation miscompilation
tmiasko Sep 20, 2020
cebbd9f
Use as_nanos in bench.rs and base.rs
est31 Sep 20, 2020
43193dc
Use as_secs_f64 in profiling.rs
est31 Sep 20, 2020
4bc0e55
Replace write_fmt with write!
est31 Sep 20, 2020
b2c5f99
Add test for issue #34634
bugadani Sep 20, 2020
812ff66
Use const_cstr macro in consts.rs
est31 Sep 20, 2020
c2dad1c
Remove unused static_assert macro
est31 Sep 20, 2020
5ef1db3
Revert adding Atomic::from_mut.
m-ou-se Sep 20, 2020
0e56b52
Fix accordingly to review
poliorcetics Sep 20, 2020
08b85a6
use iter:: before free functions
poliorcetics Sep 20, 2020
8169989
Add non-`unsafe` `.get_mut()` for `UnsafeCell`
danielhenrymantilla Sep 19, 2020
5886c38
Replace unneeded `unsafe` calls to `.get()` with calls to `.get_mut()`
danielhenrymantilla Sep 19, 2020
aaddcdb
Fix nits
poliorcetics Sep 20, 2020
d99bb9d
liballoc bench use imported path Bencher
pickfire Sep 20, 2020
37ec045
BTreeMap: extra testing unveiling mistakes in future PR
ssomers Sep 19, 2020
c9c8fb8
Add sample defaults for config.toml
jyn514 Sep 12, 2020
be347bc
Rollup merge of #74225 - poliorcetics:std-thread-unsafe-op-in-unsafe-…
RalfJung Sep 21, 2020
eb0f3dd
Rollup merge of #76628 - jyn514:default-config-files, r=Mark-Simulacrum
RalfJung Sep 21, 2020
d93e2b6
Rollup merge of #76867 - poliorcetics:intra-doc-core-iter, r=jyn514
RalfJung Sep 21, 2020
a44e0b0
Rollup merge of #76868 - poliorcetics:intra-doc-std-sync, r=jyn514
RalfJung Sep 21, 2020
d79401c
Rollup merge of #76872 - khyperia:remove_declare_methods, r=eddyb
RalfJung Sep 21, 2020
1f8ee01
Rollup merge of #76936 - danielhenrymantilla:unsafecell_get_mut, r=Ra…
RalfJung Sep 21, 2020
fe325cc
Rollup merge of #76958 - est31:ns, r=oli-obk
RalfJung Sep 21, 2020
19c382a
Rollup merge of #76959 - est31:write, r=oli-obk
RalfJung Sep 21, 2020
18d1b1b
Rollup merge of #76961 - bugadani:test-34634, r=Mark-Simulacrum
RalfJung Sep 21, 2020
62a2e1f
Rollup merge of #76962 - est31:const_cstr, r=oli-obk
RalfJung Sep 21, 2020
7261beb
Rollup merge of #76963 - est31:remove_static_assert, r=oli-obk
RalfJung Sep 21, 2020
7d1cd3a
Rollup merge of #76967 - fusion-engineering-forks:revert-atomic-from-…
RalfJung Sep 21, 2020
ab68b8b
Rollup merge of #76977 - tmiasko:issue-76740, r=wesleywiser
RalfJung Sep 21, 2020
5f47246
Rollup merge of #76981 - pickfire:patch-5, r=Mark-Simulacrum
RalfJung Sep 21, 2020
6ef1377
Rollup merge of #76983 - ssomers:btree_extra_test, r=Mark-Simulacrum
RalfJung Sep 21, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ dependencies = [
"ignore",
"lazy_static",
"libc",
"merge",
"num_cpus",
"opener",
"pretty_assertions",
Expand Down Expand Up @@ -1909,6 +1910,28 @@ 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.33"
Expand Down
10 changes: 10 additions & 0 deletions config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@
# a custom configuration file can also be specified with `--config` to the build
# system.

# =============================================================================
# Global Settings
# =============================================================================

# Use different pre-set defaults than the global defaults.
#
# See `src/bootstrap/defaults` for more information.
# Note that this has no default value (x.py uses the defaults in `config.toml.example`).
#profile = <none>

# =============================================================================
# Tweaking how LLVM is compiled
# =============================================================================
Expand Down
1 change: 1 addition & 0 deletions src/bootstrap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ lazy_static = "1.3.0"
time = "0.1"
ignore = "0.4.10"
opener = "0.4"
merge = "0.1.0"

[target.'cfg(windows)'.dependencies.winapi]
version = "0.3"
Expand Down
76 changes: 51 additions & 25 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use crate::flags::Flags;
pub use crate::flags::Subcommand;
use crate::util::exe;
use build_helper::t;
use merge::Merge;
use serde::Deserialize;

macro_rules! check_ci_llvm {
Expand Down Expand Up @@ -278,10 +279,31 @@ struct TomlConfig {
rust: Option<Rust>,
target: Option<HashMap<String, TomlTarget>>,
dist: Option<Dist>,
profile: Option<String>,
}

impl Merge for TomlConfig {
fn merge(&mut self, TomlConfig { build, install, llvm, rust, dist, target, profile: _ }: Self) {
fn do_merge<T: Merge>(x: &mut Option<T>, y: Option<T>) {
if let Some(new) = y {
if let Some(original) = x {
original.merge(new);
} else {
*x = Some(new);
}
}
};
do_merge(&mut self.build, build);
do_merge(&mut self.install, install);
do_merge(&mut self.llvm, llvm);
do_merge(&mut self.rust, rust);
do_merge(&mut self.dist, dist);
assert!(target.is_none(), "merging target-specific config is not currently supported");
}
}

/// TOML representation of various global build decisions.
#[derive(Deserialize, Default, Clone)]
#[derive(Deserialize, Default, Clone, Merge)]
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
struct Build {
build: Option<String>,
Expand Down Expand Up @@ -321,7 +343,7 @@ struct Build {
}

/// TOML representation of various global install decisions.
#[derive(Deserialize, Default, Clone)]
#[derive(Deserialize, Default, Clone, Merge)]
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
struct Install {
prefix: Option<String>,
Expand All @@ -338,7 +360,7 @@ struct Install {
}

/// TOML representation of how the LLVM build is configured.
#[derive(Deserialize, Default)]
#[derive(Deserialize, Default, Merge)]
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
struct Llvm {
skip_rebuild: Option<bool>,
Expand All @@ -365,7 +387,7 @@ struct Llvm {
download_ci_llvm: Option<bool>,
}

#[derive(Deserialize, Default, Clone)]
#[derive(Deserialize, Default, Clone, Merge)]
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
struct Dist {
sign_folder: Option<String>,
Expand All @@ -389,7 +411,7 @@ impl Default for StringOrBool {
}

/// TOML representation of how the Rust build is configured.
#[derive(Deserialize, Default)]
#[derive(Deserialize, Default, Merge)]
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
struct Rust {
optimize: Option<bool>,
Expand Down Expand Up @@ -434,7 +456,7 @@ struct Rust {
}

/// TOML representation of how each build target is configured.
#[derive(Deserialize, Default)]
#[derive(Deserialize, Default, Merge)]
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
struct TomlTarget {
cc: Option<String>,
Expand Down Expand Up @@ -524,27 +546,31 @@ impl Config {
}

#[cfg(test)]
let toml = TomlConfig::default();
let get_toml = |_| TomlConfig::default();
#[cfg(not(test))]
let toml = flags
.config
.map(|file| {
use std::process;

let contents = t!(fs::read_to_string(&file));
match toml::from_str(&contents) {
Ok(table) => table,
Err(err) => {
println!(
"failed to parse TOML configuration '{}': {}",
file.display(),
err
);
process::exit(2);
}
let get_toml = |file: PathBuf| {
use std::process;

let contents = t!(fs::read_to_string(&file), "configuration file did not exist");
match toml::from_str(&contents) {
Ok(table) => table,
Err(err) => {
println!("failed to parse TOML configuration '{}': {}", file.display(), err);
process::exit(2);
}
})
.unwrap_or_else(TomlConfig::default);
}
};

let mut toml = flags.config.map(get_toml).unwrap_or_else(TomlConfig::default);
if let Some(include) = &toml.profile {
let mut include_path = config.src.clone();
include_path.push("src");
include_path.push("bootstrap");
include_path.push("defaults");
include_path.push(format!("config.toml.{}", include));
let included_toml = get_toml(include_path);
toml.merge(included_toml);
}

let build = toml.build.unwrap_or_default();

Expand Down
11 changes: 11 additions & 0 deletions src/bootstrap/defaults/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# About bootstrap defaults

These defaults are intended to be a good starting point for working with x.py,
with the understanding that no one set of defaults make sense for everyone.

They are still experimental, and we'd appreciate your help improving them!
If you use a setting that's not in these defaults that you think others would benefit from, please [file an issue] or make a PR with the changes.
Similarly, if one of these defaults doesn't match what you use personally,
please open an issue to get it changed.

[file an issue]: https://github.com/rust-lang/rust/issues/new/choose
13 changes: 13 additions & 0 deletions src/bootstrap/defaults/config.toml.codegen
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# These defaults are meant for contributors to the compiler who modify codegen or LLVM
[llvm]
# This enables debug-assertions in LLVM,
# catching logic errors in codegen much earlier in the process.
assertions = true

[rust]
# This enables `RUSTC_LOG=debug`, avoiding confusing situations
# where adding `debug!()` appears to do nothing.
# However, it makes running the compiler slightly slower.
debug-logging = true
# This greatly increases the speed of rebuilds, especially when there are only minor changes. However, it makes the initial build slightly slower.
incremental = true
8 changes: 8 additions & 0 deletions src/bootstrap/defaults/config.toml.compiler
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# These defaults are meant for contributors to the compiler who do not modify codegen or LLVM
[rust]
# This enables `RUSTC_LOG=debug`, avoiding confusing situations
# where adding `debug!()` appears to do nothing.
# However, it makes running the compiler slightly slower.
debug-logging = true
# This greatly increases the speed of rebuilds, especially when there are only minor changes. However, it makes the initial build slightly slower.
incremental = true
10 changes: 10 additions & 0 deletions src/bootstrap/defaults/config.toml.library
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# These defaults are meant for contributors to the standard library and documentation.
[build]
# When building the standard library, you almost never want to build the compiler itself.
build-stage = 0
test-stage = 0
bench-stage = 0

[rust]
# This greatly increases the speed of rebuilds, especially when there are only minor changes. However, it makes the initial build slightly slower.
incremental = true
9 changes: 9 additions & 0 deletions src/bootstrap/defaults/config.toml.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# These defaults are meant for users and distro maintainers building from source, without intending to make multiple changes.
[build]
# When compiling from source, you almost always want a full stage 2 build,
# which has all the latest optimizations from nightly.
build-stage = 2
test-stage = 2
doc-stage = 2
# When compiling from source, you usually want all tools.
extended = true