diff options
| author | antoyo <antoyo@users.noreply.github.com> | 2022-03-26 13:00:39 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-26 13:00:39 -0400 |
| commit | 39683d8eb7a32a74bea96ecbf1e87675d3338506 (patch) | |
| tree | f466d9b0bff049dc9522a24fb201205400ffd7c9 | |
| parent | a22e15b954d2be638ab0b15cee6e93cf301dc159 (diff) | |
| parent | fb9658d312adec8a036c9dc0fad1b60e285c4af6 (diff) | |
| download | rust-39683d8eb7a32a74bea96ecbf1e87675d3338506.tar.gz rust-39683d8eb7a32a74bea96ecbf1e87675d3338506.zip | |
Merge pull request #146 from bjorn3/rustup
Rustup to rustc 1.61.0-nightly (d53246fed 2022-03-25)
| -rw-r--r-- | build_sysroot/Cargo.toml | 2 | ||||
| -rw-r--r-- | example/mini_core.rs | 4 | ||||
| -rw-r--r-- | patches/0024-core-Disable-portable-simd-test.patch | 20 | ||||
| -rw-r--r-- | patches/0028-core-Disable-long-running-tests.patch | 26 | ||||
| -rw-r--r-- | rust-toolchain | 2 | ||||
| -rw-r--r-- | src/allocator.rs | 9 | ||||
| -rw-r--r-- | src/builder.rs | 6 | ||||
| -rw-r--r-- | src/common.rs | 33 | ||||
| -rw-r--r-- | src/consts.rs | 7 | ||||
| -rw-r--r-- | src/context.rs | 5 | ||||
| -rw-r--r-- | src/debuginfo.rs | 2 | ||||
| -rw-r--r-- | src/intrinsic/mod.rs | 8 | ||||
| -rw-r--r-- | src/lib.rs | 14 | ||||
| -rw-r--r-- | src/type_of.rs | 4 | ||||
| -rwxr-xr-x | test.sh | 18 | ||||
| -rw-r--r-- | tests/run/static.rs | 6 |
16 files changed, 98 insertions, 68 deletions
diff --git a/build_sysroot/Cargo.toml b/build_sysroot/Cargo.toml index 05863471cb1..cfadf47cc3f 100644 --- a/build_sysroot/Cargo.toml +++ b/build_sysroot/Cargo.toml @@ -5,7 +5,7 @@ version = "0.0.0" [dependencies] core = { path = "./sysroot_src/library/core" } -compiler_builtins = "=0.1.70" # TODO: update back to "0.1" when updating to latest nightly. +compiler_builtins = "0.1" alloc = { path = "./sysroot_src/library/alloc" } std = { path = "./sysroot_src/library/std", features = ["panic_unwind", "backtrace"] } test = { path = "./sysroot_src/library/test" } diff --git a/example/mini_core.rs b/example/mini_core.rs index d70df905160..a8435287d9f 100644 --- a/example/mini_core.rs +++ b/example/mini_core.rs @@ -14,6 +14,9 @@ unsafe extern "C" fn _Unwind_Resume() { #[lang = "sized"] pub trait Sized {} +#[lang = "destruct"] +pub trait Destruct {} + #[lang = "unsize"] pub trait Unsize<T: ?Sized> {} @@ -59,6 +62,7 @@ unsafe impl Copy for i16 {} unsafe impl Copy for i32 {} unsafe impl Copy for isize {} unsafe impl Copy for f32 {} +unsafe impl Copy for f64 {} unsafe impl Copy for char {} unsafe impl<'a, T: ?Sized> Copy for &'a T {} unsafe impl<T: ?Sized> Copy for *const T {} diff --git a/patches/0024-core-Disable-portable-simd-test.patch b/patches/0024-core-Disable-portable-simd-test.patch index 4ffb24cd9a7..03900ba101a 100644 --- a/patches/0024-core-Disable-portable-simd-test.patch +++ b/patches/0024-core-Disable-portable-simd-test.patch @@ -11,7 +11,7 @@ diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index aa1ad93..95fbf55 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs -@@ -398,25 +398,4 @@ pub mod arch { +@@ -398,23 +398,4 @@ pub mod arch { } } @@ -25,12 +25,10 @@ index aa1ad93..95fbf55 100644 -#[allow(missing_debug_implementations, dead_code, unsafe_op_in_unsafe_fn, unused_unsafe)] -#[allow(rustdoc::bare_urls)] -#[unstable(feature = "portable_simd", issue = "86656")] --#[cfg(not(all(miri, doctest)))] // Miri does not support all SIMD intrinsics -mod core_simd; - -#[doc = include_str!("../../portable-simd/crates/core_simd/src/core_simd_docs.md")] -#[unstable(feature = "portable_simd", issue = "86656")] --#[cfg(not(all(miri, doctest)))] // Miri does not support all SIMD intrinsics -pub mod simd { - #[unstable(feature = "portable_simd", issue = "86656")] - pub use crate::core_simd::simd::*; @@ -41,15 +39,14 @@ diff --git a/library/core/src/slice/mod.rs b/library/core/src/slice/mod.rs index cd38c3a..ad632dc 100644 --- a/library/core/src/slice/mod.rs +++ b/library/core/src/slice/mod.rs -@@ -17,7 +17,6 @@ use crate::ptr; +@@ -17,6 +17,5 @@ use crate::ptr; use crate::result::Result; use crate::result::Result::{Err, Ok}; - #[cfg(not(miri))] // Miri does not support all SIMD intrinsics -use crate::simd::{self, Simd}; use crate::slice; #[unstable( -@@ -3475,123 +3474,6 @@ impl<T> [T] { +@@ -3475,121 +3474,6 @@ impl<T> [T] { } } @@ -102,14 +99,13 @@ index cd38c3a..ad632dc 100644 - /// suffix.iter().copied().sum(), - /// ]); - /// let sums = middle.iter().copied().fold(sums, f32x4::add); -- /// sums.horizontal_sum() +- /// sums.reduce_sum() - /// } - /// - /// let numbers: Vec<f32> = (1..101).map(|x| x as _).collect(); - /// assert_eq!(basic_simd_sum(&numbers[1..99]), 4949.0); - /// ``` - #[unstable(feature = "portable_simd", issue = "86656")] -- #[cfg(not(miri))] // Miri does not support all SIMD intrinsics - pub fn as_simd<const LANES: usize>(&self) -> (&[T], &[Simd<T, LANES>], &[T]) - where - Simd<T, LANES>: AsRef<[T; LANES]>, @@ -153,7 +149,6 @@ index cd38c3a..ad632dc 100644 - /// be lifted in a way that would make it possible to see panics from this - /// method for something like `LANES == 3`. - #[unstable(feature = "portable_simd", issue = "86656")] -- #[cfg(not(miri))] // Miri does not support all SIMD intrinsics - pub fn as_simd_mut<const LANES: usize>(&mut self) -> (&mut [T], &mut [Simd<T, LANES>], &mut [T]) - where - Simd<T, LANES>: AsMut<[T; LANES]>, @@ -197,15 +192,14 @@ diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index 5dc586d..b6fc48f 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs -@@ -312,7 +312,6 @@ +@@ -312,6 +312,5 @@ #![feature(panic_can_unwind)] #![feature(panic_unwind)] #![feature(platform_intrinsics)] -#![feature(portable_simd)] #![feature(prelude_import)] #![feature(ptr_as_uninit)] - #![feature(ptr_internals)] -@@ -508,25 +508,6 @@ pub mod time; +@@ -508,23 +508,6 @@ pub mod time; #[unstable(feature = "once_cell", issue = "74465")] pub mod lazy; @@ -215,10 +209,8 @@ index 5dc586d..b6fc48f 100644 -#[allow(missing_debug_implementations, dead_code, unsafe_op_in_unsafe_fn, unused_unsafe)] -#[allow(rustdoc::bare_urls)] -#[unstable(feature = "portable_simd", issue = "86656")] --#[cfg(not(all(miri, doctest)))] // Miri does not support all SIMD intrinsics -mod std_float; - --#[cfg(not(all(miri, doctest)))] // Miri does not support all SIMD intrinsics -#[doc = include_str!("../../portable-simd/crates/core_simd/src/core_simd_docs.md")] -#[unstable(feature = "portable_simd", issue = "86656")] -pub mod simd { diff --git a/patches/0028-core-Disable-long-running-tests.patch b/patches/0028-core-Disable-long-running-tests.patch index bf74a74c7c4..dc1beae6d2e 100644 --- a/patches/0028-core-Disable-long-running-tests.patch +++ b/patches/0028-core-Disable-long-running-tests.patch @@ -1,30 +1,32 @@ -From 0ffdd8eda8df364391c8ac6e1ce92c73ba9254d4 Mon Sep 17 00:00:00 2001 +From eb703e627e7a84f1cd8d0d87f0f69da1f0acf765 Mon Sep 17 00:00:00 2001 From: bjorn3 <bjorn3@users.noreply.github.com> Date: Fri, 3 Dec 2021 12:16:30 +0100 Subject: [PATCH] Disable long running tests --- - library/core/tests/slice.rs | 3 +++ - 1 file changed, 3 insertions(+) + library/core/tests/slice.rs | 2 ++ + 1 file changed, 2 insertions(+) diff --git a/library/core/tests/slice.rs b/library/core/tests/slice.rs -index 2c8f00a..44847ee 100644 +index 8402833..84592e0 100644 --- a/library/core/tests/slice.rs +++ b/library/core/tests/slice.rs -@@ -2332,7 +2332,8 @@ macro_rules! empty_max_mut { - }; - } +@@ -2462,6 +2462,7 @@ take_tests! { + #[cfg(not(miri))] // unused in Miri + const EMPTY_MAX: &'static [()] = &[(); usize::MAX]; +/* - #[cfg(not(miri))] // Comparing usize::MAX many elements takes forever in Miri (and in rustc without optimizations) - take_tests! { - slice: &[(); usize::MAX], method: take, - (take_in_bounds_max_range_to, (..usize::MAX), Some(EMPTY_MAX), &[(); 0]), -@@ -2345,3 +2347,4 @@ take_tests! { + // can't be a constant due to const mutability rules + #[cfg(not(miri))] // unused in Miri + macro_rules! empty_max_mut { +@@ -2485,6 +2486,7 @@ take_tests! { (take_mut_oob_max_range_to_inclusive, (..=usize::MAX), None, empty_max_mut!()), (take_mut_in_bounds_max_range_from, (usize::MAX..), Some(&mut [] as _), empty_max_mut!()), } +*/ + + #[test] + fn test_slice_from_ptr_range() { -- 2.26.2.7.g19db9cfb68 diff --git a/rust-toolchain b/rust-toolchain index f2d80b78313..db14ea2bebc 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1,3 +1,3 @@ [toolchain] -channel = "nightly-2022-02-25" +channel = "nightly-2022-03-26" components = ["rust-src", "rustc-dev", "llvm-tools-preview"] diff --git a/src/allocator.rs b/src/allocator.rs index 6378a31202c..c761e5aabd1 100644 --- a/src/allocator.rs +++ b/src/allocator.rs @@ -1,7 +1,8 @@ -use gccjit::{FunctionType, ToRValue}; +use gccjit::{FunctionType, GlobalKind, ToRValue}; use rustc_ast::expand::allocator::{AllocatorKind, AllocatorTy, ALLOCATOR_METHODS}; use rustc_middle::bug; use rustc_middle::ty::TyCtxt; +use rustc_session::config::OomStrategy; use rustc_span::symbol::sym; use crate::GccContext; @@ -113,4 +114,10 @@ pub(crate) unsafe fn codegen(tcx: TyCtxt<'_>, mods: &mut GccContext, _module_nam let _ret = context.new_call(None, callee, &args); //llvm::LLVMSetTailCall(ret, True); block.end_with_void_return(None); + + let name = OomStrategy::SYMBOL.to_string(); + let global = context.new_global(None, GlobalKind::Exported, i8, name); + let value = tcx.sess.opts.debugging_opts.oom.should_panic(); + let value = context.new_rvalue_from_int(i8, value as i32); + global.global_set_initializer_rvalue(value); } diff --git a/src/builder.rs b/src/builder.rs index 4aa9b5341fe..b2f46e92ecc 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -934,7 +934,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> { let val_type = value.get_type(); match (type_is_pointer(val_type), type_is_pointer(dest_ty)) { (false, true) => { - // NOTE: Projecting a field of a pointer type will attemp a cast from a signed char to + // NOTE: Projecting a field of a pointer type will attempt a cast from a signed char to // a pointer, which is not supported by gccjit. return self.cx.context.new_cast(None, self.inttoptr(value, val_type.make_pointer()), dest_ty); }, @@ -1251,8 +1251,8 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> { self.cx } - fn apply_attrs_to_cleanup_callsite(&mut self, _llret: RValue<'gcc>) { - // TODO + fn do_not_inline(&mut self, _llret: RValue<'gcc>) { + // FIMXE(bjorn3): implement } fn set_span(&mut self, _span: Span) {} diff --git a/src/common.rs b/src/common.rs index e36e5bb2382..61709dd92de 100644 --- a/src/common.rs +++ b/src/common.rs @@ -11,7 +11,7 @@ use rustc_codegen_ssa::traits::{ use rustc_middle::mir::Mutability; use rustc_middle::ty::ScalarInt; use rustc_middle::ty::layout::{TyAndLayout, LayoutOf}; -use rustc_middle::mir::interpret::{Allocation, GlobalAlloc, Scalar}; +use rustc_middle::mir::interpret::{ConstAllocation, GlobalAlloc, Scalar}; use rustc_span::Symbol; use rustc_target::abi::{self, HasDataLayout, Pointer, Size}; @@ -24,18 +24,6 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> { bytes_in_context(self, bytes) } - fn const_cstr(&self, symbol: Symbol, _null_terminated: bool) -> LValue<'gcc> { - // TODO(antoyo): handle null_terminated. - if let Some(&value) = self.const_cstr_cache.borrow().get(&symbol) { - return value; - } - - let global = self.global_string(symbol.as_str()); - - self.const_cstr_cache.borrow_mut().insert(symbol, global); - global - } - fn global_string(&self, string: &str) -> LValue<'gcc> { // TODO(antoyo): handle non-null-terminated strings. let string = self.context.new_string_literal(&*string); @@ -134,8 +122,12 @@ impl<'gcc, 'tcx> ConstMethods<'tcx> for CodegenCx<'gcc, 'tcx> { } fn const_str(&self, s: Symbol) -> (RValue<'gcc>, RValue<'gcc>) { - let len = s.as_str().len(); - let cs = self.const_ptrcast(self.const_cstr(s, false).get_address(None), + let s_str = s.as_str(); + let str_global = *self.const_str_cache.borrow_mut().entry(s).or_insert_with(|| { + self.global_string(s_str) + }); + let len = s_str.len(); + let cs = self.const_ptrcast(str_global.get_address(None), self.type_ptr_to(self.layout_of(self.tcx.types.str_).gcc_type(self, true)), ); (cs, self.const_usize(len as u64)) @@ -190,6 +182,7 @@ impl<'gcc, 'tcx> ConstMethods<'tcx> for CodegenCx<'gcc, 'tcx> { match self.tcx.global_alloc(alloc_id) { GlobalAlloc::Memory(alloc) => { let init = const_alloc_to_gcc(self, alloc); + let alloc = alloc.inner(); let value = match alloc.mutability { Mutability::Mut => self.static_addr_of_mut(init, alloc.align, None), @@ -222,21 +215,21 @@ impl<'gcc, 'tcx> ConstMethods<'tcx> for CodegenCx<'gcc, 'tcx> { } } - fn const_data_from_alloc(&self, alloc: &Allocation) -> Self::Value { + fn const_data_from_alloc(&self, alloc: ConstAllocation<'tcx>) -> Self::Value { const_alloc_to_gcc(self, alloc) } - fn from_const_alloc(&self, layout: TyAndLayout<'tcx>, alloc: &Allocation, offset: Size) -> PlaceRef<'tcx, RValue<'gcc>> { - assert_eq!(alloc.align, layout.align.abi); + fn from_const_alloc(&self, layout: TyAndLayout<'tcx>, alloc: ConstAllocation<'tcx>, offset: Size) -> PlaceRef<'tcx, RValue<'gcc>> { + assert_eq!(alloc.inner().align, layout.align.abi); let ty = self.type_ptr_to(layout.gcc_type(self, true)); let value = if layout.size == Size::ZERO { - let value = self.const_usize(alloc.align.bytes()); + let value = self.const_usize(alloc.inner().align.bytes()); self.context.new_cast(None, value, ty) } else { let init = const_alloc_to_gcc(self, alloc); - let base_addr = self.static_addr_of(init, alloc.align, None); + let base_addr = self.static_addr_of(init, alloc.inner().align, None); let array = self.const_bitcast(base_addr, self.type_i8p()); let value = self.context.new_array_access(None, array, self.const_usize(offset.bytes())).get_address(None); diff --git a/src/consts.rs b/src/consts.rs index 598bcdc31b6..de52f3ea225 100644 --- a/src/consts.rs +++ b/src/consts.rs @@ -7,7 +7,7 @@ use rustc_middle::middle::codegen_fn_attrs::{CodegenFnAttrFlags, CodegenFnAttrs} use rustc_middle::mir::mono::MonoItem; use rustc_middle::ty::{self, Instance, Ty}; use rustc_middle::ty::layout::LayoutOf; -use rustc_middle::mir::interpret::{self, Allocation, ErrorHandled, Scalar as InterpScalar, read_target_uint}; +use rustc_middle::mir::interpret::{self, ConstAllocation, ErrorHandled, Scalar as InterpScalar, read_target_uint}; use rustc_span::Span; use rustc_span::def_id::DefId; use rustc_target::abi::{self, Align, HasDataLayout, Primitive, Size, WrappingRange}; @@ -293,7 +293,8 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> { } } -pub fn const_alloc_to_gcc<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, alloc: &Allocation) -> RValue<'gcc> { +pub fn const_alloc_to_gcc<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, alloc: ConstAllocation<'tcx>) -> RValue<'gcc> { + let alloc = alloc.inner(); let mut llvals = Vec::with_capacity(alloc.relocations().len() + 1); let dl = cx.data_layout(); let pointer_size = dl.pointer_size.bytes() as usize; @@ -347,7 +348,7 @@ pub fn const_alloc_to_gcc<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, alloc: &Alloca cx.const_struct(&llvals, true) } -pub fn codegen_static_initializer<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, def_id: DefId) -> Result<(RValue<'gcc>, &'tcx Allocation), ErrorHandled> { +pub fn codegen_static_initializer<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, def_id: DefId) -> Result<(RValue<'gcc>, ConstAllocation<'tcx>), ErrorHandled> { let alloc = cx.tcx.eval_static_initializer(def_id)?; Ok((const_alloc_to_gcc(cx, alloc), alloc)) } diff --git a/src/context.rs b/src/context.rs index d411ccdb821..5e5b9e7e9b1 100644 --- a/src/context.rs +++ b/src/context.rs @@ -89,12 +89,13 @@ pub struct CodegenCx<'gcc, 'tcx> { /// Cache of emitted const globals (value -> global) pub const_globals: RefCell<FxHashMap<RValue<'gcc>, RValue<'gcc>>>, + /// Map from the address of a global variable (rvalue) to the global variable itself (lvalue). /// TODO(antoyo): remove when the rustc API is fixed. pub global_lvalues: RefCell<FxHashMap<RValue<'gcc>, LValue<'gcc>>>, /// Cache of constant strings, - pub const_cstr_cache: RefCell<FxHashMap<Symbol, LValue<'gcc>>>, + pub const_str_cache: RefCell<FxHashMap<Symbol, LValue<'gcc>>>, /// Cache of globals. pub globals: RefCell<FxHashMap<String, RValue<'gcc>>>, @@ -219,7 +220,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> { vtables: Default::default(), const_globals: Default::default(), global_lvalues: Default::default(), - const_cstr_cache: Default::default(), + const_str_cache: Default::default(), globals: Default::default(), scalar_types: Default::default(), types: Default::default(), diff --git a/src/debuginfo.rs b/src/debuginfo.rs index 31959fa19c5..266759ed6cf 100644 --- a/src/debuginfo.rs +++ b/src/debuginfo.rs @@ -31,7 +31,7 @@ impl<'a, 'gcc, 'tcx> DebugInfoBuilderMethods for Builder<'a, 'gcc, 'tcx> { } impl<'gcc, 'tcx> DebugInfoMethods<'tcx> for CodegenCx<'gcc, 'tcx> { - fn create_vtable_metadata(&self, _ty: Ty<'tcx>, _trait_ref: Option<PolyExistentialTraitRef<'tcx>>, _vtable: Self::Value) { + fn create_vtable_debuginfo(&self, _ty: Ty<'tcx>, _trait_ref: Option<PolyExistentialTraitRef<'tcx>>, _vtable: Self::Value) { // TODO(antoyo) } diff --git a/src/intrinsic/mod.rs b/src/intrinsic/mod.rs index d4b1dd5ca16..08e584a46f3 100644 --- a/src/intrinsic/mod.rs +++ b/src/intrinsic/mod.rs @@ -260,20 +260,20 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'gcc, 'tcx> { use rustc_target::abi::Abi::*; let tp_ty = substs.type_at(0); let layout = self.layout_of(tp_ty).layout; - let _use_integer_compare = match layout.abi { + let _use_integer_compare = match layout.abi() { Scalar(_) | ScalarPair(_, _) => true, Uninhabited | Vector { .. } => false, Aggregate { .. } => { // For rusty ABIs, small aggregates are actually passed // as `RegKind::Integer` (see `FnAbi::adjust_for_abi`), // so we re-use that same threshold here. - layout.size <= self.data_layout().pointer_size * 2 + layout.size() <= self.data_layout().pointer_size * 2 } }; let a = args[0].immediate(); let b = args[1].immediate(); - if layout.size.bytes() == 0 { + if layout.size().bytes() == 0 { self.const_bool(true) } /*else if use_integer_compare { @@ -289,7 +289,7 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'gcc, 'tcx> { let void_ptr_type = self.context.new_type::<*const ()>(); let a_ptr = self.bitcast(a, void_ptr_type); let b_ptr = self.bitcast(b, void_ptr_type); - let n = self.context.new_cast(None, self.const_usize(layout.size.bytes()), self.sizet_type); + let n = self.context.new_cast(None, self.const_usize(layout.size().bytes()), self.sizet_type); let builtin = self.context.get_builtin_function("memcmp"); let cmp = self.context.new_call(None, builtin, &[a_ptr, b_ptr, n]); self.icmp(IntPredicate::IntEQ, cmp, self.const_i32(0)) diff --git a/src/lib.rs b/src/lib.rs index ca283e1380c..eac4a06226c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -60,10 +60,11 @@ use rustc_codegen_ssa::back::lto::{LtoModuleCodegen, SerializedModule, ThinModul use rustc_codegen_ssa::target_features::supported_target_features; use rustc_codegen_ssa::traits::{CodegenBackend, ExtraBackendMethods, ModuleBufferMethods, ThinBufferMethods, WriteBackendMethods}; use rustc_data_structures::fx::FxHashMap; -use rustc_errors::{ErrorReported, Handler}; +use rustc_errors::{ErrorGuaranteed, Handler}; use rustc_metadata::EncodedMetadata; use rustc_middle::dep_graph::{WorkProduct, WorkProductId}; use rustc_middle::ty::TyCtxt; +use rustc_middle::ty::query::Providers; use rustc_session::config::{Lto, OptLevel, OutputFilenames}; use rustc_session::Session; use rustc_span::Symbol; @@ -101,6 +102,11 @@ impl CodegenBackend for GccCodegenBackend { *self.supports_128bit_integers.lock().expect("lock") = check_context.get_last_error() == Ok(None); } + fn provide(&self, providers: &mut Providers) { + // FIXME(antoyo) compute list of enabled features from cli flags + providers.global_backend_features = |_tcx, ()| vec![]; + } + fn codegen_crate<'tcx>(&self, tcx: TyCtxt<'tcx>, metadata: EncodedMetadata, need_metadata_module: bool) -> Box<dyn Any> { let target_cpu = target_cpu(tcx.sess); let res = codegen_crate(self.clone(), tcx, target_cpu.to_string(), metadata, need_metadata_module); @@ -108,7 +114,7 @@ impl CodegenBackend for GccCodegenBackend { Box::new(res) } - fn join_codegen(&self, ongoing_codegen: Box<dyn Any>, sess: &Session, _outputs: &OutputFilenames) -> Result<(CodegenResults, FxHashMap<WorkProductId, WorkProduct>), ErrorReported> { + fn join_codegen(&self, ongoing_codegen: Box<dyn Any>, sess: &Session, _outputs: &OutputFilenames) -> Result<(CodegenResults, FxHashMap<WorkProductId, WorkProduct>), ErrorGuaranteed> { let (codegen_results, work_products) = ongoing_codegen .downcast::<rustc_codegen_ssa::back::write::OngoingCodegen<GccCodegenBackend>>() .expect("Expected GccCodegenBackend's OngoingCodegen, found Box<Any>") @@ -117,7 +123,7 @@ impl CodegenBackend for GccCodegenBackend { Ok((codegen_results, work_products)) } - fn link(&self, sess: &Session, codegen_results: CodegenResults, outputs: &OutputFilenames) -> Result<(), ErrorReported> { + fn link(&self, sess: &Session, codegen_results: CodegenResults, outputs: &OutputFilenames) -> Result<(), ErrorGuaranteed> { use rustc_codegen_ssa::back::link::link_binary; link_binary::<crate::archive::ArArchiveBuilder<'_>>( @@ -147,7 +153,7 @@ impl ExtraBackendMethods for GccCodegenBackend { base::compile_codegen_unit(tcx, cgu_name, *self.supports_128bit_integers.lock().expect("lock")) } - fn target_machine_factory(&self, _sess: &Session, _opt_level: OptLevel) -> TargetMachineFactoryFn<Self> { + fn target_machine_factory(&self, _sess: &Session, _opt_level: OptLevel, _features: &[String]) -> TargetMachineFactoryFn<Self> { // TODO(antoyo): set opt level. Arc::new(|_| { Ok(()) diff --git a/src/type_of.rs b/src/type_of.rs index 76a98adbf3c..ed8f0445ca3 100644 --- a/src/type_of.rs +++ b/src/type_of.rs @@ -56,8 +56,8 @@ pub fn uncached_gcc_type<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, layout: TyAndLa if let (&ty::Adt(def, _), &Variants::Single { index }) = (layout.ty.kind(), &layout.variants) { - if def.is_enum() && !def.variants.is_empty() { - write!(&mut name, "::{}", def.variants[index].name).unwrap(); + if def.is_enum() && !def.variants().is_empty() { + write!(&mut name, "::{}", def.variant(index).name).unwrap(); } } if let (&ty::Generator(_, _, _), &Variants::Single { index }) = diff --git a/test.sh b/test.sh index 1a5b89d3704..1beeee136df 100755 --- a/test.sh +++ b/test.sh @@ -165,6 +165,24 @@ function test_rustc() { git checkout $(rustc -V | cut -d' ' -f3 | tr -d '(') export RUSTFLAGS= + git apply - <<EOF +diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs +index 887d27fd6dca4..2c2239f2b83d1 100644 +--- a/src/tools/compiletest/src/header.rs ++++ b/src/tools/compiletest/src/header.rs +@@ -806,8 +806,8 @@ pub fn make_test_description<R: Read>( + cfg: Option<&str>, + ) -> test::TestDesc { + let mut ignore = false; + #[cfg(not(bootstrap))] +- let ignore_message: Option<String> = None; ++ let ignore_message: Option<&str> = None; + let mut should_fail = false; + + let rustc_has_profiler_support = env::var_os("RUSTC_PROFILER_SUPPORT").is_some(); + +EOF + rm config.toml || true cat > config.toml <<EOF diff --git a/tests/run/static.rs b/tests/run/static.rs index ab89f6aff4b..294add96844 100644 --- a/tests/run/static.rs +++ b/tests/run/static.rs @@ -22,6 +22,12 @@ #[lang = "sized"] pub trait Sized {} +#[lang = "destruct"] +pub trait Destruct {} + +#[lang = "drop"] +pub trait Drop {} + #[lang = "copy"] trait Copy { } |
