Skip to content

Commit 11a0cce

Browse files
authored
Merge pull request #350 from rust-lang/sync_from_rust_2023_10_08
Sync from rust 2023/10/08
2 parents d484836 + a7532da commit 11a0cce

27 files changed

+77
-69
lines changed

example/alloc_system.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
target_arch = "mips",
1313
target_arch = "mips32r6",
1414
target_arch = "powerpc",
15+
target_arch = "csky",
1516
target_arch = "powerpc64"))]
1617
const MIN_ALIGN: usize = 8;
1718
#[cfg(any(target_arch = "x86_64",

example/mini_core.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,15 @@ fn panic_cannot_unwind() -> ! {
429429
}
430430
}
431431

432+
#[lang = "panic_in_cleanup"]
433+
#[rustc_nounwind]
434+
fn panic_in_cleanup() -> ! {
435+
unsafe {
436+
libc::printf("panic in a destructor during cleanup\n\0" as *const str as *const i8);
437+
intrinsics::abort();
438+
}
439+
}
440+
432441
#[lang = "panic_bounds_check"]
433442
#[track_caller]
434443
fn panic_bounds_check(index: usize, len: usize) -> ! {

failing-ui-tests.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,6 @@ tests/ui/lto/thin-lto-global-allocator.rs
6868
tests/ui/lto/msvc-imp-present.rs
6969
tests/ui/lto/lto-thin-rustc-loads-linker-plugin.rs
7070
tests/ui/lto/all-crates.rs
71+
tests/ui/async-await/deep-futures-are-freeze.rs
72+
tests/ui/closures/capture-unsized-by-ref.rs
73+
tests/ui/generator/resume-after-return.rs

rust-toolchain

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

src/abi.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ impl<'gcc, 'tcx> FnAbiGccExt<'gcc, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
115115
match self.ret.mode {
116116
PassMode::Ignore => cx.type_void(),
117117
PassMode::Direct(_) | PassMode::Pair(..) => self.ret.layout.immediate_gcc_type(cx),
118-
PassMode::Cast(ref cast, _) => cast.gcc_type(cx),
118+
PassMode::Cast { ref cast, .. } => cast.gcc_type(cx),
119119
PassMode::Indirect { .. } => {
120120
argument_tys.push(cx.type_ptr_to(self.ret.memory_ty(cx)));
121121
cx.type_void()
@@ -141,30 +141,30 @@ impl<'gcc, 'tcx> FnAbiGccExt<'gcc, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
141141
let arg_ty = match arg.mode {
142142
PassMode::Ignore => continue,
143143
PassMode::Pair(a, b) => {
144-
argument_tys.push(apply_attrs(arg.layout.scalar_pair_element_gcc_type(cx, 0, true), &a));
145-
argument_tys.push(apply_attrs(arg.layout.scalar_pair_element_gcc_type(cx, 1, true), &b));
144+
argument_tys.push(apply_attrs(arg.layout.scalar_pair_element_gcc_type(cx, 0), &a));
145+
argument_tys.push(apply_attrs(arg.layout.scalar_pair_element_gcc_type(cx, 1), &b));
146146
continue;
147147
}
148-
PassMode::Cast(ref cast, pad_i32) => {
148+
PassMode::Cast { ref cast, pad_i32 } => {
149149
// add padding
150150
if pad_i32 {
151151
argument_tys.push(Reg::i32().gcc_type(cx));
152152
}
153153
let ty = cast.gcc_type(cx);
154154
apply_attrs(ty, &cast.attrs)
155155
}
156-
PassMode::Indirect { attrs: _, extra_attrs: None, on_stack: true } => {
156+
PassMode::Indirect { attrs: _, meta_attrs: None, on_stack: true } => {
157157
// This is a "byval" argument, so we don't apply the `restrict` attribute on it.
158158
on_stack_param_indices.insert(argument_tys.len());
159159
arg.memory_ty(cx)
160160
},
161161
PassMode::Direct(attrs) => apply_attrs(arg.layout.immediate_gcc_type(cx), &attrs),
162-
PassMode::Indirect { attrs, extra_attrs: None, on_stack: false } => {
162+
PassMode::Indirect { attrs, meta_attrs: None, on_stack: false } => {
163163
apply_attrs(cx.type_ptr_to(arg.memory_ty(cx)), &attrs)
164164
}
165-
PassMode::Indirect { attrs, extra_attrs: Some(extra_attrs), on_stack } => {
165+
PassMode::Indirect { attrs, meta_attrs: Some(meta_attrs), on_stack } => {
166166
assert!(!on_stack);
167-
apply_attrs(apply_attrs(cx.type_ptr_to(arg.memory_ty(cx)), &attrs), &extra_attrs)
167+
apply_attrs(apply_attrs(cx.type_ptr_to(arg.memory_ty(cx)), &attrs), &meta_attrs)
168168
}
169169
};
170170
argument_tys.push(arg_ty);

src/asm.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ enum ConstraintOrRegister {
107107

108108

109109
impl<'a, 'gcc, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
110-
fn codegen_inline_asm(&mut self, template: &[InlineAsmTemplatePiece], rust_operands: &[InlineAsmOperandRef<'tcx, Self>], options: InlineAsmOptions, span: &[Span], _instance: Instance<'_>, _dest_catch_funclet: Option<(Self::BasicBlock, Self::BasicBlock, Option<&Self::Funclet>)>) {
110+
fn codegen_inline_asm(&mut self, template: &[InlineAsmTemplatePiece], rust_operands: &[InlineAsmOperandRef<'tcx, Self>], options: InlineAsmOptions, span: &[Span], instance: Instance<'_>, _dest_catch_funclet: Option<(Self::BasicBlock, Self::BasicBlock, Option<&Self::Funclet>)>) {
111111
if options.contains(InlineAsmOptions::MAY_UNWIND) {
112112
self.sess()
113113
.create_err(UnwindingInlineAsm { span: span[0] })
@@ -173,7 +173,7 @@ impl<'a, 'gcc, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
173173
let is_target_supported = reg.reg_class().supported_types(asm_arch).iter()
174174
.any(|&(_, feature)| {
175175
if let Some(feature) = feature {
176-
self.tcx.sess.target_features.contains(&feature)
176+
self.tcx.asm_target_features(instance.def_id()).contains(&feature)
177177
} else {
178178
true // Register class is unconditionally supported
179179
}
@@ -593,6 +593,8 @@ fn reg_to_gcc(reg: InlineAsmRegOrRegClass) -> ConstraintOrRegister {
593593
InlineAsmRegClass::M68k(M68kInlineAsmRegClass::reg) => "r",
594594
InlineAsmRegClass::M68k(M68kInlineAsmRegClass::reg_addr) => "a",
595595
InlineAsmRegClass::M68k(M68kInlineAsmRegClass::reg_data) => "d",
596+
InlineAsmRegClass::CSKY(CSKYInlineAsmRegClass::reg) => "r",
597+
InlineAsmRegClass::CSKY(CSKYInlineAsmRegClass::freg) => "f",
596598
InlineAsmRegClass::Mips(MipsInlineAsmRegClass::reg) => "d", // more specific than "r"
597599
InlineAsmRegClass::Mips(MipsInlineAsmRegClass::freg) => "f",
598600
InlineAsmRegClass::Msp430(Msp430InlineAsmRegClass::reg) => "r",
@@ -669,6 +671,8 @@ fn dummy_output_type<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, reg: InlineAsmRegCl
669671
InlineAsmRegClass::M68k(M68kInlineAsmRegClass::reg) => cx.type_i32(),
670672
InlineAsmRegClass::M68k(M68kInlineAsmRegClass::reg_addr) => cx.type_i32(),
671673
InlineAsmRegClass::M68k(M68kInlineAsmRegClass::reg_data) => cx.type_i32(),
674+
InlineAsmRegClass::CSKY(CSKYInlineAsmRegClass::reg) => cx.type_i32(),
675+
InlineAsmRegClass::CSKY(CSKYInlineAsmRegClass::freg) => cx.type_f32(),
672676
InlineAsmRegClass::Mips(MipsInlineAsmRegClass::reg) => cx.type_i32(),
673677
InlineAsmRegClass::Mips(MipsInlineAsmRegClass::freg) => cx.type_f32(),
674678
InlineAsmRegClass::Msp430(_) => unimplemented!(),
@@ -856,6 +860,7 @@ fn modifier_to_gcc(arch: InlineAsmArch, reg: InlineAsmRegClass, modifier: Option
856860
InlineAsmRegClass::S390x(_) => None,
857861
InlineAsmRegClass::Msp430(_) => None,
858862
InlineAsmRegClass::M68k(_) => None,
863+
InlineAsmRegClass::CSKY(_) => None,
859864
InlineAsmRegClass::SpirV(SpirVInlineAsmRegClass::reg) => {
860865
bug!("LLVM backend does not support SPIR-V")
861866
}

src/builder.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -656,15 +656,15 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
656656
}
657657

658658
fn unchecked_sadd(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
659-
a + b
659+
self.gcc_add(a, b)
660660
}
661661

662662
fn unchecked_uadd(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
663663
self.gcc_add(a, b)
664664
}
665665

666666
fn unchecked_ssub(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
667-
a - b
667+
self.gcc_sub(a, b)
668668
}
669669

670670
fn unchecked_usub(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
@@ -673,11 +673,11 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
673673
}
674674

675675
fn unchecked_smul(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
676-
a * b
676+
self.gcc_mul(a, b)
677677
}
678678

679679
fn unchecked_umul(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
680-
a * b
680+
self.gcc_mul(a, b)
681681
}
682682

683683
fn fadd_fast(&mut self, lhs: RValue<'gcc>, rhs: RValue<'gcc>) -> RValue<'gcc> {
@@ -814,7 +814,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
814814

815815
let mut load = |i, scalar: &abi::Scalar, align| {
816816
let llptr = self.struct_gep(pair_type, place.llval, i as u64);
817-
let llty = place.layout.scalar_pair_element_gcc_type(self, i, false);
817+
let llty = place.layout.scalar_pair_element_gcc_type(self, i);
818818
let load = self.load(llty, llptr, align);
819819
scalar_load_metadata(self, load, scalar);
820820
if scalar.is_bool() { self.trunc(load, self.type_i1()) } else { load }
@@ -1421,7 +1421,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
14211421
self.cx
14221422
}
14231423

1424-
fn do_not_inline(&mut self, _llret: RValue<'gcc>) {
1424+
fn apply_attrs_to_cleanup_callsite(&mut self, _llret: RValue<'gcc>) {
14251425
// FIXME(bjorn3): implement
14261426
}
14271427

src/callee.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ pub fn get_fn<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, instance: Instance<'tcx>)
100100
// whether we are sharing generics or not. The important thing here is
101101
// that the visibility we apply to the declaration is the same one that
102102
// has been applied to the definition (wherever that definition may be).
103-
let is_generic = instance.args.non_erasable_generics().next().is_some();
103+
let is_generic = instance.args.non_erasable_generics(tcx, instance.def_id()).next().is_some();
104104

105105
if is_generic {
106106
// This is a monomorphization. Its expected visibility depends

src/context.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use rustc_codegen_ssa::traits::{
77
BaseTypeMethods,
88
MiscMethods,
99
};
10+
use rustc_codegen_ssa::errors as ssa_errors;
1011
use rustc_data_structures::base_n;
1112
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
1213
use rustc_middle::span_bug;
@@ -479,7 +480,7 @@ impl<'gcc, 'tcx> LayoutOfHelpers<'tcx> for CodegenCx<'gcc, 'tcx> {
479480
if let LayoutError::SizeOverflow(_) | LayoutError::ReferencesError(_) = err {
480481
self.sess().emit_fatal(respan(span, err.into_diagnostic()))
481482
} else {
482-
span_bug!(span, "failed to get layout for `{}`: {}", ty, err)
483+
self.tcx.sess.emit_fatal(ssa_errors::FailedToGetLayout { span, ty, err })
483484
}
484485
}
485486
}

src/debuginfo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl<'gcc, 'tcx> DebugInfoMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
5555
_fn_abi: &FnAbi<'tcx, Ty<'tcx>>,
5656
_llfn: RValue<'gcc>,
5757
_mir: &mir::Body<'tcx>,
58-
) -> Option<FunctionDebugContext<Self::DIScope, Self::DILocation>> {
58+
) -> Option<FunctionDebugContext<'tcx, Self::DIScope, Self::DILocation>> {
5959
// TODO(antoyo)
6060
None
6161
}

0 commit comments

Comments
 (0)