Skip to content

Commit

Permalink
Merge pull request rust-lang#371 from rust-lang/sync_from_rust_2023_1…
Browse files Browse the repository at this point in the history
…0_25

Sync from rust 2023/10/25
  • Loading branch information
antoyo authored Oct 26, 2023
2 parents 8329a35 + a6984f5 commit e4fe941
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down
4 changes: 2 additions & 2 deletions example/std_example.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion failing-non-lto-tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 4 additions & 4 deletions failing-ui-tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion failing-ui-tests12.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "nightly-2023-10-08"
channel = "nightly-2023-10-21"
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
2 changes: 1 addition & 1 deletion src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down
23 changes: 17 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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"))]
Expand All @@ -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;
Expand Down Expand Up @@ -138,9 +143,15 @@ impl TargetInfo {
}
}

#[derive(Clone, Debug)]
#[derive(Clone)]
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 {
Expand Down Expand Up @@ -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")]
Expand Down Expand Up @@ -341,12 +352,12 @@ pub fn __rustc_codegen_backend() -> Box<dyn CodegenBackend> {
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 },
Expand Down
6 changes: 3 additions & 3 deletions src/type_of.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e4fe941

Please sign in to comment.