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 #74305

Closed
wants to merge 85 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
37570e8
Substantial refactor to the design of LineWriter
Lucretiel May 29, 2020
0f38158
Updated comments; only pre-flush newline terminated buffers
Lucretiel May 31, 2020
4a1597f
Expressionify `LineWriterShim::write`
Lucretiel May 31, 2020
5edad37
Expressionify write_all
Lucretiel May 31, 2020
1bf8ba3
x.py fmt
Lucretiel May 31, 2020
e0dfdc6
Added check for `is_write_vectored`
Lucretiel Jun 1, 2020
2c3024b
Add comment describing erroneous_flush_retried
Lucretiel Jun 1, 2020
e89e2e4
Added test stubs
Lucretiel Jun 1, 2020
f0a0807
Various testing & implementation updates:
Lucretiel Jun 1, 2020
b6296e8
Tons of testing updates, other minor changes
Lucretiel Jun 2, 2020
e022d34
Fixed typo in test
Lucretiel Jun 2, 2020
e4328ae
Code review updates: all minor style fixes
Lucretiel Jun 2, 2020
f7650fe
Add comment
Lucretiel Jun 2, 2020
7a6a12b
Tidy fixes
Lucretiel Jun 2, 2020
338a2c0
Reimplement flush_buf with a Guard. Longer, but cleaner.
Lucretiel Jun 2, 2020
c869638
Added comment about BufWrite::write_all
Lucretiel Jun 2, 2020
61f591e
Improved line_vectored_ignored. Added stylistic semicolon.
Lucretiel Jun 2, 2020
2d22c77
Fixed bug in write_vectored & empty buffers
Lucretiel Jun 2, 2020
2c23b90
Comment updates
Lucretiel Jun 2, 2020
e999ca5
Remove inline from write_to_buf
Lucretiel Jun 2, 2020
70ba320
More minor changes
Lucretiel Jun 2, 2020
5b1a40c
BufWriter::write* methods now use fewer runtime checks
Lucretiel Jun 2, 2020
8df5ae0
x.py fix AGAIN
Lucretiel Jun 2, 2020
60ab99f
Fixed corner case related to partial-line buffering
Lucretiel Jun 2, 2020
38017a3
Update comments with relevant issue numbers
Lucretiel Jun 2, 2020
59710fb
Clarified comment in `partial_multiline_buffering` test
Lucretiel Jun 2, 2020
2e21af2
Document the union keyword
poliorcetics Jun 29, 2020
614f773
Clarify some parts by applying the suggestions from review
poliorcetics Jun 30, 2020
310c97b
Fix caching issue when building tools.
ehuss Jul 4, 2020
c478b54
add as_ptr method to raw slices
RalfJung Jul 3, 2020
3b1d5e6
call the mut version as_mut_ptr and also add an as_ptr-like method to…
RalfJung Jul 3, 2020
90580c7
make unchecked slice indexing helper methods use raw pointers
RalfJung Jul 5, 2020
5f5c98b
add (unchecked) indexing methods to raw pointers and NonNull
RalfJung Jul 5, 2020
00980b6
clean up E0718 explanation
GuillaumeGomez Jul 7, 2020
c8b16cd
rustdoc: Allow linking from private items to private types
dennis-hamester Jul 8, 2020
23d7b3f
Remove an unwrap in layout computation
erikdesjardins Jul 10, 2020
fe1d758
Suggest borrowing unsized argument types
estebank Jul 10, 2020
2185b0b
Point at type on E0275 instead of whole field
estebank Jul 10, 2020
689e360
test: rustdoc-ui: Add issue-74134, replacing test/rustdoc/issue-74134-*
dennis-hamester Jul 11, 2020
b8632e1
Removed FIXME
Lucretiel Jul 11, 2020
140bfc5
Removed another FIXME
Lucretiel Jul 11, 2020
9704859
test: rustdoc-ui: Expand issue-74134 to cover types in a private module
dennis-hamester Jul 11, 2020
8789525
test: rustdoc-ui: issue-74134: Shorten a too long line
dennis-hamester Jul 11, 2020
0979545
rustdoc: insert newlines between attributes
euclio Jun 28, 2020
4728438
Improve wording
GuillaumeGomez Jul 11, 2020
997accc
Remove doubled "is_write_vectored"
Lucretiel Jul 11, 2020
1380026
Suggest boxing or borrowing unsized fields
estebank Jul 10, 2020
6755076
Remove `Sized` `on_unimplemented` note
estebank Jul 10, 2020
424902a
Suggest borrowing in more unsized fn param cases
estebank Jul 11, 2020
2d0f3eb
Remove redundant explanatory `note` for type parameters
estebank Jul 11, 2020
6a7b5df
Removed unused method
Lucretiel Jul 11, 2020
905b5ad
don't mark linux kernel module targets as a unix environment
alex Jul 11, 2020
606593f
Minor updates
Lucretiel Jul 12, 2020
8082fb9
rename fast_thread_local -> thread_local_dtor; thread_local -> thread…
RalfJung Jul 12, 2020
7dc3886
adjust remaining targets
RalfJung Jul 12, 2020
ff5e107
assign tracking issue
RalfJung Jul 12, 2020
d512a6c
Don't panic if the lhs of a div by zero is not statically known
oli-obk Jul 10, 2020
5afbc52
typeck: report placeholder type error w/out span
davidtwco Jul 12, 2020
5daedea
Detect tuple struct incorrectly used as struct pat
estebank Jul 9, 2020
ed587f8
Update llvm-project to latest origin/rustc/10.0-2020-05-05 commit whi…
AdrianCX Jul 11, 2020
c24b96d
Teach bootstrap about target files vs target triples
shepmaster Jul 2, 2020
9a3a31a
Added tests for volatile and nearbyint intrinsics
theo-lw Jul 13, 2020
5ff7e1a
Added ui tests for volatile and nearby intrinsics
theo-lw Jul 13, 2020
eac8092
Removed trailing whitespace
theo-lw Jul 13, 2020
e3ae4c7
Added proper explanation of ErrorCode-E0688
Polkaverse Jul 13, 2020
bc2b37a
Merge branch 'master' into E0688
Polkaverse Jul 13, 2020
8df79fc
Remove trailing whitespace
theo-lw Jul 13, 2020
3a17fba
Rollup merge of #72808 - Lucretiel:line-writer-reimpl, r=Amanieu
Manishearth Jul 13, 2020
1c7afc5
Rollup merge of #73852 - euclio:rustdoc-attr-newlines, r=GuillaumeGomez
Manishearth Jul 13, 2020
903a81a
Rollup merge of #73867 - poliorcetics:union-keyword, r=joshtriplett
Manishearth Jul 13, 2020
657e34c
Rollup merge of #73986 - RalfJung:raw-slice-as-ptr, r=sfackler
Manishearth Jul 13, 2020
4c972cf
Rollup merge of #74046 - ehuss:deny-warnings-caching, r=Mark-Simulacrum
Manishearth Jul 13, 2020
06190a4
Rollup merge of #74123 - GuillaumeGomez:cleanup-e0718, r=pickfire
Manishearth Jul 13, 2020
bcbb885
Rollup merge of #74147 - dennis-hamester:fix/issue-74134, r=jyn514
Manishearth Jul 13, 2020
548519c
Rollup merge of #74173 - estebank:struct-pat-as-enum, r=petrochenkov
Manishearth Jul 13, 2020
03e6b82
Rollup merge of #74221 - oli-obk:const_prop_ice, r=wesleywiser
Manishearth Jul 13, 2020
ea37221
Rollup merge of #74227 - erikdesjardins:layun, r=estebank
Manishearth Jul 13, 2020
20780d6
Rollup merge of #74228 - estebank:unsized-param, r=estebank
Manishearth Jul 13, 2020
2a36375
Rollup merge of #74239 - AdrianCX:master, r=cuviper
Manishearth Jul 13, 2020
2520b8b
Rollup merge of #74251 - shepmaster:bootstrap-target-files, r=Mark-Si…
Manishearth Jul 13, 2020
29a2ccd
Rollup merge of #74257 - alex:patch-1, r=joshtriplett
Manishearth Jul 13, 2020
62be943
Rollup merge of #74263 - RalfJung:thread-local, r=Mark-Simulacrum
Manishearth Jul 13, 2020
10aa0f4
Rollup merge of #74270 - davidtwco:issue-74086-more-placeholder-type-…
Manishearth Jul 13, 2020
efa9759
Rollup merge of #74285 - wangtheo:issue-71669, r=lcnr
Manishearth Jul 13, 2020
b64d6b9
Rollup merge of #74286 - PankajChaudhary5:E0688, r=GuillaumeGomez
Manishearth Jul 13, 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
1 change: 1 addition & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3996,6 +3996,7 @@ dependencies = [
"rustc_data_structures",
"rustc_errors",
"rustc_hir",
"rustc_hir_pretty",
"rustc_index",
"rustc_infer",
"rustc_middle",
Expand Down
4 changes: 4 additions & 0 deletions src/bootstrap/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ fn main() {
cmd.env("RUST_BACKTRACE", "1");
}

if let Ok(lint_flags) = env::var("RUSTC_LINT_FLAGS") {
cmd.args(lint_flags.split_whitespace());
}

if target.is_some() {
// The stage0 compiler has a special sysroot distinct from what we
// actually downloaded, so we just always pass the `--sysroot` option,
Expand Down
77 changes: 43 additions & 34 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 Down Expand Up @@ -741,7 +738,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 +760,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 Down Expand Up @@ -794,7 +791,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 @@ -820,7 +817,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 Down Expand Up @@ -993,7 +990,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 @@ -1021,7 +1018,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 @@ -1130,22 +1127,32 @@ impl<'a> Builder<'a> {
cargo.env("RUSTC_VERBOSE", self.verbosity.to_string());

if source_type == SourceType::InTree {
let mut lint_flags = Vec::new();
// When extending this list, add the new lints to the RUSTFLAGS of the
// build_bootstrap function of src/bootstrap/bootstrap.py as well as
// some code doesn't go through this `rustc` wrapper.
rustflags.arg("-Wrust_2018_idioms");
rustflags.arg("-Wunused_lifetimes");
lint_flags.push("-Wrust_2018_idioms");
lint_flags.push("-Wunused_lifetimes");

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

// FIXME(#58633) hide "unused attribute" errors in incremental
// builds of the standard library, as the underlying checks are
// not yet properly integrated with incremental recompilation.
if mode == Mode::Std && compiler.stage == 0 && self.config.incremental {
rustflags.arg("-Aunused-attributes");
lint_flags.push("-Aunused-attributes");
}
// This does not use RUSTFLAGS due to caching issues with Cargo.
// Clippy is treated as an "in tree" tool, but shares the same
// cache as other "submodule" tools. With these options set in
// RUSTFLAGS, that causes *every* shared dependency to be rebuilt.
// By injecting this into the rustc wrapper, this circumvents
// Cargo's fingerprint detection. This is fine because lint flags
// are always ignored in dependencies. Eventually this should be
// fixed via better support from Cargo.
cargo.env("RUSTC_LINT_FLAGS", lint_flags.join(" "));
}

if let Mode::Rustc | Mode::Codegen = mode {
Expand Down Expand Up @@ -1182,21 +1189,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 @@ -1230,7 +1239,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 @@ -1386,15 +1395,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