Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
ba4c498
Add more info for Vec Drain doc
pickfire Aug 29, 2020
7148412
Vec slice example fix style and show type elision
pickfire Aug 29, 2020
a80d390
Use inline(never) instead of cold
howard0su Sep 2, 2020
941dca8
Add Arith Tests in Library
Sep 5, 2020
dc37b55
Minor refactoring
Sep 5, 2020
7d834c8
Move Various str tests in library
Sep 5, 2020
d85db82
Add documentation for `impl<T> From<T> for Poll<T>`
notriddle Sep 9, 2020
8b0d0a0
Add documentation for `impl<T> From<BinaryHeap<T>> for Vec<T>`
notriddle Sep 9, 2020
85ab152
Update bootstrap readme
jyn514 Sep 12, 2020
73e0a56
Make all methods of `Duration` const
CDirkx Sep 4, 2020
4f0047e
Add a comment on is_trivially_sized about obviously !Sized types
nox Sep 12, 2020
75f0f7a
Fix a typo
nox Sep 12, 2020
caf6c92
Clean up some language trait items comparisons
nox Sep 12, 2020
2e7ca73
Don't emit an error on private doc tests when they're ignored
GuillaumeGomez Sep 12, 2020
15d25a8
Add test for ignored private doc test
GuillaumeGomez Sep 12, 2020
b7ce5b4
remove orphaned files
tshepang Sep 13, 2020
c9686cb
Introduce a PartitioningCx struct
wesleywiser Jul 26, 2020
0eac38b
fix syntax error in suggesting generic constraint in trait parameter
iximeow Sep 14, 2020
dd57275
shrink const infer error
lcnr Sep 14, 2020
035f879
improve const infer err
lcnr Sep 14, 2020
b881551
Simplify iter flatten struct doc
pickfire Sep 14, 2020
43709f7
:arrow_up: rust-analyzer
Sep 14, 2020
5112f87
Remove flatten doc intra-doc links
pickfire Sep 14, 2020
1f26a18
Use intra-doc links for `DelaySpanBugEmitted`
camelid Sep 14, 2020
15349ef
Minor improvements to `mir::Constant` docs
camelid Sep 14, 2020
5c1043a
Fix diagram for `DebruijnIndex`
camelid Sep 14, 2020
e1607c8
clean up comment text a bit
iximeow Sep 14, 2020
32efcfc
Include non-JSON output in error display for lint-doc failure.
ehuss Sep 14, 2020
9dad908
Fix generating rustc docs with non-default lib directory.
ehuss Sep 14, 2020
58310ce
Use intra-doc links in `core::mem`
camelid Sep 14, 2020
f7f9a6c
Add a comment why `extern crate` is necessary for rustdoc
jyn514 Sep 15, 2020
1c7204f
Prefer asm! over llvm_asm! in core
tesuji Sep 14, 2020
1f572b0
Vec doc use elision as code rather than comment
pickfire Sep 15, 2020
176956c
Test and fix Sync & Send traits of BTreeMap artefacts
ssomers Sep 14, 2020
b93a831
Add a comment why rustdoc loads crates from the sysroot
jyn514 Sep 15, 2020
5f3145f
Avoid printing dry run timings
Mark-Simulacrum Sep 15, 2020
328c61c
Make the default stage for x.py configurable
jyn514 Sep 12, 2020
21b0c12
Extract some intrinsics out of rustc_codegen_llvm
khyperia Sep 15, 2020
e0c1621
Update books
ehuss Sep 15, 2020
eeffc1c
Rollup merge of #76056 - pickfire:patch-10, r=jyn514
Dylan-DPC Sep 16, 2020
fe989e9
Rollup merge of #76062 - pickfire:patch-13, r=jyn514
Dylan-DPC Sep 16, 2020
f2d9579
Rollup merge of #76262 - howard0su:patch-1, r=cramertj
Dylan-DPC Sep 16, 2020
bc42cd8
Rollup merge of #76335 - CDirkx:const-duration, r=ecstatic-morse
Dylan-DPC Sep 16, 2020
921c15c
Rollup merge of #76366 - ayushmishra2005:arith_tests_in_library, r=jy…
Dylan-DPC Sep 16, 2020
53cb50d
Rollup merge of #76369 - ayushmishra2005:move_various_str_tests_libra…
Dylan-DPC Sep 16, 2020
651210c
Rollup merge of #76534 - notriddle:doc-comments, r=jyn514
Dylan-DPC Sep 16, 2020
ca2db9e
Rollup merge of #76622 - jyn514:bootstrap-readme, r=Mark-Simulacrum
Dylan-DPC Sep 16, 2020
d33c57c
Rollup merge of #76625 - jyn514:default-stages, r=Mark-Simulacrum
Dylan-DPC Sep 16, 2020
0224a3e
Rollup merge of #76641 - nox:pointee-random-stuff, r=eddyb
Dylan-DPC Sep 16, 2020
b0e36db
Rollup merge of #76642 - GuillaumeGomez:ignored-private-doc-test, r=j…
Dylan-DPC Sep 16, 2020
1012d66
Rollup merge of #76669 - lzutao:core_asm, r=Amanieu
Dylan-DPC Sep 16, 2020
b5c8816
Rollup merge of #76681 - tshepang:unused, r=Mark-Simulacrum
Dylan-DPC Sep 16, 2020
0f834e6
Rollup merge of #76694 - wesleywiser:partitioning_cx_trait, r=davidtwco
Dylan-DPC Sep 16, 2020
f4be98a
Rollup merge of #76695 - iximeow:trait-generic-bound-suggestion, r=es…
Dylan-DPC Sep 16, 2020
55b9088
Rollup merge of #76699 - lcnr:const-infer-err, r=varkor
Dylan-DPC Sep 16, 2020
6ef8299
Rollup merge of #76707 - pickfire:patch-4, r=jonas-schievink
Dylan-DPC Sep 16, 2020
51fd7db
Rollup merge of #76710 - rust-lang:rust-analyzer-2020-09-14, r=jonas-…
Dylan-DPC Sep 16, 2020
ce2041b
Rollup merge of #76714 - camelid:patch-3, r=jonas-schievink
Dylan-DPC Sep 16, 2020
75cd58e
Rollup merge of #76717 - ehuss:fix-rustc-book-libdir, r=Mark-Simulacrum
Dylan-DPC Sep 16, 2020
dcb5c5b
Rollup merge of #76721 - camelid:intra-doc-links-for-core-mem, r=jyn514
Dylan-DPC Sep 16, 2020
d99896b
Rollup merge of #76722 - ssomers:btree_send_sync, r=Mark-Simulacrum
Dylan-DPC Sep 16, 2020
36bf0c9
Rollup merge of #76728 - jyn514:rustdoc-extern-crate, r=ehuss
Dylan-DPC Sep 16, 2020
31e0815
Rollup merge of #76741 - Mark-Simulacrum:no-dry-run-timing, r=alexcri…
Dylan-DPC Sep 16, 2020
f868f02
Rollup merge of #76764 - ehuss:update-books, r=ehuss
Dylan-DPC Sep 16, 2020
32ff2c9
Rollup merge of #76766 - khyperia:generic_intrinsics, r=eddyb
Dylan-DPC Sep 16, 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
Prev Previous commit
Next Next commit
Make the default stage for x.py configurable
This allows configuring the default stage for each sub-command individually.

- Normalize the stage as early as possible, so there's no confusion
  about which to use.
- Don't add an explicit `stage` option in config.toml

  This offers no more flexibility than `*_stage` and makes it confusing
  which takes precedence.

- Always give `--stage N` precedence over config.toml
- Fix bootstrap tests

  This changes the tests to go through `Config::parse` so that they test
  the actual defaults, not the dummy ones provided by `default_opts`.  To
  make this workable (and independent of the environment), it does not
  read `config.toml` for tests.
  • Loading branch information
jyn514 committed Sep 15, 2020
commit 328c61c15711ae8a741b2aa56af1c450f54d1796
17 changes: 17 additions & 0 deletions config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,23 @@
# General build configuration options
# =============================================================================
[build]
# The default stage to use for the `doc` subcommand
#doc-stage = 0

# The default stage to use for the `build` subcommand
#build-stage = 1

# The default stage to use for the `test` subcommand
#test-stage = 1

# The default stage to use for the `dist` subcommand
#dist-stage = 2

# The default stage to use for the `install` subcommand
#install-stage = 2

# The default stage to use for the `bench` subcommand
#bench-stage = 2

# Build triple for the original snapshot compiler. This must be a compiler that
# nightlies are already produced for. The current platform must be able to run
Expand Down
31 changes: 2 additions & 29 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -526,23 +526,9 @@ impl<'a> Builder<'a> {
}

fn new_internal(build: &Build, kind: Kind, paths: Vec<PathBuf>) -> Builder<'_> {
let top_stage = if let Some(explicit_stage) = build.config.stage {
explicit_stage
} else {
// See https://github.com/rust-lang/compiler-team/issues/326
match kind {
Kind::Doc => 0,
Kind::Build | Kind::Test => 1,
Kind::Bench | Kind::Dist | Kind::Install => 2,
// These are all bootstrap tools, which don't depend on the compiler.
// The stage we pass shouldn't matter, but use 0 just in case.
Kind::Check | Kind::Clippy | Kind::Fix | Kind::Run | Kind::Format => 0,
}
};

Builder {
build,
top_stage,
top_stage: build.config.stage,
kind,
cache: Cache::new(),
stack: RefCell::new(Vec::new()),
Expand All @@ -566,20 +552,7 @@ impl<'a> Builder<'a> {
Subcommand::Format { .. } | Subcommand::Clean { .. } => panic!(),
};

let this = Self::new_internal(build, kind, paths.to_owned());

// CI should always run stage 2 builds, unless it specifically states otherwise
#[cfg(not(test))]
if build.config.stage.is_none() && build.ci_env != crate::CiEnv::None {
match kind {
Kind::Test | Kind::Doc | Kind::Build | Kind::Bench | Kind::Dist | Kind::Install => {
assert_eq!(this.top_stage, 2)
}
Kind::Check | Kind::Clippy | Kind::Fix | Kind::Run | Kind::Format => {}
}
}

this
Self::new_internal(build, kind, paths.to_owned())
}

pub fn execute_cli(&self) {
Expand Down
14 changes: 7 additions & 7 deletions src/bootstrap/builder/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use super::*;
use crate::config::{Config, TargetSelection};
use std::thread;

fn configure(host: &[&str], target: &[&str]) -> Config {
let mut config = Config::default_opts();
fn configure(cmd: &str, host: &[&str], target: &[&str]) -> Config {
let mut config = Config::parse(&[cmd.to_owned()]);
// don't save toolstates
config.save_toolstates = None;
config.skip_only_host_steps = false;
Expand Down Expand Up @@ -42,7 +42,7 @@ mod defaults {

#[test]
fn build_default() {
let build = Build::new(configure(&[], &[]));
let build = Build::new(configure("build", &[], &[]));
let mut builder = Builder::new(&build);
builder.run_step_descriptions(&Builder::get_step_descriptions(Kind::Build), &[]);

Expand Down Expand Up @@ -70,7 +70,7 @@ mod defaults {

#[test]
fn build_stage_0() {
let config = Config { stage: Some(0), ..configure(&[], &[]) };
let config = Config { stage: 0, ..configure("build", &[], &[]) };
let build = Build::new(config);
let mut builder = Builder::new(&build);
builder.run_step_descriptions(&Builder::get_step_descriptions(Kind::Build), &[]);
Expand All @@ -92,7 +92,7 @@ mod defaults {

#[test]
fn doc_default() {
let mut config = configure(&[], &[]);
let mut config = configure("doc", &[], &[]);
config.compiler_docs = true;
config.cmd = Subcommand::Doc { paths: Vec::new(), open: false };
let build = Build::new(config);
Expand Down Expand Up @@ -126,7 +126,7 @@ mod dist {
use pretty_assertions::assert_eq;

fn configure(host: &[&str], target: &[&str]) -> Config {
Config { stage: Some(2), ..super::configure(host, target) }
Config { stage: 2, ..super::configure("dist", host, target) }
}

#[test]
Expand Down Expand Up @@ -455,7 +455,7 @@ mod dist {
#[test]
fn test_with_no_doc_stage0() {
let mut config = configure(&[], &[]);
config.stage = Some(0);
config.stage = 0;
config.cmd = Subcommand::Test {
paths: vec!["library/std".into()],
test_args: vec![],
Expand Down
59 changes: 53 additions & 6 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use std::ffi::OsString;
use std::fmt;
use std::fs;
use std::path::{Path, PathBuf};
use std::process;

use crate::cache::{Interned, INTERNER};
use crate::flags::Flags;
Expand Down Expand Up @@ -57,7 +56,7 @@ pub struct Config {
pub skip_only_host_steps: bool,

pub on_fail: Option<String>,
pub stage: Option<u32>,
pub stage: u32,
pub keep_stage: Vec<u32>,
pub src: PathBuf,
pub jobs: Option<u32>,
Expand Down Expand Up @@ -300,6 +299,12 @@ struct Build {
configure_args: Option<Vec<String>>,
local_rebuild: Option<bool>,
print_step_timings: Option<bool>,
doc_stage: Option<u32>,
build_stage: Option<u32>,
test_stage: Option<u32>,
install_stage: Option<u32>,
dist_stage: Option<u32>,
bench_stage: Option<u32>,
}

/// TOML representation of various global install decisions.
Expand Down Expand Up @@ -480,13 +485,11 @@ impl Config {

pub fn parse(args: &[String]) -> Config {
let flags = Flags::parse(&args);
let file = flags.config.clone();
let mut config = Config::default_opts();
config.exclude = flags.exclude;
config.rustc_error_format = flags.rustc_error_format;
config.json_output = flags.json_output;
config.on_fail = flags.on_fail;
config.stage = flags.stage;
config.jobs = flags.jobs.map(threads_from_config);
config.cmd = flags.cmd;
config.incremental = flags.incremental;
Expand All @@ -503,8 +506,14 @@ impl Config {
config.out = dir;
}

let toml = file
#[cfg(test)]
let 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,
Expand All @@ -520,7 +529,7 @@ impl Config {
})
.unwrap_or_else(TomlConfig::default);

let build = toml.build.clone().unwrap_or_default();
let build = toml.build.unwrap_or_default();

// If --target was specified but --host wasn't specified, don't run any host-only tests.
let has_hosts = build.host.is_some() || flags.host.is_some();
Expand Down Expand Up @@ -564,6 +573,44 @@ impl Config {
set(&mut config.configure_args, build.configure_args);
set(&mut config.local_rebuild, build.local_rebuild);
set(&mut config.print_step_timings, build.print_step_timings);

// See https://github.com/rust-lang/compiler-team/issues/326
config.stage = match config.cmd {
Subcommand::Doc { .. } => flags.stage.or(build.doc_stage).unwrap_or(0),
Subcommand::Build { .. } => flags.stage.or(build.build_stage).unwrap_or(1),
Subcommand::Test { .. } => flags.stage.or(build.test_stage).unwrap_or(1),
Subcommand::Bench { .. } => flags.stage.or(build.bench_stage).unwrap_or(2),
Subcommand::Dist { .. } => flags.stage.or(build.dist_stage).unwrap_or(2),
Subcommand::Install { .. } => flags.stage.or(build.install_stage).unwrap_or(2),
// These are all bootstrap tools, which don't depend on the compiler.
// The stage we pass shouldn't matter, but use 0 just in case.
Subcommand::Clean { .. }
| Subcommand::Check { .. }
| Subcommand::Clippy { .. }
| Subcommand::Fix { .. }
| Subcommand::Run { .. }
| Subcommand::Format { .. } => flags.stage.unwrap_or(0),
};

// CI should always run stage 2 builds, unless it specifically states otherwise
#[cfg(not(test))]
if flags.stage.is_none() && crate::CiEnv::current() != crate::CiEnv::None {
match config.cmd {
Subcommand::Test { .. }
| Subcommand::Doc { .. }
| Subcommand::Build { .. }
| Subcommand::Bench { .. }
| Subcommand::Dist { .. }
| Subcommand::Install { .. } => assert_eq!(config.stage, 2),
Subcommand::Clean { .. }
| Subcommand::Check { .. }
| Subcommand::Clippy { .. }
| Subcommand::Fix { .. }
| Subcommand::Run { .. }
| Subcommand::Format { .. } => {}
}
}

config.verbose = cmp::max(config.verbose, flags.verbose);

if let Some(ref install) = toml.install {
Expand Down