Skip to content

Commit 6a78c0a

Browse files
committed
resolved conflict with upstream commit
2 parents e1d5509 + 6f721f5 commit 6a78c0a

File tree

554 files changed

+10871
-4862
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

554 files changed

+10871
-4862
lines changed

config.toml.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,9 @@
346346
# Whether to deny warnings in crates
347347
#deny-warnings = true
348348

349+
# Print backtrace on internal compiler errors during bootstrap
350+
#backtrace-on-ice = false
351+
349352
# =============================================================================
350353
# Options for specific targets
351354
#

src/Cargo.lock

Lines changed: 71 additions & 53 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Cargo.toml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,6 @@ members = [
4040
"tools/rls/test_data/workspace_symbol",
4141
]
4242

43-
# Curiously, compiletest will segfault if compiled with opt-level=3 on 64-bit
44-
# MSVC when running the compile-fail test suite when a should-fail test panics.
45-
# But hey if this is removed and it gets past the bots, sounds good to me.
46-
[profile.release]
47-
opt-level = 2
48-
[profile.bench]
49-
opt-level = 2
50-
5143
# These options are controlled from our rustc wrapper script, so turn them off
5244
# here and have them controlled elsewhere.
5345
[profile.dev]

src/bootstrap/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ The script accepts commands, flags, and arguments to determine what to do:
6464
# execute tests in the standard library in stage0
6565
./x.py test --stage 0 src/libstd
6666
67+
# execute tests in the core and standard library in stage0,
68+
# without running doc tests (thus avoid depending on building the compiler)
69+
./x.py test --stage 0 --no-doc src/libcore src/libstd
70+
6771
# execute all doc tests
6872
./x.py test src/doc
6973
```

src/bootstrap/bin/rustc.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,13 @@ fn main() {
107107
env::join_paths(&dylib_path).unwrap());
108108
let mut maybe_crate = None;
109109

110+
// Print backtrace in case of ICE
111+
if env::var("RUSTC_BACKTRACE_ON_ICE").is_ok() && env::var("RUST_BACKTRACE").is_err() {
112+
cmd.env("RUST_BACKTRACE", "1");
113+
}
114+
115+
cmd.env("RUSTC_BREAK_ON_ICE", "1");
116+
110117
if let Some(target) = target {
111118
// The stage0 compiler has a special sysroot distinct from what we
112119
// actually downloaded, so we just always pass the `--sysroot` option.

src/bootstrap/builder.rs

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use compile;
2525
use install;
2626
use dist;
2727
use util::{exe, libdir, add_lib_path};
28-
use {Build, Mode};
28+
use {Build, Mode, DocTests};
2929
use cache::{INTERNER, Interned, Cache};
3030
use check;
3131
use test;
@@ -323,15 +323,15 @@ impl<'a> Builder<'a> {
323323
test::Cargotest, test::Cargo, test::Rls, test::ErrorIndex, test::Distcheck,
324324
test::RunMakeFullDeps,
325325
test::Nomicon, test::Reference, test::RustdocBook, test::RustByExample,
326-
test::TheBook, test::UnstableBook,
326+
test::TheBook, test::UnstableBook, test::RustcBook,
327327
test::Rustfmt, test::Miri, test::Clippy, test::RustdocJS, test::RustdocTheme,
328328
// Run run-make last, since these won't pass without make on Windows
329329
test::RunMake, test::RustdocUi),
330330
Kind::Bench => describe!(test::Crate, test::CrateLibrustc),
331331
Kind::Doc => describe!(doc::UnstableBook, doc::UnstableBookGen, doc::TheBook,
332332
doc::Standalone, doc::Std, doc::Test, doc::WhitelistedRustc, doc::Rustc,
333333
doc::ErrorIndex, doc::Nomicon, doc::Reference, doc::Rustdoc, doc::RustByExample,
334-
doc::CargoBook),
334+
doc::RustcBook, doc::CargoBook),
335335
Kind::Dist => describe!(dist::Docs, dist::RustcDocs, dist::Mingw, dist::Rustc,
336336
dist::DebuggerScripts, dist::Std, dist::Analysis, dist::Src,
337337
dist::PlainSourceTarball, dist::Cargo, dist::Rls, dist::Rustfmt, dist::Extended,
@@ -591,6 +591,8 @@ impl<'a> Builder<'a> {
591591
format!("{} {}", env::var("RUSTFLAGS").unwrap_or_default(), extra_args));
592592
}
593593

594+
let want_rustdoc = self.doc_tests != DocTests::No;
595+
594596
// Customize the compiler we're running. Specify the compiler to cargo
595597
// as our shim and then pass it some various options used to configure
596598
// how the actual compiler itself is called.
@@ -607,7 +609,7 @@ impl<'a> Builder<'a> {
607609
.env("RUSTC_LIBDIR", self.rustc_libdir(compiler))
608610
.env("RUSTC_RPATH", self.config.rust_rpath.to_string())
609611
.env("RUSTDOC", self.out.join("bootstrap/debug/rustdoc"))
610-
.env("RUSTDOC_REAL", if cmd == "doc" || cmd == "test" {
612+
.env("RUSTDOC_REAL", if cmd == "doc" || (cmd == "test" && want_rustdoc) {
611613
self.rustdoc(compiler.host)
612614
} else {
613615
PathBuf::from("/path/to/nowhere/rustdoc/not/required")
@@ -624,7 +626,7 @@ impl<'a> Builder<'a> {
624626
if let Some(ref error_format) = self.config.rustc_error_format {
625627
cargo.env("RUSTC_ERROR_FORMAT", error_format);
626628
}
627-
if cmd != "build" && cmd != "check" {
629+
if cmd != "build" && cmd != "check" && want_rustdoc {
628630
cargo.env("RUSTDOC_LIBDIR", self.rustc_libdir(self.compiler(2, self.config.build)));
629631
}
630632

@@ -706,6 +708,10 @@ impl<'a> Builder<'a> {
706708
cargo.env("RUSTC_PRINT_STEP_TIMINGS", "1");
707709
}
708710

711+
if self.config.backtrace_on_ice {
712+
cargo.env("RUSTC_BACKTRACE_ON_ICE", "1");
713+
}
714+
709715
cargo.env("RUSTC_VERBOSE", format!("{}", self.verbosity));
710716

711717
// in std, we want to avoid denying warnings for stage 0 as that makes cfg's painful.
@@ -1403,4 +1409,39 @@ mod __test {
14031409
},
14041410
]);
14051411
}
1412+
1413+
#[test]
1414+
fn test_with_no_doc_stage0() {
1415+
let mut config = configure(&[], &[]);
1416+
config.stage = Some(0);
1417+
config.cmd = Subcommand::Test {
1418+
paths: vec!["src/libstd".into()],
1419+
test_args: vec![],
1420+
rustc_args: vec![],
1421+
fail_fast: true,
1422+
doc_tests: DocTests::No,
1423+
};
1424+
1425+
let build = Build::new(config);
1426+
let mut builder = Builder::new(&build);
1427+
1428+
let host = INTERNER.intern_str("A");
1429+
1430+
builder.run_step_descriptions(
1431+
&[StepDescription::from::<test::Crate>()],
1432+
&["src/libstd".into()],
1433+
);
1434+
1435+
// Ensure we don't build any compiler artifacts.
1436+
assert!(builder.cache.all::<compile::Rustc>().is_empty());
1437+
assert_eq!(first(builder.cache.all::<test::Crate>()), &[
1438+
test::Crate {
1439+
compiler: Compiler { host, stage: 0 },
1440+
target: host,
1441+
mode: Mode::Libstd,
1442+
test_kind: test::TestKind::Test,
1443+
krate: INTERNER.intern_str("std"),
1444+
},
1445+
]);
1446+
}
14061447
}

src/bootstrap/config.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ pub struct Config {
7272
pub dry_run: bool,
7373

7474
pub deny_warnings: bool,
75+
pub backtrace_on_ice: bool,
7576

7677
// llvm codegen options
7778
pub llvm_enabled: bool,
@@ -306,6 +307,7 @@ struct Rust {
306307
wasm_syscall: Option<bool>,
307308
lld: Option<bool>,
308309
deny_warnings: Option<bool>,
310+
backtrace_on_ice: Option<bool>,
309311
}
310312

311313
/// TOML representation of how each build target is configured.
@@ -325,6 +327,14 @@ struct TomlTarget {
325327
}
326328

327329
impl Config {
330+
fn path_from_python(var_key: &str) -> PathBuf {
331+
match env::var_os(var_key) {
332+
// Do not trust paths from Python and normalize them slightly (#49785).
333+
Some(var_val) => Path::new(&var_val).components().collect(),
334+
_ => panic!("expected '{}' to be set", var_key),
335+
}
336+
}
337+
328338
pub fn default_opts() -> Config {
329339
let mut config = Config::default();
330340
config.llvm_enabled = true;
@@ -348,9 +358,9 @@ impl Config {
348358
config.deny_warnings = true;
349359

350360
// set by bootstrap.py
351-
config.src = env::var_os("SRC").map(PathBuf::from).expect("'SRC' to be set");
352361
config.build = INTERNER.intern_str(&env::var("BUILD").expect("'BUILD' to be set"));
353-
config.out = env::var_os("BUILD_DIR").map(PathBuf::from).expect("'BUILD_DIR' set");
362+
config.src = Config::path_from_python("SRC");
363+
config.out = Config::path_from_python("BUILD_DIR");
354364

355365
let stage0_root = config.out.join(&config.build).join("stage0/bin");
356366
config.initial_rustc = stage0_root.join(exe("rustc", &config.build));
@@ -523,6 +533,7 @@ impl Config {
523533
config.musl_root = rust.musl_root.clone().map(PathBuf::from);
524534
config.save_toolstates = rust.save_toolstates.clone().map(PathBuf::from);
525535
set(&mut config.deny_warnings, rust.deny_warnings.or(flags.warnings));
536+
set(&mut config.backtrace_on_ice, rust.backtrace_on_ice);
526537

527538
if let Some(ref backends) = rust.codegen_backends {
528539
config.rust_codegen_backends = backends.iter()

src/bootstrap/configure.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ def v(*args):
120120
"arm-unknown-linux-musleabi install directory")
121121
v("musl-root-armhf", "target.arm-unknown-linux-musleabihf.musl-root",
122122
"arm-unknown-linux-musleabihf install directory")
123+
v("musl-root-armv5te", "target.armv5te-unknown-linux-musleabi.musl-root",
124+
"armv5te-unknown-linux-musleabi install directory")
123125
v("musl-root-armv7", "target.armv7-unknown-linux-musleabihf.musl-root",
124126
"armv7-unknown-linux-musleabihf install directory")
125127
v("musl-root-aarch64", "target.aarch64-unknown-linux-musl.musl-root",

src/bootstrap/doc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ book!(
7171
Nomicon, "src/doc/nomicon", "nomicon";
7272
Reference, "src/doc/reference", "reference";
7373
Rustdoc, "src/doc/rustdoc", "rustdoc";
74+
RustcBook, "src/doc/rustc", "rustc";
7475
RustByExample, "src/doc/rust-by-example", "rust-by-example";
7576
);
7677

src/bootstrap/flags.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use std::process;
1919

2020
use getopts::Options;
2121

22-
use Build;
22+
use {Build, DocTests};
2323
use config::Config;
2424
use metadata;
2525
use builder::Builder;
@@ -62,7 +62,7 @@ pub enum Subcommand {
6262
test_args: Vec<String>,
6363
rustc_args: Vec<String>,
6464
fail_fast: bool,
65-
doc_tests: bool,
65+
doc_tests: DocTests,
6666
},
6767
Bench {
6868
paths: Vec<PathBuf>,
@@ -171,7 +171,8 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`");
171171
"extra options to pass the compiler when running tests",
172172
"ARGS",
173173
);
174-
opts.optflag("", "doc", "run doc tests");
174+
opts.optflag("", "no-doc", "do not run doc tests");
175+
opts.optflag("", "doc", "only run doc tests");
175176
},
176177
"bench" => { opts.optmulti("", "test-args", "extra arguments", "ARGS"); },
177178
"clean" => { opts.optflag("", "all", "clean all build artifacts"); },
@@ -324,7 +325,13 @@ Arguments:
324325
test_args: matches.opt_strs("test-args"),
325326
rustc_args: matches.opt_strs("rustc-args"),
326327
fail_fast: !matches.opt_present("no-fail-fast"),
327-
doc_tests: matches.opt_present("doc"),
328+
doc_tests: if matches.opt_present("doc") {
329+
DocTests::Only
330+
} else if matches.opt_present("no-doc") {
331+
DocTests::No
332+
} else {
333+
DocTests::Yes
334+
}
328335
}
329336
}
330337
"bench" => {
@@ -411,10 +418,10 @@ impl Subcommand {
411418
}
412419
}
413420

414-
pub fn doc_tests(&self) -> bool {
421+
pub fn doc_tests(&self) -> DocTests {
415422
match *self {
416423
Subcommand::Test { doc_tests, .. } => doc_tests,
417-
_ => false,
424+
_ => DocTests::Yes,
418425
}
419426
}
420427
}

src/bootstrap/job.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,10 @@ struct JOBOBJECT_BASIC_LIMIT_INFORMATION {
122122
}
123123

124124
pub unsafe fn setup(build: &mut Build) {
125-
// Tell Windows to not show any UI on errors (such as not finding a required dll
126-
// during startup or terminating abnormally). This is important for running tests,
127-
// since some of them use abnormal termination by design.
128-
// This mode is inherited by all child processes.
129-
let mode = SetErrorMode(SEM_NOGPFAULTERRORBOX); // read inherited flags
130-
SetErrorMode(mode | SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
125+
// Enable the Windows Error Reporting dialog which msys disables,
126+
// so we can JIT debug rustc
127+
let mode = SetErrorMode(0);
128+
SetErrorMode(mode & !SEM_NOGPFAULTERRORBOX);
131129

132130
// Create a new job object for us to use
133131
let job = CreateJobObjectW(0 as *mut _, 0 as *const _);

src/bootstrap/lib.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,16 @@ pub struct Compiler {
210210
host: Interned<String>,
211211
}
212212

213+
#[derive(PartialEq, Eq, Copy, Clone, Debug)]
214+
pub enum DocTests {
215+
// Default, run normal tests and doc tests.
216+
Yes,
217+
// Do not run any doc tests.
218+
No,
219+
// Only run doc tests.
220+
Only,
221+
}
222+
213223
/// Global configuration for the build system.
214224
///
215225
/// This structure transitively contains all configuration for the build system.
@@ -233,7 +243,7 @@ pub struct Build {
233243
rustfmt_info: channel::GitInfo,
234244
local_rebuild: bool,
235245
fail_fast: bool,
236-
doc_tests: bool,
246+
doc_tests: DocTests,
237247
verbosity: usize,
238248

239249
// Targets for which to build.
@@ -294,7 +304,7 @@ impl Crate {
294304
///
295305
/// These entries currently correspond to the various output directories of the
296306
/// build system, with each mod generating output in a different directory.
297-
#[derive(Debug, Hash, Clone, Copy, PartialEq, Eq)]
307+
#[derive(Debug, Hash, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
298308
pub enum Mode {
299309
/// Build the standard library, placing output in the "stageN-std" directory.
300310
Libstd,

src/bootstrap/test.rs

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ use dist;
3232
use native;
3333
use tool::{self, Tool};
3434
use util::{self, dylib_path, dylib_path_var};
35-
use Mode;
35+
use {Mode, DocTests};
3636
use toolstate::ToolState;
3737

3838
const ADB_TEST_DIR: &str = "/data/tmp/work";
3939

4040
/// The two modes of the test runner; tests or benchmarks.
41-
#[derive(Debug, PartialEq, Eq, Hash, Copy, Clone)]
41+
#[derive(Debug, PartialEq, Eq, Hash, Copy, Clone, PartialOrd, Ord)]
4242
pub enum TestKind {
4343
/// Run `cargo test`
4444
Test,
@@ -1212,6 +1212,7 @@ test_book!(
12121212
Nomicon, "src/doc/nomicon", "nomicon", default=false;
12131213
Reference, "src/doc/reference", "reference", default=false;
12141214
RustdocBook, "src/doc/rustdoc", "rustdoc", default=true;
1215+
RustcBook, "src/doc/rustc", "rustc", default=true;
12151216
RustByExample, "src/doc/rust-by-example", "rust-by-example", default=false;
12161217
TheBook, "src/doc/book", "book", default=false;
12171218
UnstableBook, "src/doc/unstable-book", "unstable-book", default=true;
@@ -1406,13 +1407,13 @@ impl Step for CrateNotDefault {
14061407
}
14071408

14081409

1409-
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
1410+
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
14101411
pub struct Crate {
1411-
compiler: Compiler,
1412-
target: Interned<String>,
1413-
mode: Mode,
1414-
test_kind: TestKind,
1415-
krate: Interned<String>,
1412+
pub compiler: Compiler,
1413+
pub target: Interned<String>,
1414+
pub mode: Mode,
1415+
pub test_kind: TestKind,
1416+
pub krate: Interned<String>,
14161417
}
14171418

14181419
impl Step for Crate {
@@ -1518,8 +1519,14 @@ impl Step for Crate {
15181519
if test_kind.subcommand() == "test" && !builder.fail_fast {
15191520
cargo.arg("--no-fail-fast");
15201521
}
1521-
if builder.doc_tests {
1522-
cargo.arg("--doc");
1522+
match builder.doc_tests {
1523+
DocTests::Only => {
1524+
cargo.arg("--doc");
1525+
}
1526+
DocTests::No => {
1527+
cargo.args(&["--lib", "--bins", "--examples", "--tests", "--benches"]);
1528+
}
1529+
DocTests::Yes => {}
15231530
}
15241531

15251532
cargo.arg("-p").arg(krate);

0 commit comments

Comments
 (0)