diff --git a/Readme.md b/Readme.md index 1bad1e71137..95fc6374c09 100644 --- a/Readme.md +++ b/Readme.md @@ -292,7 +292,7 @@ To send the changes to the rust repo: ```bash cd ../rust git pull origin master -git checkbout -b subtree-update_cg_gcc_YYYY-MM-DD +git checkout -b subtree-update_cg_gcc_YYYY-MM-DD PATH="$HOME/bin:$PATH" ~/bin/git-subtree pull --prefix=compiler/rustc_codegen_gcc/ https://github.com/rust-lang/rustc_codegen_gcc.git master git push ``` diff --git a/example/std_example.rs b/example/std_example.rs index 2d57866c1d1..0f6325c8980 100644 --- a/example/std_example.rs +++ b/example/std_example.rs @@ -1,10 +1,10 @@ -#![feature(core_intrinsics, generators, generator_trait, is_sorted)] +#![feature(core_intrinsics, coroutines, coroutine_trait, is_sorted)] #[cfg(feature="master")] #[cfg(target_arch="x86_64")] use std::arch::x86_64::*; use std::io::Write; -use std::ops::Generator; +use std::ops::Coroutine; extern { pub fn printf(format: *const i8, ...) -> i32; diff --git a/failing-non-lto-tests.txt b/failing-non-lto-tests.txt index 2f338f7d3c8..4fd60f2b8e4 100644 --- a/failing-non-lto-tests.txt +++ b/failing-non-lto-tests.txt @@ -5,7 +5,7 @@ tests/ui/lto/lto-many-codegen-units.rs tests/ui/lto/issue-100772.rs tests/ui/lto/lto-rustc-loads-linker-plugin.rs tests/ui/panic-runtime/lto-unwind.rs -tests/ui/sanitize/issue-111184-generator-witness.rs +tests/ui/sanitize/issue-111184-coroutine-witness.rs tests/ui/sepcomp/sepcomp-lib-lto.rs tests/ui/lto/lto-opt-level-s.rs tests/ui/lto/lto-opt-level-z.rs diff --git a/failing-ui-tests.txt b/failing-ui-tests.txt index 771da581295..22044eabe96 100644 --- a/failing-ui-tests.txt +++ b/failing-ui-tests.txt @@ -21,8 +21,8 @@ tests/ui/cfg/cfg-panic-abort.rs tests/ui/drop/dynamic-drop-async.rs tests/ui/drop/repeat-drop.rs tests/ui/fmt/format-args-capture.rs -tests/ui/generator/panic-drops-resume.rs -tests/ui/generator/panic-drops.rs +tests/ui/coroutine/panic-drops-resume.rs +tests/ui/coroutine/panic-drops.rs tests/ui/intrinsics/panic-uninitialized-zeroed.rs tests/ui/iterators/iter-sum-overflow-debug.rs tests/ui/iterators/iter-sum-overflow-overflow-checks.rs @@ -53,7 +53,7 @@ tests/ui/simd/issue-89193.rs tests/ui/statics/issue-91050-1.rs tests/ui/statics/issue-91050-2.rs tests/ui/alloc-error/default-alloc-error-hook.rs -tests/ui/generator/panic-safe.rs +tests/ui/coroutine/panic-safe.rs tests/ui/issues/issue-14875.rs tests/ui/issues/issue-29948.rs tests/ui/panics/nested_panic_caught.rs @@ -70,5 +70,5 @@ tests/ui/lto/lto-thin-rustc-loads-linker-plugin.rs tests/ui/lto/all-crates.rs tests/ui/async-await/deep-futures-are-freeze.rs tests/ui/closures/capture-unsized-by-ref.rs -tests/ui/generator/resume-after-return.rs +tests/ui/coroutine/resume-after-return.rs tests/ui/macros/rfc-2011-nicer-assert-messages/all-expr-kinds.rs diff --git a/failing-ui-tests12.txt b/failing-ui-tests12.txt index f027afa78a3..f91aa925318 100644 --- a/failing-ui-tests12.txt +++ b/failing-ui-tests12.txt @@ -28,7 +28,7 @@ tests/ui/rfcs/rfc-1937-termination-trait/termination-trait-in-test.rs tests/ui/async-await/async-fn-size-moved-locals.rs tests/ui/async-await/async-fn-size-uninit-locals.rs tests/ui/cfg/cfg-panic.rs -tests/ui/generator/size-moved-locals.rs +tests/ui/coroutine/size-moved-locals.rs tests/ui/macros/rfc-2011-nicer-assert-messages/all-not-available-cases.rs tests/ui/simd/intrinsic/generic-gather-pass.rs tests/ui/simd/issue-85915-simd-ptrs.rs diff --git a/rust-toolchain b/rust-toolchain index 25a1cea98cc..205ec53b425 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1,3 +1,3 @@ [toolchain] -channel = "nightly-2023-10-08" +channel = "nightly-2023-10-21" components = ["rust-src", "rustc-dev", "llvm-tools-preview"] diff --git a/src/base.rs b/src/base.rs index 3152357fe49..5073066c138 100644 --- a/src/base.rs +++ b/src/base.rs @@ -121,7 +121,7 @@ pub fn compile_codegen_unit(tcx: TyCtxt<'_>, cgu_name: Symbol, target_info: Lock // NOTE: Rust relies on LLVM doing wrapping on overflow. context.add_command_line_option("-fwrapv"); - if tcx.sess.opts.cg.relocation_model == Some(rustc_target::spec::RelocModel::Static) { + if tcx.sess.relocation_model() == rustc_target::spec::RelocModel::Static { context.add_command_line_option("-mcmodel=kernel"); context.add_command_line_option("-fno-pie"); } diff --git a/src/lib.rs b/src/lib.rs index 2355cd1f696..a530fc994a2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,6 +12,9 @@ * TODO(antoyo): remove the patches. */ +#![cfg_attr(not(bootstrap), allow(internal_features))] +#![cfg_attr(not(bootstrap), doc(rust_logo))] +#![cfg_attr(not(bootstrap), feature(rustdoc_internals))] #![feature( rustc_private, decl_macro, @@ -73,6 +76,7 @@ mod type_; mod type_of; use std::any::Any; +use std::fmt::Debug; use std::sync::Arc; use std::sync::Mutex; #[cfg(not(feature="master"))] @@ -93,6 +97,7 @@ use rustc_codegen_ssa::back::write::{CodegenContext, FatLtoInput, ModuleConfig, use rustc_codegen_ssa::back::lto::{LtoModuleCodegen, SerializedModule, ThinModule}; use rustc_codegen_ssa::target_features::supported_target_features; use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::sync::IntoDynSyncSend; use rustc_codegen_ssa::traits::{CodegenBackend, ExtraBackendMethods, ThinBufferMethods, WriteBackendMethods}; use rustc_errors::{DiagnosticMessage, ErrorGuaranteed, Handler, SubdiagnosticMessage}; use rustc_fluent_macro::fluent_messages; @@ -138,9 +143,15 @@ impl TargetInfo { } } -#[derive(Clone, Debug)] +#[derive(Clone)] pub struct LockedTargetInfo { - info: Arc>, + info: Arc>>, +} + +impl Debug for LockedTargetInfo { + fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + self.info.lock().expect("lock").fmt(formatter) + } } impl LockedTargetInfo { @@ -174,7 +185,7 @@ impl CodegenBackend for GccCodegenBackend { context.add_command_line_option(&format!("-march={}", target_cpu)); } - *self.target_info.info.lock().expect("lock") = context.get_target_info(); + **self.target_info.info.lock().expect("lock") = context.get_target_info(); } #[cfg(feature="master")] @@ -341,12 +352,12 @@ pub fn __rustc_codegen_backend() -> Box { let info = { // Check whether the target supports 128-bit integers. let context = Context::default(); - Arc::new(Mutex::new(context.get_target_info())) + Arc::new(Mutex::new(IntoDynSyncSend(context.get_target_info()))) }; #[cfg(not(feature="master"))] - let info = Arc::new(Mutex::new(TargetInfo { + let info = Arc::new(Mutex::new(IntoDynSyncSend(TargetInfo { supports_128bit_integers: AtomicBool::new(false), - })); + }))); Box::new(GccCodegenBackend { target_info: LockedTargetInfo { info }, diff --git a/src/type_of.rs b/src/type_of.rs index 1189e96e308..479a814788a 100644 --- a/src/type_of.rs +++ b/src/type_of.rs @@ -87,7 +87,7 @@ fn uncached_gcc_type<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, layout: TyAndLayout // FIXME(eddyb) producing readable type names for trait objects can result // in problematically distinct types due to HRTB and subtyping (see #47638). // ty::Dynamic(..) | - ty::Adt(..) | ty::Closure(..) | ty::Foreign(..) | ty::Generator(..) | ty::Str + ty::Adt(..) | ty::Closure(..) | ty::Foreign(..) | ty::Coroutine(..) | ty::Str if !cx.sess().fewer_names() => { let mut name = with_no_trimmed_paths!(layout.ty.to_string()); @@ -98,10 +98,10 @@ fn uncached_gcc_type<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, layout: TyAndLayout write!(&mut name, "::{}", def.variant(index).name).unwrap(); } } - if let (&ty::Generator(_, _, _), &Variants::Single { index }) = + if let (&ty::Coroutine(_, _, _), &Variants::Single { index }) = (layout.ty.kind(), &layout.variants) { - write!(&mut name, "::{}", ty::GeneratorArgs::variant_name(index)).unwrap(); + write!(&mut name, "::{}", ty::CoroutineArgs::variant_name(index)).unwrap(); } Some(name) } diff --git a/test.sh b/test.sh index 2eceee7c1e9..fa34c31dbaa 100755 --- a/test.sh +++ b/test.sh @@ -371,10 +371,10 @@ function test_rustc() { git checkout -- tests/ui/issues/auxiliary/issue-3136-a.rs # contains //~ERROR, but shouldn't be removed - rm -r tests/ui/{abi*,extern/,unsized-locals/,proc-macro/,threads-sendsync/,thinlto/,borrowck/,chalkify/bugs/,test*,consts/const-float-bits-reject-conv.rs,consts/issue-miri-1910.rs} || true + rm -r tests/ui/{abi*,extern/,unsized-locals/,proc-macro/,threads-sendsync/,borrowck/,test*,consts/issue-miri-1910.rs} || true rm tests/ui/mir/mir_heavy_promoted.rs # this test is oom-killed in the CI. # Tests generating errors. - rm tests/ui/consts/const-eval/nonnull_as_ref_ub.rs tests/ui/consts/issue-94675.rs + rm tests/ui/consts/issue-94675.rs for test in $(rg --files-with-matches "thread" tests/ui); do rm $test done