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 11 pull requests #78956

Merged
merged 25 commits into from
Nov 12, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
25 commits
Select commit Hold shift click to select a range
d72d5f4
Dogfood Duration API in std::time tests
workingjubilee Oct 22, 2020
ef027a1
Duration::zero() -> Duration::ZERO
workingjubilee Oct 22, 2020
b989d46
Support enable/disable sanitizers/profiler per target
12101111 Oct 25, 2020
af4d178
Fixup tests: Duration::MIN -> ::ZERO
workingjubilee Oct 27, 2020
82f3a23
Remove Duration::MIN entirely
workingjubilee Oct 27, 2020
439171e
look at assoc ct, check the type of nodes
lcnr Nov 7, 2020
685fd53
BTreeMap: split off most code of append, slightly improve interfaces
ssomers Oct 26, 2020
ffa70d7
Support inlining diverging function calls
tmiasko Nov 9, 2020
c8943c6
Add flags customizing behaviour of MIR inlining
tmiasko Nov 10, 2020
03eec5c
Cleanup and comment intra-doc link pass
jyn514 Nov 10, 2020
ce91c68
rustc_taret: Remove `TargetOptions::is_like_android`
petrochenkov Nov 10, 2020
ca17a91
rustc_target: Move target env "gnu" from `linux_base` to `linux_gnu_b…
petrochenkov Nov 10, 2020
1854425
Fix typo in comment
eltociear Nov 11, 2020
2453ce7
Ship llvm-cov through llvm-tools
dalance Nov 11, 2020
62f0a78
Rollup merge of #78216 - workingjubilee:duration-zero, r=m-ou-se
jonas-schievink Nov 11, 2020
194b968
Rollup merge of #78354 - 12101111:rustbuild_profiler, r=Mark-Simulacrum
jonas-schievink Nov 11, 2020
56e0806
Rollup merge of #78417 - ssomers:btree_chop_up_2, r=Mark-Simulacrum
jonas-schievink Nov 11, 2020
2e0a0b4
Rollup merge of #78832 - lcnr:const-evaluatable-unevaluated, r=oli-obk
jonas-schievink Nov 11, 2020
919177f
Rollup merge of #78873 - tmiasko:inline-opts, r=oli-obk
jonas-schievink Nov 11, 2020
0b521e5
Rollup merge of #78899 - tmiasko:inline-diverging, r=oli-obk
jonas-schievink Nov 11, 2020
a8a0c65
Rollup merge of #78923 - jyn514:intra-doc-comments, r=Manishearth
jonas-schievink Nov 11, 2020
5ac0ae4
Rollup merge of #78929 - petrochenkov:linuxbase, r=joshtriplett
jonas-schievink Nov 11, 2020
904b658
Rollup merge of #78930 - petrochenkov:notlikeandroid, r=Mark-Simulacrum
jonas-schievink Nov 11, 2020
f311458
Rollup merge of #78942 - eltociear:patch-1, r=jonas-schievink
jonas-schievink Nov 11, 2020
61c0a2c
Rollup merge of #78947 - dalance:llvm_cov, r=Mark-Simulacrum
jonas-schievink Nov 11, 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
9 changes: 9 additions & 0 deletions config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 586,15 @@ changelog-seen = 2
# build native code.
#android-ndk = "/path/to/ndk"

# Build the sanitizer runtimes for this target.
# This option will override the same option under [build] section.
#sanitizers = false

# Build the profiler runtime for this target(required when compiling with options that depend
# on this runtime, such as `-C profile-generate` or `-Z instrument-coverage`).
# This option will override the same option under [build] section.
#profiler = false

# Force static or dynamic linkage of the standard library for this target. If
# this target is a host for rustc, this will also affect the linkage of the
# compiler itself. This is useful for building rustc on targets that normally
Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 264,7 @@ impl<'a> ShouldRun<'a> {
/// `all_krates` should probably be removed at some point.
pub fn all_krates(mut self, name: &str) -> Self {
let mut set = BTreeSet::new();
for krate in self.builder.in_tree_crates(name) {
for krate in self.builder.in_tree_crates(name, None) {
let path = krate.local_path(self.builder);
set.insert(path);
}
Expand All @@ -277,7 277,7 @@ impl<'a> ShouldRun<'a> {
///
/// `make_run` will be called separately for each matching command-line path.
pub fn krate(mut self, name: &str) -> Self {
for krate in self.builder.in_tree_crates(name) {
for krate in self.builder.in_tree_crates(name, None) {
let path = krate.local_path(self.builder);
self.paths.insert(PathSet::one(path));
}
Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 108,7 @@ impl Step for Std {
// Explicitly pass -p for all dependencies krates -- this will force cargo
// to also check the tests/benches/examples for these crates, rather
// than just the leaf crate.
for krate in builder.in_tree_crates("test") {
for krate in builder.in_tree_crates("test", Some(target)) {
cargo.arg("-p").arg(krate.name);
}

Expand Down Expand Up @@ -172,7 172,7 @@ impl Step for Rustc {
// Explicitly pass -p for all compiler krates -- this will force cargo
// to also check the tests/benches/examples for these crates, rather
// than just the leaf crate.
for krate in builder.in_tree_crates("rustc-main") {
for krate in builder.in_tree_crates("rustc-main", Some(target)) {
cargo.arg("-p").arg(krate.name);
}

Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 143,7 @@ fn copy_third_party_objects(
}
}

if builder.config.sanitizers && compiler.stage != 0 {
if builder.config.sanitizers_enabled(target) && compiler.stage != 0 {
// The sanitizers are only copied in stage1 or above,
// to avoid creating dependency on LLVM.
target_deps.extend(
Expand Down Expand Up @@ -251,7 251,7 @@ pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, stage: u32, car
.arg("--features")
.arg(features);
} else {
let mut features = builder.std_features();
let mut features = builder.std_features(target);
features.push_str(compiler_builtins_c_feature);

cargo
Expand Down
22 changes: 22 additions & 0 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 279,8 @@ pub struct Target {
pub ranlib: Option<PathBuf>,
pub linker: Option<PathBuf>,
pub ndk: Option<PathBuf>,
pub sanitizers: bool,
pub profiler: bool,
pub crt_static: Option<bool>,
pub musl_root: Option<PathBuf>,
pub musl_libdir: Option<PathBuf>,
Expand Down Expand Up @@ -503,6 505,8 @@ struct TomlTarget {
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>,
Expand Down Expand Up @@ -890,6 894,8 @@ impl Config {
target.musl_libdir = cfg.musl_libdir.map(PathBuf::from);
target.wasi_root = cfg.wasi_root.map(PathBuf::from);
target.qemu_rootfs = cfg.qemu_rootfs.map(PathBuf::from);
target.sanitizers = cfg.sanitizers.unwrap_or(build.sanitizers.unwrap_or_default());
target.profiler = cfg.profiler.unwrap_or(build.profiler.unwrap_or_default());

config.target_config.insert(TargetSelection::from_user(&triple), target);
}
Expand Down Expand Up @@ -999,6 1005,22 @@ impl Config {
self.verbose > 1
}

pub fn sanitizers_enabled(&self, target: TargetSelection) -> bool {
self.target_config.get(&target).map(|t| t.sanitizers).unwrap_or(self.sanitizers)
}

pub fn any_sanitizers_enabled(&self) -> bool {
self.target_config.values().any(|t| t.sanitizers) || self.sanitizers
}

pub fn profiler_enabled(&self, target: TargetSelection) -> bool {
self.target_config.get(&target).map(|t| t.profiler).unwrap_or(self.profiler)
}

pub fn any_profiler_enabled(&self) -> bool {
self.target_config.values().any(|t| t.profiler) || self.profiler
}

pub fn llvm_enabled(&self) -> bool {
self.rust_codegen_backends.contains(&INTERNER.intern_str("llvm"))
}
Expand Down
8 changes: 6 additions & 2 deletions src/bootstrap/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -535,8 535,12 @@ impl Step for Rustc {
// Find dependencies for top level crates.
let mut compiler_crates = HashSet::new();
for root_crate in &["rustc_driver", "rustc_codegen_llvm", "rustc_codegen_ssa"] {
compiler_crates
.extend(builder.in_tree_crates(root_crate).into_iter().map(|krate| krate.name));
compiler_crates.extend(
builder
.in_tree_crates(root_crate, Some(target))
.into_iter()
.map(|krate| krate.name),
);
}

for krate in &compiler_crates {
Expand Down
11 changes: 7 additions & 4 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 541,7 @@ impl Build {

/// Gets the space-separated set of activated features for the standard
/// library.
fn std_features(&self) -> String {
fn std_features(&self, target: TargetSelection) -> String {
let mut features = "panic-unwind".to_string();

match self.config.llvm_libunwind.unwrap_or_default() {
Expand All @@ -552,7 552,7 @@ impl Build {
if self.config.backtrace {
features.push_str(" backtrace");
}
if self.config.profiler {
if self.config.profiler_enabled(target) {
features.push_str(" profiler");
}
features
Expand Down Expand Up @@ -1115,7 1115,7 @@ impl Build {
/// Returns a Vec of all the dependencies of the given root crate,
/// including transitive dependencies and the root itself. Only includes
/// "local" crates (those in the local source tree, not from a registry).
fn in_tree_crates(&self, root: &str) -> Vec<&Crate> {
fn in_tree_crates(&self, root: &str, target: Option<TargetSelection>) -> Vec<&Crate> {
let mut ret = Vec::new();
let mut list = vec![INTERNER.intern_str(root)];
let mut visited = HashSet::new();
Expand All @@ -1136,7 1136,10 @@ impl Build {
// metadata::build.
if visited.insert(dep)
&& dep != "build_helper"
&& (dep != "profiler_builtins" || self.config.profiler)
&& (dep != "profiler_builtins"
|| target
.map(|t| self.config.profiler_enabled(t))
.unwrap_or(self.config.any_profiler_enabled()))
&& (dep != "rustc_codegen_llvm" || self.config.llvm_enabled())
{
list.push(*dep);
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/sanity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 91,7 @@ pub fn check(build: &mut Build) {
.unwrap_or(true)
})
.any(|build_llvm_ourselves| build_llvm_ourselves);
if building_llvm || build.config.sanitizers {
if building_llvm || build.config.any_sanitizers_enabled() {
cmd_finder.must_have("cmake");
}

Expand Down
8 changes: 4 additions & 4 deletions src/bootstrap/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1271,11 1271,11 @@ note: if you're sure you want to do this, please open an issue as to why. In the
cmd.env("RUSTC_BOOTSTRAP", "1");
builder.add_rust_test_threads(&mut cmd);

if builder.config.sanitizers {
if builder.config.sanitizers_enabled(target) {
cmd.env("RUSTC_SANITIZER_SUPPORT", "1");
}

if builder.config.profiler {
if builder.config.profiler_enabled(target) {
cmd.env("RUSTC_PROFILER_SUPPORT", "1");
}

Expand Down Expand Up @@ -1591,7 1591,7 @@ impl Step for CrateLibrustc {
let builder = run.builder;
let compiler = builder.compiler(builder.top_stage, run.build_triple());

for krate in builder.in_tree_crates("rustc-main") {
for krate in builder.in_tree_crates("rustc-main", Some(run.target)) {
if krate.path.ends_with(&run.path) {
let test_kind = builder.kind.into();

Expand Down Expand Up @@ -1698,7 1698,7 @@ impl Step for Crate {
});
};

for krate in builder.in_tree_crates("test") {
for krate in builder.in_tree_crates("test", Some(run.target)) {
if krate.path.ends_with(&run.path) {
make(Mode::Std, krate);
}
Expand Down