Merge pull request #371 from rust-lang/sync_from_rust_2023_10_25

Sync from rust 2023/10/25
This commit is contained in:
antoyo 2023-10-26 17:40:15 -04:00 committed by GitHub
commit e4fe941b11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 33 additions and 22 deletions

View File

@ -292,7 +292,7 @@ To send the changes to the rust repo:
```bash ```bash
cd ../rust cd ../rust
git pull origin master 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 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 git push
``` ```

View File

@ -1,10 +1,10 @@
#![feature(core_intrinsics, generators, generator_trait, is_sorted)] #![feature(core_intrinsics, coroutines, coroutine_trait, is_sorted)]
#[cfg(feature="master")] #[cfg(feature="master")]
#[cfg(target_arch="x86_64")] #[cfg(target_arch="x86_64")]
use std::arch::x86_64::*; use std::arch::x86_64::*;
use std::io::Write; use std::io::Write;
use std::ops::Generator; use std::ops::Coroutine;
extern { extern {
pub fn printf(format: *const i8, ...) -> i32; pub fn printf(format: *const i8, ...) -> i32;

View File

@ -5,7 +5,7 @@ tests/ui/lto/lto-many-codegen-units.rs
tests/ui/lto/issue-100772.rs tests/ui/lto/issue-100772.rs
tests/ui/lto/lto-rustc-loads-linker-plugin.rs tests/ui/lto/lto-rustc-loads-linker-plugin.rs
tests/ui/panic-runtime/lto-unwind.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/sepcomp/sepcomp-lib-lto.rs
tests/ui/lto/lto-opt-level-s.rs tests/ui/lto/lto-opt-level-s.rs
tests/ui/lto/lto-opt-level-z.rs tests/ui/lto/lto-opt-level-z.rs

View File

@ -21,8 +21,8 @@ tests/ui/cfg/cfg-panic-abort.rs
tests/ui/drop/dynamic-drop-async.rs tests/ui/drop/dynamic-drop-async.rs
tests/ui/drop/repeat-drop.rs tests/ui/drop/repeat-drop.rs
tests/ui/fmt/format-args-capture.rs tests/ui/fmt/format-args-capture.rs
tests/ui/generator/panic-drops-resume.rs tests/ui/coroutine/panic-drops-resume.rs
tests/ui/generator/panic-drops.rs tests/ui/coroutine/panic-drops.rs
tests/ui/intrinsics/panic-uninitialized-zeroed.rs tests/ui/intrinsics/panic-uninitialized-zeroed.rs
tests/ui/iterators/iter-sum-overflow-debug.rs tests/ui/iterators/iter-sum-overflow-debug.rs
tests/ui/iterators/iter-sum-overflow-overflow-checks.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-1.rs
tests/ui/statics/issue-91050-2.rs tests/ui/statics/issue-91050-2.rs
tests/ui/alloc-error/default-alloc-error-hook.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-14875.rs
tests/ui/issues/issue-29948.rs tests/ui/issues/issue-29948.rs
tests/ui/panics/nested_panic_caught.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/lto/all-crates.rs
tests/ui/async-await/deep-futures-are-freeze.rs tests/ui/async-await/deep-futures-are-freeze.rs
tests/ui/closures/capture-unsized-by-ref.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 tests/ui/macros/rfc-2011-nicer-assert-messages/all-expr-kinds.rs

View File

@ -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-moved-locals.rs
tests/ui/async-await/async-fn-size-uninit-locals.rs tests/ui/async-await/async-fn-size-uninit-locals.rs
tests/ui/cfg/cfg-panic.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/macros/rfc-2011-nicer-assert-messages/all-not-available-cases.rs
tests/ui/simd/intrinsic/generic-gather-pass.rs tests/ui/simd/intrinsic/generic-gather-pass.rs
tests/ui/simd/issue-85915-simd-ptrs.rs tests/ui/simd/issue-85915-simd-ptrs.rs

View File

@ -1,3 +1,3 @@
[toolchain] [toolchain]
channel = "nightly-2023-10-08" channel = "nightly-2023-10-21"
components = ["rust-src", "rustc-dev", "llvm-tools-preview"] components = ["rust-src", "rustc-dev", "llvm-tools-preview"]

View File

@ -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. // NOTE: Rust relies on LLVM doing wrapping on overflow.
context.add_command_line_option("-fwrapv"); 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("-mcmodel=kernel");
context.add_command_line_option("-fno-pie"); context.add_command_line_option("-fno-pie");
} }

View File

@ -12,6 +12,9 @@
* TODO(antoyo): remove the patches. * 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( #![feature(
rustc_private, rustc_private,
decl_macro, decl_macro,
@ -73,6 +76,7 @@ mod type_;
mod type_of; mod type_of;
use std::any::Any; use std::any::Any;
use std::fmt::Debug;
use std::sync::Arc; use std::sync::Arc;
use std::sync::Mutex; use std::sync::Mutex;
#[cfg(not(feature="master"))] #[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::back::lto::{LtoModuleCodegen, SerializedModule, ThinModule};
use rustc_codegen_ssa::target_features::supported_target_features; use rustc_codegen_ssa::target_features::supported_target_features;
use rustc_data_structures::fx::FxIndexMap; use rustc_data_structures::fx::FxIndexMap;
use rustc_data_structures::sync::IntoDynSyncSend;
use rustc_codegen_ssa::traits::{CodegenBackend, ExtraBackendMethods, ThinBufferMethods, WriteBackendMethods}; use rustc_codegen_ssa::traits::{CodegenBackend, ExtraBackendMethods, ThinBufferMethods, WriteBackendMethods};
use rustc_errors::{DiagnosticMessage, ErrorGuaranteed, Handler, SubdiagnosticMessage}; use rustc_errors::{DiagnosticMessage, ErrorGuaranteed, Handler, SubdiagnosticMessage};
use rustc_fluent_macro::fluent_messages; use rustc_fluent_macro::fluent_messages;
@ -138,9 +143,15 @@ impl TargetInfo {
} }
} }
#[derive(Clone, Debug)] #[derive(Clone)]
pub struct LockedTargetInfo { pub struct LockedTargetInfo {
info: Arc<Mutex<TargetInfo>>, info: Arc<Mutex<IntoDynSyncSend<TargetInfo>>>,
}
impl Debug for LockedTargetInfo {
fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
self.info.lock().expect("lock").fmt(formatter)
}
} }
impl LockedTargetInfo { impl LockedTargetInfo {
@ -174,7 +185,7 @@ impl CodegenBackend for GccCodegenBackend {
context.add_command_line_option(&format!("-march={}", target_cpu)); 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")] #[cfg(feature="master")]
@ -341,12 +352,12 @@ pub fn __rustc_codegen_backend() -> Box<dyn CodegenBackend> {
let info = { let info = {
// Check whether the target supports 128-bit integers. // Check whether the target supports 128-bit integers.
let context = Context::default(); 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"))] #[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), supports_128bit_integers: AtomicBool::new(false),
})); })));
Box::new(GccCodegenBackend { Box::new(GccCodegenBackend {
target_info: LockedTargetInfo { info }, target_info: LockedTargetInfo { info },

View File

@ -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 // FIXME(eddyb) producing readable type names for trait objects can result
// in problematically distinct types due to HRTB and subtyping (see #47638). // in problematically distinct types due to HRTB and subtyping (see #47638).
// ty::Dynamic(..) | // 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() => if !cx.sess().fewer_names() =>
{ {
let mut name = with_no_trimmed_paths!(layout.ty.to_string()); 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(); 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) (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) Some(name)
} }

View File

@ -371,10 +371,10 @@ function test_rustc() {
git checkout -- tests/ui/issues/auxiliary/issue-3136-a.rs # contains //~ERROR, but shouldn't be removed 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. rm tests/ui/mir/mir_heavy_promoted.rs # this test is oom-killed in the CI.
# Tests generating errors. # 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 for test in $(rg --files-with-matches "thread" tests/ui); do
rm $test rm $test
done done