Skip to content

Commit e4fe941

Browse files
authored
Merge pull request rust-lang#371 from rust-lang/sync_from_rust_2023_10_25
Sync from rust 2023/10/25
2 parents 8329a35 + a6984f5 commit e4fe941

10 files changed

+33
-22
lines changed

Readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ To send the changes to the rust repo:
292292
```bash
293293
cd ../rust
294294
git pull origin master
295-
git checkbout -b subtree-update_cg_gcc_YYYY-MM-DD
295+
git checkout -b subtree-update_cg_gcc_YYYY-MM-DD
296296
PATH="$HOME/bin:$PATH" ~/bin/git-subtree pull --prefix=compiler/rustc_codegen_gcc/ https://github.com/rust-lang/rustc_codegen_gcc.git master
297297
git push
298298
```

example/std_example.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
#![feature(core_intrinsics, generators, generator_trait, is_sorted)]
1+
#![feature(core_intrinsics, coroutines, coroutine_trait, is_sorted)]
22

33
#[cfg(feature="master")]
44
#[cfg(target_arch="x86_64")]
55
use std::arch::x86_64::*;
66
use std::io::Write;
7-
use std::ops::Generator;
7+
use std::ops::Coroutine;
88

99
extern {
1010
pub fn printf(format: *const i8, ...) -> i32;

failing-non-lto-tests.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ tests/ui/lto/lto-many-codegen-units.rs
55
tests/ui/lto/issue-100772.rs
66
tests/ui/lto/lto-rustc-loads-linker-plugin.rs
77
tests/ui/panic-runtime/lto-unwind.rs
8-
tests/ui/sanitize/issue-111184-generator-witness.rs
8+
tests/ui/sanitize/issue-111184-coroutine-witness.rs
99
tests/ui/sepcomp/sepcomp-lib-lto.rs
1010
tests/ui/lto/lto-opt-level-s.rs
1111
tests/ui/lto/lto-opt-level-z.rs

failing-ui-tests.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ tests/ui/cfg/cfg-panic-abort.rs
2121
tests/ui/drop/dynamic-drop-async.rs
2222
tests/ui/drop/repeat-drop.rs
2323
tests/ui/fmt/format-args-capture.rs
24-
tests/ui/generator/panic-drops-resume.rs
25-
tests/ui/generator/panic-drops.rs
24+
tests/ui/coroutine/panic-drops-resume.rs
25+
tests/ui/coroutine/panic-drops.rs
2626
tests/ui/intrinsics/panic-uninitialized-zeroed.rs
2727
tests/ui/iterators/iter-sum-overflow-debug.rs
2828
tests/ui/iterators/iter-sum-overflow-overflow-checks.rs
@@ -53,7 +53,7 @@ tests/ui/simd/issue-89193.rs
5353
tests/ui/statics/issue-91050-1.rs
5454
tests/ui/statics/issue-91050-2.rs
5555
tests/ui/alloc-error/default-alloc-error-hook.rs
56-
tests/ui/generator/panic-safe.rs
56+
tests/ui/coroutine/panic-safe.rs
5757
tests/ui/issues/issue-14875.rs
5858
tests/ui/issues/issue-29948.rs
5959
tests/ui/panics/nested_panic_caught.rs
@@ -70,5 +70,5 @@ tests/ui/lto/lto-thin-rustc-loads-linker-plugin.rs
7070
tests/ui/lto/all-crates.rs
7171
tests/ui/async-await/deep-futures-are-freeze.rs
7272
tests/ui/closures/capture-unsized-by-ref.rs
73-
tests/ui/generator/resume-after-return.rs
73+
tests/ui/coroutine/resume-after-return.rs
7474
tests/ui/macros/rfc-2011-nicer-assert-messages/all-expr-kinds.rs

failing-ui-tests12.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ tests/ui/rfcs/rfc-1937-termination-trait/termination-trait-in-test.rs
2828
tests/ui/async-await/async-fn-size-moved-locals.rs
2929
tests/ui/async-await/async-fn-size-uninit-locals.rs
3030
tests/ui/cfg/cfg-panic.rs
31-
tests/ui/generator/size-moved-locals.rs
31+
tests/ui/coroutine/size-moved-locals.rs
3232
tests/ui/macros/rfc-2011-nicer-assert-messages/all-not-available-cases.rs
3333
tests/ui/simd/intrinsic/generic-gather-pass.rs
3434
tests/ui/simd/issue-85915-simd-ptrs.rs

rust-toolchain

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "nightly-2023-10-08"
2+
channel = "nightly-2023-10-21"
33
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]

src/base.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ pub fn compile_codegen_unit(tcx: TyCtxt<'_>, cgu_name: Symbol, target_info: Lock
121121
// NOTE: Rust relies on LLVM doing wrapping on overflow.
122122
context.add_command_line_option("-fwrapv");
123123

124-
if tcx.sess.opts.cg.relocation_model == Some(rustc_target::spec::RelocModel::Static) {
124+
if tcx.sess.relocation_model() == rustc_target::spec::RelocModel::Static {
125125
context.add_command_line_option("-mcmodel=kernel");
126126
context.add_command_line_option("-fno-pie");
127127
}

src/lib.rs

+17-6
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
* TODO(antoyo): remove the patches.
1313
*/
1414

15+
#![cfg_attr(not(bootstrap), allow(internal_features))]
16+
#![cfg_attr(not(bootstrap), doc(rust_logo))]
17+
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
1518
#![feature(
1619
rustc_private,
1720
decl_macro,
@@ -73,6 +76,7 @@ mod type_;
7376
mod type_of;
7477

7578
use std::any::Any;
79+
use std::fmt::Debug;
7680
use std::sync::Arc;
7781
use std::sync::Mutex;
7882
#[cfg(not(feature="master"))]
@@ -93,6 +97,7 @@ use rustc_codegen_ssa::back::write::{CodegenContext, FatLtoInput, ModuleConfig,
9397
use rustc_codegen_ssa::back::lto::{LtoModuleCodegen, SerializedModule, ThinModule};
9498
use rustc_codegen_ssa::target_features::supported_target_features;
9599
use rustc_data_structures::fx::FxIndexMap;
100+
use rustc_data_structures::sync::IntoDynSyncSend;
96101
use rustc_codegen_ssa::traits::{CodegenBackend, ExtraBackendMethods, ThinBufferMethods, WriteBackendMethods};
97102
use rustc_errors::{DiagnosticMessage, ErrorGuaranteed, Handler, SubdiagnosticMessage};
98103
use rustc_fluent_macro::fluent_messages;
@@ -138,9 +143,15 @@ impl TargetInfo {
138143
}
139144
}
140145

141-
#[derive(Clone, Debug)]
146+
#[derive(Clone)]
142147
pub struct LockedTargetInfo {
143-
info: Arc<Mutex<TargetInfo>>,
148+
info: Arc<Mutex<IntoDynSyncSend<TargetInfo>>>,
149+
}
150+
151+
impl Debug for LockedTargetInfo {
152+
fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
153+
self.info.lock().expect("lock").fmt(formatter)
154+
}
144155
}
145156

146157
impl LockedTargetInfo {
@@ -174,7 +185,7 @@ impl CodegenBackend for GccCodegenBackend {
174185
context.add_command_line_option(&format!("-march={}", target_cpu));
175186
}
176187

177-
*self.target_info.info.lock().expect("lock") = context.get_target_info();
188+
**self.target_info.info.lock().expect("lock") = context.get_target_info();
178189
}
179190

180191
#[cfg(feature="master")]
@@ -341,12 +352,12 @@ pub fn __rustc_codegen_backend() -> Box<dyn CodegenBackend> {
341352
let info = {
342353
// Check whether the target supports 128-bit integers.
343354
let context = Context::default();
344-
Arc::new(Mutex::new(context.get_target_info()))
355+
Arc::new(Mutex::new(IntoDynSyncSend(context.get_target_info())))
345356
};
346357
#[cfg(not(feature="master"))]
347-
let info = Arc::new(Mutex::new(TargetInfo {
358+
let info = Arc::new(Mutex::new(IntoDynSyncSend(TargetInfo {
348359
supports_128bit_integers: AtomicBool::new(false),
349-
}));
360+
})));
350361

351362
Box::new(GccCodegenBackend {
352363
target_info: LockedTargetInfo { info },

src/type_of.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ fn uncached_gcc_type<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, layout: TyAndLayout
8787
// FIXME(eddyb) producing readable type names for trait objects can result
8888
// in problematically distinct types due to HRTB and subtyping (see #47638).
8989
// ty::Dynamic(..) |
90-
ty::Adt(..) | ty::Closure(..) | ty::Foreign(..) | ty::Generator(..) | ty::Str
90+
ty::Adt(..) | ty::Closure(..) | ty::Foreign(..) | ty::Coroutine(..) | ty::Str
9191
if !cx.sess().fewer_names() =>
9292
{
9393
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
9898
write!(&mut name, "::{}", def.variant(index).name).unwrap();
9999
}
100100
}
101-
if let (&ty::Generator(_, _, _), &Variants::Single { index }) =
101+
if let (&ty::Coroutine(_, _, _), &Variants::Single { index }) =
102102
(layout.ty.kind(), &layout.variants)
103103
{
104-
write!(&mut name, "::{}", ty::GeneratorArgs::variant_name(index)).unwrap();
104+
write!(&mut name, "::{}", ty::CoroutineArgs::variant_name(index)).unwrap();
105105
}
106106
Some(name)
107107
}

test.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -371,10 +371,10 @@ function test_rustc() {
371371

372372
git checkout -- tests/ui/issues/auxiliary/issue-3136-a.rs # contains //~ERROR, but shouldn't be removed
373373

374-
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
374+
rm -r tests/ui/{abi*,extern/,unsized-locals/,proc-macro/,threads-sendsync/,borrowck/,test*,consts/issue-miri-1910.rs} || true
375375
rm tests/ui/mir/mir_heavy_promoted.rs # this test is oom-killed in the CI.
376376
# Tests generating errors.
377-
rm tests/ui/consts/const-eval/nonnull_as_ref_ub.rs tests/ui/consts/issue-94675.rs
377+
rm tests/ui/consts/issue-94675.rs
378378
for test in $(rg --files-with-matches "thread" tests/ui); do
379379
rm $test
380380
done

0 commit comments

Comments
 (0)