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 18 pull requests #74461

Merged
merged 57 commits into from
Jul 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
e7d9944
Add feature const_option
a1phyr Jul 1, 2020
efe634f
Add `reachable` and friends to `mir::traversal` module
ecstatic-morse Jul 8, 2020
698e870
Stop adding unreachable basic blocks to dataflow work queue
ecstatic-morse Jul 8, 2020
6b9b2d9
Fix src/test/run-make/static-pie/test-aslr.rs
haraldh Jul 13, 2020
5269459
add lazy normalization regression tests
lcnr Jul 15, 2020
aabca44
Enforce even more the code blocks attributes check through rustdoc
GuillaumeGomez Apr 29, 2020
d70e6e1
Apply review comments
GuillaumeGomez Jul 13, 2020
3dc8544
Update code to new invalid_codeblock_attributes lint name
GuillaumeGomez Jul 13, 2020
4497b9a
Remove leftover from emscripten fastcomp support
bjorn3 Jul 16, 2020
5f6c079
Set "invalid_codeblock_attributes" lint to warning level by default
GuillaumeGomez Jul 16, 2020
209991f
Don't assign `()` to `!` MIR locals
jonas-schievink Jul 16, 2020
50f3dbd
Move hir::Place to librustc_middle/hir
arora-aman Jul 6, 2020
2ff13d9
Use an UTF-8 locale for the linker.
meithecatte Jul 16, 2020
08b4b54
docs: better demonstrate that None values are skipped as many times a…
tshepang Jul 17, 2020
6969b30
Convert whitespaces to tabs
GuillaumeGomez Jul 15, 2020
3429ded
Add tidy checks for rustdoc css files
GuillaumeGomez Jul 15, 2020
83ffd5c
Fix tidy issues
GuillaumeGomez Jul 15, 2020
91738d8
Use intra-doc link on Iterator page
tesuji Jul 13, 2020
53a1d6f
Intra doc for iter marker traits
tesuji Jul 13, 2020
69f43dd
Intra-doc for DoubleEndIterator
tesuji Jul 13, 2020
a7f067a
Intra-doc for iter Sum and Product traits
tesuji Jul 13, 2020
3fb3c0c
Remove unneeded link for Option
tesuji Jul 13, 2020
1a90ba7
Link Some(item)
tesuji Jul 14, 2020
67c1e89
Remove code span for impl
tesuji Jul 14, 2020
8aeecc6
Fix Arc::as_ptr docs
Abendstolz Jul 17, 2020
5ffdd7c
Deny intra_doc_link_resolution_failure in libcore
tesuji Jul 17, 2020
e73a23f
Add Arguments::as_str().
m-ou-se Jul 4, 2020
bc4e33e
Add #[inline] to Arguments::as_str().
m-ou-se Jul 5, 2020
e17c17a
Make Arguments::as_str() work for empty format strings.
m-ou-se Jul 5, 2020
e2b337d
Teach bootstrap about target files vs target triples
shepmaster Jul 17, 2020
87b4976
warn about uninit multi-variant enums
RalfJung Jul 17, 2020
0c51f53
Make fmt::Arguments::as_str() return a 'static str.
m-ou-se Jul 16, 2020
9c3353b
Add tracking issue number for fmt_as_str.
m-ou-se Jul 17, 2020
48fe5fc
Create implib for dlls when testing MinGW targets
mati865 Jun 13, 2020
2a9b51d
Allow matching test by target and env
mati865 Jul 3, 2020
933a06d
Remove invalid test
mati865 Jul 3, 2020
fe98de2
intra-doc links: Resolve modules in type namespace
Manishearth Jul 17, 2020
af1d01e
Fix various tests to run on windows-gnu
mati865 Jul 3, 2020
69dab50
Add test for module ambiguity
Manishearth Jul 17, 2020
3006ea3
Rollup merge of #71670 - GuillaumeGomez:enforce-codeblocks-attribute-…
Manishearth Jul 17, 2020
f6cd31c
Rollup merge of #73930 - a1phyr:feature_const_option, r=dtolnay
Manishearth Jul 17, 2020
be3b972
Rollup merge of #74009 - mati865:mingw-tests-implib, r=nikomatsakis
Manishearth Jul 17, 2020
9c84c6b
Rollup merge of #74056 - fusion-engineering-forks:fmt-arguments-as-st…
Manishearth Jul 17, 2020
10b7eec
Rollup merge of #74169 - ecstatic-morse:dataflow-unreachable, r=pnkfelix
Manishearth Jul 17, 2020
7d4e6c0
Rollup merge of #74251 - shepmaster:bootstrap-target-files, r=Mark-Si…
Manishearth Jul 17, 2020
6b2ccc7
Rollup merge of #74288 - haraldh:test_aslr, r=petrochenkov
Manishearth Jul 17, 2020
c9010d6
Rollup merge of #74300 - lzutao:iterator-intra, r=jyn514
Manishearth Jul 17, 2020
344b5e0
Rollup merge of #74364 - lcnr:lazy-norm-tests, r=nikomatsakis
Manishearth Jul 17, 2020
ef0540b
Rollup merge of #74368 - GuillaumeGomez:css-tidy-check, r=Mark-Simula…
Manishearth Jul 17, 2020
105cd4b
Rollup merge of #74394 - bjorn3:remove_emscripten_leftover, r=spastorino
Manishearth Jul 17, 2020
87d01d1
Rollup merge of #74411 - jonas-schievink:unbreak-mir, r=matthewjasper
Manishearth Jul 17, 2020
eef22da
Rollup merge of #74416 - NieDzejkob:linker-locale-utf8, r=oli-obk
Manishearth Jul 17, 2020
222d250
Rollup merge of #74424 - sexxi-goose:move_hir_place, r=nikomatsakis
Manishearth Jul 17, 2020
3b7e286
Rollup merge of #74428 - tshepang:better-filter-map-doc, r=jonas-schi…
Manishearth Jul 17, 2020
cdedae8
Rollup merge of #74438 - RalfJung:uninit-lint, r=davidtwco
Manishearth Jul 17, 2020
ff1c53f
Rollup merge of #74440 - Abendstolz:patch-1, r=hanna-kruppe
Manishearth Jul 17, 2020
c587386
Rollup merge of #74452 - Manishearth:module-type-ns, r=jyn514
Manishearth Jul 17, 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
72 changes: 39 additions & 33 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use build_helper::{output, t};
use crate::cache::{Cache, Interned, INTERNER};
use crate::check;
use crate::compile;
use crate::config::TargetSelection;
use crate::dist;
use crate::doc;
use crate::flags::Subcommand;
Expand Down Expand Up @@ -86,8 +87,8 @@ pub trait Step: 'static + Clone + Debug + PartialEq + Eq + Hash {

pub struct RunConfig<'a> {
pub builder: &'a Builder<'a>,
pub host: Interned<String>,
pub target: Interned<String>,
pub host: TargetSelection,
pub target: TargetSelection,
pub path: PathBuf,
}

Expand Down Expand Up @@ -576,7 +577,7 @@ impl<'a> Builder<'a> {
/// not take `Compiler` since all `Compiler` instances are meant to be
/// obtained through this function, since it ensures that they are valid
/// (i.e., built and assembled).
pub fn compiler(&self, stage: u32, host: Interned<String>) -> Compiler {
pub fn compiler(&self, stage: u32, host: TargetSelection) -> Compiler {
self.ensure(compile::Assemble { target_compiler: Compiler { stage, host } })
}

Expand All @@ -594,8 +595,8 @@ impl<'a> Builder<'a> {
pub fn compiler_for(
&self,
stage: u32,
host: Interned<String>,
target: Interned<String>,
host: TargetSelection,
target: TargetSelection,
) -> Compiler {
if self.build.force_use_stage1(Compiler { stage, host }, target) {
self.compiler(1, self.config.build)
Expand All @@ -610,15 +611,11 @@ impl<'a> Builder<'a> {

/// Returns the libdir where the standard library and other artifacts are
/// found for a compiler's sysroot.
pub fn sysroot_libdir(
&self,
compiler: Compiler,
target: Interned<String>,
) -> Interned<PathBuf> {
pub fn sysroot_libdir(&self, compiler: Compiler, target: TargetSelection) -> Interned<PathBuf> {
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
struct Libdir {
compiler: Compiler,
target: Interned<String>,
target: TargetSelection,
}
impl Step for Libdir {
type Output = Interned<PathBuf>;
Expand All @@ -633,7 +630,7 @@ impl<'a> Builder<'a> {
.sysroot(self.compiler)
.join(lib)
.join("rustlib")
.join(self.target)
.join(self.target.triple)
.join("lib");
let _ = fs::remove_dir_all(&sysroot);
t!(fs::create_dir_all(&sysroot));
Expand All @@ -656,7 +653,7 @@ impl<'a> Builder<'a> {
Some(relative_libdir) if compiler.stage >= 1 => {
self.sysroot(compiler).join(relative_libdir)
}
_ => self.sysroot(compiler).join(libdir(&compiler.host)),
_ => self.sysroot(compiler).join(libdir(compiler.host)),
}
}
}
Expand All @@ -668,11 +665,11 @@ impl<'a> Builder<'a> {
/// Windows.
pub fn libdir_relative(&self, compiler: Compiler) -> &Path {
if compiler.is_snapshot(self) {
libdir(&self.config.build).as_ref()
libdir(self.config.build).as_ref()
} else {
match self.config.libdir_relative() {
Some(relative_libdir) if compiler.stage >= 1 => relative_libdir,
_ => libdir(&compiler.host).as_ref(),
_ => libdir(compiler.host).as_ref(),
}
}
}
Expand Down Expand Up @@ -707,7 +704,7 @@ impl<'a> Builder<'a> {
if compiler.is_snapshot(self) {
self.initial_rustc.clone()
} else {
self.sysroot(compiler).join("bin").join(exe("rustc", &compiler.host))
self.sysroot(compiler).join("bin").join(exe("rustc", compiler.host))
}
}

Expand All @@ -725,7 +722,11 @@ impl<'a> Builder<'a> {
.env("CFG_RELEASE_CHANNEL", &self.config.channel)
.env("RUSTDOC_REAL", self.rustdoc(compiler))
.env("RUSTDOC_CRATE_VERSION", self.rust_version())
.env("RUSTC_BOOTSTRAP", "1");
.env("RUSTC_BOOTSTRAP", "1")
.arg("-Winvalid_codeblock_attributes");
if self.config.deny_warnings {
cmd.arg("-Dwarnings");
}

// Remove make-related flags that can cause jobserver problems.
cmd.env_remove("MAKEFLAGS");
Expand All @@ -741,7 +742,7 @@ impl<'a> Builder<'a> {
///
/// Note that this returns `None` if LLVM is disabled, or if we're in a
/// check build or dry-run, where there's no need to build all of LLVM.
fn llvm_config(&self, target: Interned<String>) -> Option<PathBuf> {
fn llvm_config(&self, target: TargetSelection) -> Option<PathBuf> {
if self.config.llvm_enabled() && self.kind != Kind::Check && !self.config.dry_run {
let llvm_config = self.ensure(native::Llvm { target });
if llvm_config.is_file() {
Expand All @@ -763,7 +764,7 @@ impl<'a> Builder<'a> {
compiler: Compiler,
mode: Mode,
source_type: SourceType,
target: Interned<String>,
target: TargetSelection,
cmd: &str,
) -> Cargo {
let mut cargo = Command::new(&self.initial_cargo);
Expand All @@ -773,7 +774,7 @@ impl<'a> Builder<'a> {
let my_out = match mode {
// This is the intended out directory for compiler documentation.
Mode::Rustc | Mode::ToolRustc | Mode::Codegen => self.compiler_doc_out(target),
Mode::Std => out_dir.join(target).join("doc"),
Mode::Std => out_dir.join(target.triple).join("doc"),
_ => panic!("doc mode {:?} not expected", mode),
};
let rustdoc = self.rustdoc(compiler);
Expand All @@ -795,7 +796,7 @@ impl<'a> Builder<'a> {
}

if cmd != "install" {
cargo.arg("--target").arg(target);
cargo.arg("--target").arg(target.rustc_target_arg());
} else {
assert_eq!(target, compiler.host);
}
Expand All @@ -821,7 +822,7 @@ impl<'a> Builder<'a> {
compiler.stage
};

let mut rustflags = Rustflags::new(&target);
let mut rustflags = Rustflags::new(target);
if stage != 0 {
if let Ok(s) = env::var("CARGOFLAGS_NOT_BOOTSTRAP") {
cargo.args(s.split_whitespace());
Expand All @@ -838,7 +839,7 @@ impl<'a> Builder<'a> {
// FIXME: It might be better to use the same value for both `RUSTFLAGS` and `RUSTDOCFLAGS`,
// but this breaks CI. At the very least, stage0 `rustdoc` needs `--cfg bootstrap`. See
// #71458.
let rustdocflags = rustflags.clone();
let mut rustdocflags = rustflags.clone();

if let Ok(s) = env::var("CARGOFLAGS") {
cargo.args(s.split_whitespace());
Expand Down Expand Up @@ -994,7 +995,7 @@ impl<'a> Builder<'a> {
// argument manually via `-C link-args=-Wl,-rpath,...`. Plus isn't it
// fun to pass a flag to a tool to pass a flag to pass a flag to a tool
// to change a flag in a binary?
if self.config.rust_rpath && util::use_host_linker(&target) {
if self.config.rust_rpath && util::use_host_linker(target) {
let rpath = if target.contains("apple") {
// Note that we need to take one extra step on macOS to also pass
// `-Wl,-instal_name,@rpath/...` to get things to work right. To
Expand Down Expand Up @@ -1022,7 +1023,7 @@ impl<'a> Builder<'a> {
}

if let Some(target_linker) = self.linker(target, can_use_lld) {
let target = crate::envify(&target);
let target = crate::envify(&target.triple);
cargo.env(&format!("CARGO_TARGET_{}_LINKER", target), target_linker);
}
if !(["build", "check", "clippy", "fix", "rustc"].contains(&cmd)) && want_rustdoc {
Expand Down Expand Up @@ -1140,6 +1141,7 @@ impl<'a> Builder<'a> {

if self.config.deny_warnings {
lint_flags.push("-Dwarnings");
rustdocflags.arg("-Dwarnings");
}

// FIXME(#58633) hide "unused attribute" errors in incremental
Expand All @@ -1157,6 +1159,8 @@ impl<'a> Builder<'a> {
// are always ignored in dependencies. Eventually this should be
// fixed via better support from Cargo.
cargo.env("RUSTC_LINT_FLAGS", lint_flags.join(" "));

rustdocflags.arg("-Winvalid_codeblock_attributes");
}

if let Mode::Rustc | Mode::Codegen = mode {
Expand Down Expand Up @@ -1193,21 +1197,23 @@ impl<'a> Builder<'a> {
}
};
let cc = ccacheify(&self.cc(target));
cargo.env(format!("CC_{}", target), &cc);
cargo.env(format!("CC_{}", target.triple), &cc);

let cflags = self.cflags(target, GitRepo::Rustc).join(" ");
cargo.env(format!("CFLAGS_{}", target), cflags.clone());
cargo.env(format!("CFLAGS_{}", target.triple), cflags.clone());

if let Some(ar) = self.ar(target) {
let ranlib = format!("{} s", ar.display());
cargo.env(format!("AR_{}", target), ar).env(format!("RANLIB_{}", target), ranlib);
cargo
.env(format!("AR_{}", target.triple), ar)
.env(format!("RANLIB_{}", target.triple), ranlib);
}

if let Ok(cxx) = self.cxx(target) {
let cxx = ccacheify(&cxx);
cargo
.env(format!("CXX_{}", target), &cxx)
.env(format!("CXXFLAGS_{}", target), cflags);
.env(format!("CXX_{}", target.triple), &cxx)
.env(format!("CXXFLAGS_{}", target.triple), cflags);
}
}

Expand Down Expand Up @@ -1241,7 +1247,7 @@ impl<'a> Builder<'a> {
// Environment variables *required* throughout the build
//
// FIXME: should update code to not require this env var
cargo.env("CFG_COMPILER_HOST_TRIPLE", target);
cargo.env("CFG_COMPILER_HOST_TRIPLE", target.triple);

// Set this for all builds to make sure doc builds also get it.
cargo.env("CFG_RELEASE_CHANNEL", &self.config.channel);
Expand Down Expand Up @@ -1397,15 +1403,15 @@ mod tests;
struct Rustflags(String);

impl Rustflags {
fn new(target: &str) -> Rustflags {
fn new(target: TargetSelection) -> Rustflags {
let mut ret = Rustflags(String::new());

// Inherit `RUSTFLAGS` by default ...
ret.env("RUSTFLAGS");

// ... and also handle target-specific env RUSTFLAGS if they're
// configured.
let target_specific = format!("CARGO_TARGET_{}_RUSTFLAGS", crate::envify(target));
let target_specific = format!("CARGO_TARGET_{}_RUSTFLAGS", crate::envify(&target.triple));
ret.env(&target_specific);

ret
Expand Down
Loading