diff options
| author | bjorn3 <bjorn3@users.noreply.github.com> | 2021-06-30 21:21:06 +0200 |
|---|---|---|
| committer | bjorn3 <bjorn3@users.noreply.github.com> | 2021-06-30 21:21:06 +0200 |
| commit | 4cbba98420b27af2c56df1878ff1992c7993a7bc (patch) | |
| tree | 7ed325dca7563bfec0fdc29d3a143996288adb84 | |
| parent | 3ec2b444b17793d3eff0343b478cf205bce4b9dc (diff) | |
| download | rust-4cbba98420b27af2c56df1878ff1992c7993a7bc.tar.gz rust-4cbba98420b27af2c56df1878ff1992c7993a7bc.zip | |
Rustup to rustc 1.55.0-nightly (6d820866a 2021-06-29)
| -rw-r--r-- | build_sysroot/Cargo.lock | 10 | ||||
| -rw-r--r-- | build_system/prepare.rs | 2 | ||||
| -rw-r--r-- | rust-toolchain | 2 | ||||
| -rw-r--r-- | src/base.rs | 6 | ||||
| -rw-r--r-- | src/common.rs | 1 | ||||
| -rw-r--r-- | src/lib.rs | 10 | ||||
| -rw-r--r-- | src/vtable.rs | 16 |
7 files changed, 18 insertions, 29 deletions
diff --git a/build_sysroot/Cargo.lock b/build_sysroot/Cargo.lock index bcf692f1dc6..46f661107e7 100644 --- a/build_sysroot/Cargo.lock +++ b/build_sysroot/Cargo.lock @@ -56,7 +56,7 @@ dependencies = [ [[package]] name = "compiler_builtins" -version = "0.1.45" +version = "0.1.46" dependencies = [ "rustc-std-workspace-core", ] @@ -121,9 +121,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.1.18" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" dependencies = [ "compiler_builtins", "libc", @@ -195,9 +195,9 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.19" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "410f7acf3cb3a44527c5d9546bad4bf4e6c460915d5f9f2fc524498bfe8f70ce" +checksum = "dead70b0b5e03e9c814bcb6b01e03e68f7c57a80aa48c72ec92152ab3e818d49" dependencies = [ "compiler_builtins", "rustc-std-workspace-core", diff --git a/build_system/prepare.rs b/build_system/prepare.rs index d26f24f8856..1f4ec825e1e 100644 --- a/build_system/prepare.rs +++ b/build_system/prepare.rs @@ -82,7 +82,7 @@ fn prepare_sysroot() { clone_repo( "build_sysroot/compiler-builtins", "https://github.com/rust-lang/compiler-builtins.git", - "0.1.45", + "0.1.46", ); apply_patches("compiler-builtins", Path::new("build_sysroot/compiler-builtins")); } diff --git a/rust-toolchain b/rust-toolchain index 6cb05bef6d3..c1b2d71ebc7 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1,3 +1,3 @@ [toolchain] -channel = "nightly-2021-06-17" +channel = "nightly-2021-06-30" components = ["rust-src", "rustc-dev", "llvm-tools-preview"] diff --git a/src/base.rs b/src/base.rs index ec3e17e5b75..f44ab276590 100644 --- a/src/base.rs +++ b/src/base.rs @@ -21,6 +21,11 @@ pub(crate) fn codegen_fn<'tcx>( debug_assert!(!instance.substs.needs_infer()); let mir = tcx.instance_mir(instance.def); + let _mir_guard = crate::PrintOnPanic(|| { + let mut buf = Vec::new(); + rustc_mir::util::write_mir_pretty(tcx, Some(instance.def_id()), &mut buf).unwrap(); + String::from_utf8_lossy(&buf).into_owned() + }); // Declare function let symbol_name = tcx.symbol_name(instance); @@ -52,7 +57,6 @@ pub(crate) fn codegen_fn<'tcx>( module, tcx, pointer_type, - vtables: FxHashMap::default(), constants_cx: ConstantCx::new(), instance, diff --git a/src/common.rs b/src/common.rs index a8a0bb52a24..892ccf27f6d 100644 --- a/src/common.rs +++ b/src/common.rs @@ -233,7 +233,6 @@ pub(crate) struct FunctionCx<'m, 'clif, 'tcx: 'm> { pub(crate) module: &'m mut dyn Module, pub(crate) tcx: TyCtxt<'tcx>, pub(crate) pointer_type: Type, // Cached from module - pub(crate) vtables: FxHashMap<(Ty<'tcx>, Option<ty::PolyExistentialTraitRef<'tcx>>), Pointer>, pub(crate) constants_cx: ConstantCx, pub(crate) instance: Instance<'tcx>, diff --git a/src/lib.rs b/src/lib.rs index 49d9dd2bb5e..6e127ce23dc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,11 +1,4 @@ -#![feature( - rustc_private, - decl_macro, - never_type, - hash_drain_filter, - vec_into_raw_parts, - once_cell, -)] +#![feature(rustc_private, decl_macro, never_type, hash_drain_filter, vec_into_raw_parts, once_cell)] #![warn(rust_2018_idioms)] #![warn(unused_lifetimes)] #![warn(unreachable_pub)] @@ -23,6 +16,7 @@ extern crate rustc_incremental; extern crate rustc_index; extern crate rustc_interface; extern crate rustc_metadata; +extern crate rustc_mir; extern crate rustc_session; extern crate rustc_span; extern crate rustc_target; diff --git a/src/vtable.rs b/src/vtable.rs index 1c3cd431fb4..1e1e3683877 100644 --- a/src/vtable.rs +++ b/src/vtable.rs @@ -1,10 +1,9 @@ //! Codegen vtables and vtable accesses. //! //! See `rustc_codegen_ssa/src/meth.rs` for reference. -// FIXME dedup this logic between miri, cg_llvm and cg_clif -use crate::prelude::*; use super::constant::pointer_for_allocation; +use crate::prelude::*; fn vtable_memflags() -> MemFlags { let mut flags = MemFlags::trusted(); // A vtable access is always aligned and will never trap. @@ -69,16 +68,9 @@ pub(crate) fn get_vtable<'tcx>( ty: Ty<'tcx>, trait_ref: Option<ty::PolyExistentialTraitRef<'tcx>>, ) -> Value { - let vtable_ptr = if let Some(vtable_ptr) = fx.vtables.get(&(ty, trait_ref)) { - *vtable_ptr - } else { - let vtable_alloc_id = fx.tcx.vtable_allocation(ty, trait_ref); - let vtable_allocation = fx.tcx.global_alloc(vtable_alloc_id).unwrap_memory(); - let vtable_ptr = pointer_for_allocation(fx, vtable_allocation); - - fx.vtables.insert((ty, trait_ref), vtable_ptr); - vtable_ptr - }; + let vtable_alloc_id = fx.tcx.vtable_allocation(ty, trait_ref); + let vtable_allocation = fx.tcx.global_alloc(vtable_alloc_id).unwrap_memory(); + let vtable_ptr = pointer_for_allocation(fx, vtable_allocation); vtable_ptr.get_addr(fx) } |
