Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Rollup of 8 pull requests #63583

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
5e6619e
Fix UWP build
mfkl Jul 31, 2019
54e268c
Fix README MSVC URI
mfkl Jul 31, 2019
6e4d023
Add UWP MSVC targets
mfkl Jul 31, 2019
3c6f6f0
Fix tidy checks
mfkl Jul 31, 2019
e3d8b68
review feedback: find lib root path from registry
mfkl Aug 5, 2019
89044a9
move store lib probing code to librustc_codegen_ssa
mfkl Aug 7, 2019
30fcd50
rustc_target: add n64 musl targets for MIPS64 arches
xen0n Jul 28, 2019
5124f34
Update RLS
Xanewok Aug 12, 2019
532008c
don't add Retag statements for compound types
RalfJung Aug 4, 2019
b122be4
test Retag in drop shim
RalfJung Aug 5, 2019
c9da160
review feedback: move uwp link code to get_linker
mfkl Aug 9, 2019
1581c43
review feedback: add comments and use local flavor variable
mfkl Aug 13, 2019
417f9ea
Utilize -Zbinary-dep-depinfo for dependency tracking
Mark-Simulacrum Aug 11, 2019
c1758d5
rustc_codegen_utils: account for 1-indexed anonymous lifetimes in v0 …
eddyb Aug 14, 2019
ed7317c
remove unused Level::PhaseFatal
matklad Aug 14, 2019
e5017de
Test HRTB issue accepted by compiler
meffij Aug 14, 2019
f56b8e1
Rollup merge of #63155 - mfkl:uwp-msvc, r=alexcrichton
Centril Aug 15, 2019
83939a5
Rollup merge of #63165 - xen0n:mips64-musl-targets, r=alexcrichton
Centril Aug 15, 2019
9d6fe7e
Rollup merge of #63306 - RalfJung:retag, r=varkor
Centril Aug 15, 2019
aed1c82
Rollup merge of #63470 - Mark-Simulacrum:rustc-depdep, r=alexcrichton
Centril Aug 15, 2019
29dec6e
Rollup merge of #63491 - Xanewok:update-rls, r=Mark-Simulacrum
Centril Aug 15, 2019
8985e06
Rollup merge of #63559 - eddyb:v0-mangling-off-by-1, r=estebank
Centril Aug 15, 2019
adcb9f6
Rollup merge of #63572 - matklad:no-phase-fatal, r=estebank
Centril Aug 15, 2019
2faf7f9
Rollup merge of #63577 - meffij:test-hrtb, r=alexcrichton
Centril Aug 15, 2019
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ then you may need to force rustbuild to use an older version. This can be done
by manually calling the appropriate vcvars file before running the bootstrap.

```batch
> CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
> CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
> python x.py build
```

Expand Down
87 changes: 22 additions & 65 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -754,76 +754,20 @@ impl<'a> Builder<'a> {
let mut cargo = Command::new(&self.initial_cargo);
let out_dir = self.stage_out(compiler, mode);

// command specific path, we call clear_if_dirty with this
let mut my_out = match cmd {
"build" => self.cargo_out(compiler, mode, target),

// This is the intended out directory for crate documentation.
"doc" | "rustdoc" => self.crate_doc_out(target),

_ => self.stage_out(compiler, mode),
};

// This is for the original compiler, but if we're forced to use stage 1, then
// std/test/rustc stamps won't exist in stage 2, so we need to get those from stage 1, since
// we copy the libs forward.
let cmp = self.compiler_for(compiler.stage, compiler.host, target);

let libstd_stamp = match cmd {
"check" | "clippy" | "fix" => check::libstd_stamp(self, cmp, target),
_ => compile::libstd_stamp(self, cmp, target),
};

let libtest_stamp = match cmd {
"check" | "clippy" | "fix" => check::libtest_stamp(self, cmp, target),
_ => compile::libtest_stamp(self, cmp, target),
};

let librustc_stamp = match cmd {
"check" | "clippy" | "fix" => check::librustc_stamp(self, cmp, target),
_ => compile::librustc_stamp(self, cmp, target),
};
// Codegen backends are not yet tracked by -Zbinary-dep-depinfo,
// so we need to explicitly clear out if they've been updated.
for backend in self.codegen_backends(compiler) {
self.clear_if_dirty(&out_dir, &backend);
}

if cmd == "doc" || cmd == "rustdoc" {
if mode == Mode::Rustc || mode == Mode::ToolRustc || mode == Mode::Codegen {
let my_out = match mode {
// This is the intended out directory for compiler documentation.
my_out = self.compiler_doc_out(target);
}
Mode::Rustc | Mode::ToolRustc | Mode::Codegen => self.compiler_doc_out(target),
_ => self.crate_doc_out(target),
};
let rustdoc = self.rustdoc(compiler);
self.clear_if_dirty(&my_out, &rustdoc);
} else if cmd != "test" {
match mode {
Mode::Std => {
self.clear_if_dirty(&my_out, &self.rustc(compiler));
for backend in self.codegen_backends(compiler) {
self.clear_if_dirty(&my_out, &backend);
}
},
Mode::Test => {
self.clear_if_dirty(&my_out, &libstd_stamp);
},
Mode::Rustc => {
self.clear_if_dirty(&my_out, &self.rustc(compiler));
self.clear_if_dirty(&my_out, &libstd_stamp);
self.clear_if_dirty(&my_out, &libtest_stamp);
},
Mode::Codegen => {
self.clear_if_dirty(&my_out, &librustc_stamp);
},
Mode::ToolBootstrap => { },
Mode::ToolStd => {
self.clear_if_dirty(&my_out, &libstd_stamp);
},
Mode::ToolTest => {
self.clear_if_dirty(&my_out, &libstd_stamp);
self.clear_if_dirty(&my_out, &libtest_stamp);
},
Mode::ToolRustc => {
self.clear_if_dirty(&my_out, &libstd_stamp);
self.clear_if_dirty(&my_out, &libtest_stamp);
self.clear_if_dirty(&my_out, &librustc_stamp);
},
}
}

cargo
Expand Down Expand Up @@ -861,6 +805,19 @@ impl<'a> Builder<'a> {
},
}

// This tells Cargo (and in turn, rustc) to output more complete
// dependency information. Most importantly for rustbuild, this
// includes sysroot artifacts, like libstd, which means that we don't
// need to track those in rustbuild (an error prone process!). This
// feature is currently unstable as there may be some bugs and such, but
// it represents a big improvement in rustbuild's reliability on
// rebuilds, so we're using it here.
//
// For some additional context, see #63470 (the PR originally adding
// this), as well as #63012 which is the tracking issue for this
// feature on the rustc side.
cargo.arg("-Zbinary-dep-depinfo");

cargo.arg("-j").arg(self.jobs().to_string());
// Remove make-related flags to ensure Cargo can correctly set things up
cargo.env_remove("MAKEFLAGS");
Expand Down
1 change: 0 additions & 1 deletion src/bootstrap/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ impl Step for Rustdoc {
let libdir = builder.sysroot_libdir(compiler, target);
let hostdir = builder.sysroot_libdir(compiler, compiler.host);
add_to_sysroot(&builder, &libdir, &hostdir, &rustdoc_stamp(builder, compiler, target));
builder.cargo(compiler, Mode::ToolRustc, target, "clean");
}
}

Expand Down
35 changes: 1 addition & 34 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use std::path::{Path, PathBuf};
use std::process::{Command, Stdio, exit};
use std::str;

use build_helper::{output, mtime, t, up_to_date};
use build_helper::{output, t, up_to_date};
use filetime::FileTime;
use serde::Deserialize;
use serde_json;
Expand Down Expand Up @@ -274,8 +274,6 @@ impl Step for StdLink {
// for reason why the sanitizers are not built in stage0.
copy_apple_sanitizer_dylibs(builder, &builder.native_dir(target), "osx", &libdir);
}

builder.cargo(target_compiler, Mode::ToolStd, target, "clean");
}
}

Expand Down Expand Up @@ -480,8 +478,6 @@ impl Step for TestLink {
&builder.sysroot_libdir(target_compiler, compiler.host),
&libtest_stamp(builder, compiler, target)
);

builder.cargo(target_compiler, Mode::ToolTest, target, "clean");
}
}

Expand Down Expand Up @@ -639,7 +635,6 @@ impl Step for RustcLink {
&builder.sysroot_libdir(target_compiler, compiler.host),
&librustc_stamp(builder, compiler, target)
);
builder.cargo(target_compiler, Mode::ToolRustc, target, "clean");
}
}

Expand Down Expand Up @@ -1202,41 +1197,13 @@ pub fn run_cargo(builder: &Builder<'_>,
deps.push((path_to_add.into(), false));
}

// Now we want to update the contents of the stamp file, if necessary. First
// we read off the previous contents along with its mtime. If our new
// contents (the list of files to copy) is different or if any dep's mtime
// is newer then we rewrite the stamp file.
deps.sort();
let stamp_contents = fs::read(stamp);
let stamp_mtime = mtime(&stamp);
let mut new_contents = Vec::new();
let mut max = None;
let mut max_path = None;
for (dep, proc_macro) in deps.iter() {
let mtime = mtime(dep);
if Some(mtime) > max {
max = Some(mtime);
max_path = Some(dep.clone());
}
new_contents.extend(if *proc_macro { b"h" } else { b"t" });
new_contents.extend(dep.to_str().unwrap().as_bytes());
new_contents.extend(b"\0");
}
let max = max.unwrap();
let max_path = max_path.unwrap();
let contents_equal = stamp_contents
.map(|contents| contents == new_contents)
.unwrap_or_default();
if contents_equal && max <= stamp_mtime {
builder.verbose(&format!("not updating {:?}; contents equal and {:?} <= {:?}",
stamp, max, stamp_mtime));
return deps.into_iter().map(|(d, _)| d).collect()
}
if max > stamp_mtime {
builder.verbose(&format!("updating {:?} as {:?} changed", stamp, max_path));
} else {
builder.verbose(&format!("updating {:?} as deps changed", stamp));
}
t!(fs::write(&stamp, &new_contents));
deps.into_iter().map(|(d, _)| d).collect()
}
Expand Down
32 changes: 32 additions & 0 deletions src/librustc_codegen_ssa/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ use std::path::{Path, PathBuf};
use std::process::{Output, Stdio, ExitStatus};
use std::str;
use std::env;
use std::ffi::OsString;

pub use rustc_codegen_utils::link::*;

Expand Down Expand Up @@ -158,6 +159,36 @@ pub fn get_linker(sess: &Session, linker: &Path, flavor: LinkerFlavor) -> (PathB
}
};

// UWP apps have API restrictions enforced during Store submissions.
// To comply with the Windows App Certification Kit,
// MSVC needs to link with the Store versions of the runtime libraries (vcruntime, msvcrt, etc).
let t = &sess.target.target;
if flavor == LinkerFlavor::Msvc && t.target_vendor == "uwp" {
if let Some(ref tool) = msvc_tool {
let original_path = tool.path();
if let Some(ref root_lib_path) = original_path.ancestors().skip(4).next() {
let arch = match t.arch.as_str() {
"x86_64" => Some("x64".to_string()),
"x86" => Some("x86".to_string()),
"aarch64" => Some("arm64".to_string()),
_ => None,
};
if let Some(ref a) = arch {
let mut arg = OsString::from("/LIBPATH:");
arg.push(format!("{}\\lib\\{}\\store", root_lib_path.display(), a.to_string()));
cmd.arg(&arg);
}
else {
warn!("arch is not supported");
}
} else {
warn!("MSVC root path lib location not found");
}
} else {
warn!("link.exe not found");
}
}

// The compiler's sysroot often has some bundled tools, so add it to the
// PATH for the child.
let mut new_path = sess.host_filesearch(PathKind::All)
Expand Down Expand Up @@ -1027,6 +1058,7 @@ fn link_args<'a, B: ArchiveBuilder<'a>>(cmd: &mut dyn Linker,
let t = &sess.target.target;

cmd.include_path(&fix_windows_verbatim_for_gcc(&lib_path));

for obj in codegen_results.modules.iter().filter_map(|m| m.object.as_ref()) {
cmd.add_object(obj);
}
Expand Down
12 changes: 10 additions & 2 deletions src/librustc_codegen_utils/symbol_names/v0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,14 @@ impl SymbolMangler<'tcx> {

let lifetimes = regions.into_iter().map(|br| {
match br {
ty::BrAnon(i) => i + 1,
ty::BrAnon(i) => {
// FIXME(eddyb) for some reason, `anonymize_late_bound_regions` starts at `1`.
assert_ne!(i, 0);
i - 1
},
_ => bug!("symbol_names: non-anonymized region `{:?}` in `{:?}`", br, value),
}
}).max().unwrap_or(0);
}).max().map_or(0, |max| max + 1);

self.push_opt_integer_62("G", lifetimes as u64);
lifetime_depths.end += lifetimes;
Expand Down Expand Up @@ -297,6 +301,10 @@ impl Printer<'tcx> for SymbolMangler<'tcx> {
// Late-bound lifetimes use indices starting at 1,
// see `BinderLevel` for more details.
ty::ReLateBound(debruijn, ty::BrAnon(i)) => {
// FIXME(eddyb) for some reason, `anonymize_late_bound_regions` starts at `1`.
assert_ne!(i, 0);
let i = i - 1;

let binder = &self.binders[self.binders.len() - 1 - debruijn.index()];
let depth = binder.lifetime_depths.start + i;

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_errors/annotate_snippet_emitter_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ impl<'a> DiagnosticConverter<'a> {
/// Maps `Diagnostic::Level` to `snippet::AnnotationType`
fn annotation_type_for_level(level: Level) -> AnnotationType {
match level {
Level::Bug | Level::Fatal | Level::PhaseFatal | Level::Error => AnnotationType::Error,
Level::Bug | Level::Fatal | Level::Error => AnnotationType::Error,
Level::Warning => AnnotationType::Warning,
Level::Note => AnnotationType::Note,
Level::Help => AnnotationType::Help,
Expand Down
1 change: 0 additions & 1 deletion src/librustc_errors/diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ impl Diagnostic {
match self.level {
Level::Bug |
Level::Fatal |
Level::PhaseFatal |
Level::Error |
Level::FailureNote => {
true
Expand Down
7 changes: 2 additions & 5 deletions src/librustc_errors/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -787,9 +787,6 @@ impl Handler {
pub enum Level {
Bug,
Fatal,
// An error which while not immediately fatal, should stop the compiler
// progressing beyond the current phase.
PhaseFatal,
Error,
Warning,
Note,
Expand All @@ -808,7 +805,7 @@ impl Level {
fn color(self) -> ColorSpec {
let mut spec = ColorSpec::new();
match self {
Bug | Fatal | PhaseFatal | Error => {
Bug | Fatal | Error => {
spec.set_fg(Some(Color::Red))
.set_intense(true);
}
Expand All @@ -833,7 +830,7 @@ impl Level {
pub fn to_str(self) -> &'static str {
match self {
Bug => "error: internal compiler error",
Fatal | PhaseFatal | Error => "error",
Fatal | Error => "error",
Warning => "warning",
Note => "note",
Help => "help",
Expand Down
22 changes: 9 additions & 13 deletions src/librustc_mir/transform/add_retag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ fn is_stable(
}
}

/// Determine whether this type may have a reference in it, recursing below compound types but
/// not below references.
fn may_have_reference<'tcx>(ty: Ty<'tcx>, tcx: TyCtxt<'tcx>) -> bool {
/// Determine whether this type may be a reference (or box), and thus needs retagging.
fn may_be_reference<'tcx>(ty: Ty<'tcx>) -> bool {
match ty.sty {
// Primitive types that are not references
ty::Bool | ty::Char |
Expand All @@ -55,15 +54,12 @@ fn may_have_reference<'tcx>(ty: Ty<'tcx>, tcx: TyCtxt<'tcx>) -> bool {
// References
ty::Ref(..) => true,
ty::Adt(..) if ty.is_box() => true,
// Compound types
ty::Array(ty, ..) | ty::Slice(ty) =>
may_have_reference(ty, tcx),
ty::Tuple(tys) =>
tys.iter().any(|ty| may_have_reference(ty.expect_ty(), tcx)),
ty::Adt(adt, substs) =>
adt.variants.iter().any(|v| v.fields.iter().any(|f|
may_have_reference(f.ty(tcx, substs), tcx)
)),
// Compound types are not references
ty::Array(..) |
ty::Slice(..) |
ty::Tuple(..) |
ty::Adt(..) =>
false,
// Conservative fallback
_ => true,
}
Expand All @@ -80,7 +76,7 @@ impl MirPass for AddRetag {
// FIXME: Instead of giving up for unstable places, we should introduce
// a temporary and retag on that.
is_stable(place.as_ref())
&& may_have_reference(place.ty(&*local_decls, tcx).ty, tcx)
&& may_be_reference(place.ty(&*local_decls, tcx).ty)
};

// PART 1
Expand Down
24 changes: 24 additions & 0 deletions src/librustc_target/spec/aarch64_uwp_windows_msvc.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
use crate::spec::{LinkerFlavor, Target, TargetResult, PanicStrategy};

pub fn target() -> TargetResult {
let mut base = super::windows_uwp_msvc_base::opts();
base.max_atomic_width = Some(64);
base.has_elf_tls = true;

// FIXME: this shouldn't be panic=abort, it should be panic=unwind
base.panic_strategy = PanicStrategy::Abort;

Ok(Target {
llvm_target: "aarch64-pc-windows-msvc".to_string(),
target_endian: "little".to_string(),
target_pointer_width: "64".to_string(),
target_c_int_width: "32".to_string(),
data_layout: "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(),
target_os: "windows".to_string(),
target_env: "msvc".to_string(),
target_vendor: "uwp".to_string(),
linker_flavor: LinkerFlavor::Msvc,
options: base,
})
}
Loading