Rustup to rustc 1.45.0-nightly (46e85b432 2020-05-24)

This commit is contained in:
bjorn3 2020-05-18 11:35:23 +02:00
parent 2e5282f929
commit bcd357a0ae
15 changed files with 335 additions and 48 deletions

2
.gitignore vendored
View File

@ -8,7 +8,5 @@ perf.data.old
*.string*
/build_sysroot/sysroot
/build_sysroot/sysroot_src
/build_sysroot/Cargo.lock
/build_sysroot/test_target/Cargo.lock
/rust
/regex

290
build_sysroot/Cargo.lock generated Normal file
View File

@ -0,0 +1,290 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "alloc"
version = "0.0.0"
dependencies = [
"compiler_builtins",
"core",
]
[[package]]
name = "alloc_system"
version = "0.0.0"
dependencies = [
"compiler_builtins",
"core",
"libc",
]
[[package]]
name = "autocfg"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2"
[[package]]
name = "backtrace"
version = "0.3.48"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0df2f85c8a2abbe3b7d7e748052fdd9b76a0458fdeb16ad4223f5eca78c7c130"
dependencies = [
"backtrace-sys",
"cfg-if",
"compiler_builtins",
"libc",
"rustc-demangle",
"rustc-std-workspace-core",
]
[[package]]
name = "backtrace-sys"
version = "0.1.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "18fbebbe1c9d1f383a9cc7e8ccdb471b91c8d024ee9c2ca5b5346121fe8b4399"
dependencies = [
"cc",
"compiler_builtins",
"libc",
"rustc-std-workspace-core",
]
[[package]]
name = "cc"
version = "1.0.54"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7bbb73db36c1246e9034e307d0fba23f9a2e251faa47ade70c1bd252220c8311"
[[package]]
name = "cfg-if"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
dependencies = [
"compiler_builtins",
"rustc-std-workspace-core",
]
[[package]]
name = "compiler_builtins"
version = "0.1.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "439a6fab343b1dab347823537734a5cd4ae6ae2000b465ab886f64cdb723bd14"
dependencies = [
"rustc-std-workspace-core",
]
[[package]]
name = "core"
version = "0.0.0"
[[package]]
name = "dlmalloc"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35055b1021724f4eb5262eb49130eebff23fc59fc5a14160e05faad8eeb36673"
dependencies = [
"compiler_builtins",
"libc",
"rustc-std-workspace-core",
]
[[package]]
name = "fortanix-sgx-abi"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c56c422ef86062869b2d57ae87270608dc5929969dd130a6e248979cf4fb6ca6"
dependencies = [
"compiler_builtins",
"rustc-std-workspace-core",
]
[[package]]
name = "getopts"
version = "0.2.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5"
dependencies = [
"rustc-std-workspace-core",
"rustc-std-workspace-std",
"unicode-width",
]
[[package]]
name = "hashbrown"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e6073d0ca812575946eb5f35ff68dbe519907b25c42530389ff946dc84c6ead"
dependencies = [
"autocfg",
"compiler_builtins",
"rustc-std-workspace-alloc",
"rustc-std-workspace-core",
]
[[package]]
name = "hermit-abi"
version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91780f809e750b0a89f5544be56617ff6b1227ee485bcb06ebe10cdf89bd3b71"
dependencies = [
"compiler_builtins",
"libc",
"rustc-std-workspace-core",
]
[[package]]
name = "libc"
version = "0.2.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99e85c08494b21a9054e7fe1374a732aeadaff3980b6990b94bfd3a70f690005"
dependencies = [
"rustc-std-workspace-core",
]
[[package]]
name = "panic_abort"
version = "0.0.0"
dependencies = [
"compiler_builtins",
"core",
"libc",
]
[[package]]
name = "panic_unwind"
version = "0.0.0"
dependencies = [
"alloc",
"cfg-if",
"compiler_builtins",
"core",
"libc",
"unwind",
]
[[package]]
name = "proc_macro"
version = "0.0.0"
dependencies = [
"std",
]
[[package]]
name = "rustc-demangle"
version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783"
dependencies = [
"compiler_builtins",
"rustc-std-workspace-core",
]
[[package]]
name = "rustc-std-workspace-alloc"
version = "1.99.0"
dependencies = [
"alloc",
]
[[package]]
name = "rustc-std-workspace-core"
version = "1.99.0"
dependencies = [
"core",
]
[[package]]
name = "rustc-std-workspace-std"
version = "1.99.0"
dependencies = [
"std",
]
[[package]]
name = "std"
version = "0.0.0"
dependencies = [
"alloc",
"backtrace",
"cfg-if",
"compiler_builtins",
"core",
"dlmalloc",
"fortanix-sgx-abi",
"hashbrown",
"hermit-abi",
"libc",
"panic_abort",
"panic_unwind",
"unwind",
"wasi",
]
[[package]]
name = "sysroot"
version = "0.0.0"
dependencies = [
"alloc",
"alloc_system",
"compiler_builtins",
"core",
"libc",
"std",
"test",
]
[[package]]
name = "term"
version = "0.0.0"
dependencies = [
"core",
"std",
]
[[package]]
name = "test"
version = "0.0.0"
dependencies = [
"core",
"getopts",
"libc",
"panic_abort",
"panic_unwind",
"proc_macro",
"std",
"term",
]
[[package]]
name = "unicode-width"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479"
dependencies = [
"compiler_builtins",
"rustc-std-workspace-core",
"rustc-std-workspace-std",
]
[[package]]
name = "unwind"
version = "0.0.0"
dependencies = [
"cc",
"cfg-if",
"compiler_builtins",
"core",
"libc",
]
[[package]]
name = "wasi"
version = "0.9.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
dependencies = [
"compiler_builtins",
"rustc-std-workspace-alloc",
"rustc-std-workspace-core",
]

View File

@ -12,6 +12,8 @@ test = { path = "./sysroot_src/src/libtest" }
alloc_system = { path = "./alloc_system" }
libc = { version = "=0.2.69", default-features = false } # FIXME rustc 1.45.0-nightly (7ebd87a7a 2020-05-08) ices on libc 0.2.70
[patch.crates-io]
rustc-std-workspace-core = { path = "./sysroot_src/src/tools/rustc-std-workspace-core" }
rustc-std-workspace-alloc = { path = "./sysroot_src/src/tools/rustc-std-workspace-alloc" }

View File

@ -12,7 +12,6 @@ popd >/dev/null
# Cleanup for previous run
# v Clean target dir except for build scripts and incremental cache
rm -r target/*/{debug,release}/{build,deps,examples,libsysroot*,native} || true
rm Cargo.lock test_target/Cargo.lock 2>/dev/null || true
rm -r sysroot/ 2>/dev/null || true
# Build libs

View File

@ -1,5 +1,5 @@
#!/bin/bash --verbose
set -e
rm -rf target/ build_sysroot/{sysroot/,sysroot_src/,target/,Cargo.lock} perf.data{,.old}
rm -rf target/ build_sysroot/{sysroot/,sysroot_src/,target/} perf.data{,.old}
rm -rf regex/ simple-raytracer/

View File

@ -1,7 +1,7 @@
#!/bin/bash --verbose
set -e
rustup component add rust-src rustc-dev
rustup component add rust-src rustc-dev llvm-tools-preview
./build_sysroot/prepare_sysroot_src.sh
cargo install hyperfine || echo "Skipping hyperfine install"

View File

@ -1 +1 @@
nightly-2020-05-09
nightly-2020-05-25

View File

@ -17,9 +17,12 @@ case $1 in
./clean_all.sh
./prepare.sh
(cd build_sysroot && cargo update)
;;
"commit")
git add rust-toolchain
git add rust-toolchain build_sysroot/Cargo.lock
git commit -m "Rustup to $(rustc -V)"
;;
*)

View File

@ -94,7 +94,7 @@ impl<'a> ArchiveBuilder<'a> for ArArchiveBuilder<'a> {
));
}
fn add_native_library(&mut self, name: rustc_ast::ast::Name) {
fn add_native_library(&mut self, name: rustc_span::symbol::Symbol) {
let location = find_library(name, &self.config.lib_search_paths, self.config.sess);
self.add_archive(location.clone(), |_| false)
.unwrap_or_else(|e| {

View File

@ -305,6 +305,28 @@ fn codegen_fn_content(fx: &mut FunctionCx<'_, '_, impl Backend>) {
*destination,
));
}
TerminatorKind::InlineAsm {
template,
operands,
options: _,
destination,
} => {
match template {
&[] => {
assert_eq!(operands, &[]);
match *destination {
Some(destination) => {
let destination_block = fx.get_block(destination);
fx.bcx.ins().jump(destination_block, &[]);
}
None => bug!(),
}
// Black box
}
_ => unimpl_fatal!(fx.tcx, bb_data.terminator().source_info.span, "Inline assembly is not supported"),
}
}
TerminatorKind::Resume | TerminatorKind::Abort => {
trap_unreachable(fx, "[corruption] Unwinding bb reached.");
}
@ -615,7 +637,7 @@ fn trans_stmt<'tcx>(
| StatementKind::AscribeUserType(..) => {}
StatementKind::LlvmInlineAsm(asm) => {
use rustc_ast::ast::Name;
use rustc_span::symbol::Symbol;
let LlvmInlineAsm {
asm,
outputs: _,
@ -632,37 +654,14 @@ fn trans_stmt<'tcx>(
asm_str_style: _,
} = asm;
match &*asm_code.as_str() {
"" => {
assert_eq!(inputs, &[Name::intern("r")]);
assert!(outputs.is_empty(), "{:?}", outputs);
// Black box
}
"cpuid" | "cpuid\n" => {
assert_eq!(inputs, &[Name::intern("{eax}"), Name::intern("{ecx}")]);
assert_eq!(outputs.len(), 4);
for (i, c) in (&["={eax}", "={ebx}", "={ecx}", "={edx}"])
.iter()
.enumerate()
{
assert_eq!(&outputs[i].constraint.as_str(), c);
assert!(!outputs[i].is_rw);
assert!(!outputs[i].is_indirect);
}
assert_eq!(clobbers, &[Name::intern("rbx")]);
assert!(!volatile);
assert!(!alignstack);
cpuid if cpuid.contains("cpuid") => {
crate::trap::trap_unimplemented(
fx,
"__cpuid_count arch intrinsic is not supported",
);
}
"xgetbv" => {
assert_eq!(inputs, &[Name::intern("{ecx}")]);
assert_eq!(inputs, &[Symbol::intern("{ecx}")]);
assert_eq!(outputs.len(), 2);
for (i, c) in (&["={eax}", "={edx}"]).iter().enumerate() {

View File

@ -111,7 +111,7 @@ pub(crate) fn trans_const_value<'tcx>(
return CValue::const_val(fx, layout, data);
}
Scalar::Ptr(ptr) => {
let alloc_kind = fx.tcx.alloc_map.lock().get(ptr.alloc_id);
let alloc_kind = fx.tcx.get_global_alloc(ptr.alloc_id);
let base_addr = match alloc_kind {
Some(GlobalAlloc::Memory(alloc)) => {
fx.constants_cx.todo.push(TodoItem::Alloc(ptr.alloc_id));
@ -163,7 +163,7 @@ fn pointer_for_allocation<'tcx>(
fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
alloc: &'tcx Allocation,
) -> crate::pointer::Pointer {
let alloc_id = fx.tcx.alloc_map.lock().create_memory_alloc(alloc);
let alloc_id = fx.tcx.create_memory_alloc(alloc);
fx.constants_cx.todo.push(TodoItem::Alloc(alloc_id));
let data_id = data_id_for_alloc_id(fx.module, alloc_id, alloc.align);
@ -260,7 +260,7 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut Module<impl Backend>, cx: &mu
let (data_id, alloc) = match todo_item {
TodoItem::Alloc(alloc_id) => {
//println!("alloc_id {}", alloc_id);
let alloc = match tcx.alloc_map.lock().get(alloc_id).unwrap() {
let alloc = match tcx.get_global_alloc(alloc_id).unwrap() {
GlobalAlloc::Memory(alloc) => alloc,
GlobalAlloc::Function(_) | GlobalAlloc::Static(_) => unreachable!(),
};
@ -314,11 +314,7 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut Module<impl Backend>, cx: &mu
read_target_uint(endianness, bytes).unwrap()
};
// Don't inline `reloc_target_alloc` into the match. That would cause `tcx.alloc_map`
// to be locked for the duration of the match. `data_id_for_static` however may try
// to lock `tcx.alloc_map` itself while calculating the layout of the target static.
// This would cause a panic in single threaded rustc and a deadlock for parallel rustc.
let reloc_target_alloc = tcx.alloc_map.lock().get(reloc).unwrap();
let reloc_target_alloc = tcx.get_global_alloc(reloc).unwrap();
let data_id = match reloc_target_alloc {
GlobalAlloc::Function(instance) => {
assert_eq!(addend, 0);

View File

@ -54,10 +54,10 @@ fn emit_module<B: Backend>(
let work_product = if std::env::var("CG_CLIF_INCR_CACHE_DISABLED").is_ok() {
None
} else {
rustc_incremental::copy_cgu_workproducts_to_incr_comp_cache_dir(
rustc_incremental::copy_cgu_workproduct_to_incr_comp_cache_dir(
tcx.sess,
&name,
&[tmp_file.clone()],
&Some(tmp_file.clone()),
)
};
@ -80,7 +80,7 @@ fn reuse_workproduct_for_cgu(
let incr_comp_session_dir = tcx.sess.incr_comp_session_dir();
let mut object = None;
let work_product = cgu.work_product(tcx);
for saved_file in &work_product.saved_files {
if let Some(saved_file) = &work_product.saved_file {
let obj_out = tcx.output_filenames(LOCAL_CRATE).temp_path(OutputType::Object, Some(&cgu.name().as_str()));
object = Some(obj_out.clone());
let source_file = rustc_incremental::in_incr_comp_dir(&incr_comp_session_dir, &saved_file);

View File

@ -17,7 +17,7 @@ pub(crate) fn codegen_crate(
tcx.sess.abort_if_errors();
if std::env::var("CG_CLIF_JIT").is_ok()
&& tcx.sess.crate_types.get().contains(&rustc_session::config::CrateType::Executable)
&& tcx.sess.crate_types().contains(&rustc_session::config::CrateType::Executable)
{
#[cfg(not(target_arch = "wasm32"))]
let _: ! = jit::run_jit(tcx);

View File

@ -517,6 +517,7 @@ pub(crate) fn codegen_intrinsic_call<'tcx>(
_ if intrinsic.starts_with("unchecked_") || intrinsic == "exact_div", (c x, c y) {
// FIXME trap on overflow
let bin_op = match intrinsic {
"unchecked_add" => BinOp::Add,
"unchecked_sub" => BinOp::Sub,
"unchecked_div" | "exact_div" => BinOp::Div,
"unchecked_rem" => BinOp::Rem,

View File

@ -73,8 +73,7 @@ pub(crate) fn write_metadata<P: WriteMetadata>(tcx: TyCtxt<'_>, product: &mut P)
let kind = tcx
.sess
.crate_types
.borrow()
.crate_types()
.iter()
.map(|ty| match *ty {
config::CrateType::Executable