diff --git a/rustfmt.toml b/rustfmt.toml index f17c038899c..24d300e91fa 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -14,7 +14,7 @@ ignore = [ # - some contain syntax errors that cause rustfmt to give an error # - some UI tests are broken by different formatting # - some require special comments in a particular position (e.g. `EMIT_MIR` comments) - "/tests/codegen/", + "/tests/codegen/simd-intrinsic/", # Many types like `u8x64` are better hand-formatted. "/tests/codegen-units/", "/tests/coverage/", "/tests/coverage-run-rustdoc/", diff --git a/tests/codegen/aarch64-struct-align-128.rs b/tests/codegen/aarch64-struct-align-128.rs index 0a30a2527da..d1b4132d501 100644 --- a/tests/codegen/aarch64-struct-align-128.rs +++ b/tests/codegen/aarch64-struct-align-128.rs @@ -12,14 +12,12 @@ #![crate_type = "lib"] #![no_core] -#[lang="sized"] -trait Sized { } -#[lang="freeze"] -trait Freeze { } -#[lang="copy"] -trait Copy { } - - +#[lang = "sized"] +trait Sized {} +#[lang = "freeze"] +trait Freeze {} +#[lang = "copy"] +trait Copy {} // Passed as `[i64 x 2]`, since it's an aggregate with size <= 128 bits, align < 128 bits. #[repr(C)] @@ -31,7 +29,7 @@ pub struct Align8 { // repr(transparent), so same as above. #[repr(transparent)] pub struct Transparent8 { - a: Align8 + a: Align8, } // Passed as `[i64 x 2]`, since it's an aggregate with size <= 128 bits, align < 128 bits. @@ -47,8 +45,6 @@ pub struct Wrapped8 { fn test_8(a: Align8, b: Transparent8, c: Wrapped8); } - - // Passed as `i128`, since it's an aggregate with size <= 128 bits, align = 128 bits. // EXCEPT on Linux, where there's a special case to use its unadjusted alignment, // making it the same as `Align8`, so it's be passed as `[i64 x 2]`. @@ -62,7 +58,7 @@ pub struct Align16 { // repr(transparent), so same as above. #[repr(transparent)] pub struct Transparent16 { - a: Align16 + a: Align16, } // Passed as `i128`, since it's an aggregate with size <= 128 bits, align = 128 bits. @@ -79,8 +75,6 @@ pub struct Wrapped16 { fn test_16(a: Align16, b: Transparent16, c: Wrapped16); } - - // Passed as `i128`, since it's an aggregate with size <= 128 bits, align = 128 bits. #[repr(C)] pub struct I128 { @@ -90,13 +84,13 @@ pub struct I128 { // repr(transparent), so same as above. #[repr(transparent)] pub struct TransparentI128 { - a: I128 + a: I128, } // Passed as `i128`, since it's an aggregate with size <= 128 bits, align = 128 bits. #[repr(C)] pub struct WrappedI128 { - pub a: I128 + pub a: I128, } extern "C" { @@ -106,8 +100,6 @@ pub struct WrappedI128 { fn test_i128(a: I128, b: TransparentI128, c: WrappedI128); } - - // Passed as `[2 x i64]`, since it's an aggregate with size <= 128 bits, align < 128 bits. // Note that the Linux special case does not apply, because packing is not considered "adjustment". #[repr(C)] @@ -119,13 +111,13 @@ pub struct Packed { // repr(transparent), so same as above. #[repr(transparent)] pub struct TransparentPacked { - a: Packed + a: Packed, } // Passed as `[2 x i64]`, since it's an aggregate with size <= 128 bits, align < 128 bits. #[repr(C)] pub struct WrappedPacked { - pub a: Packed + pub a: Packed, } extern "C" { @@ -135,13 +127,19 @@ pub struct WrappedPacked { fn test_packed(a: Packed, b: TransparentPacked, c: WrappedPacked); } - - pub unsafe fn main( - a1: Align8, a2: Transparent8, a3: Wrapped8, - b1: Align16, b2: Transparent16, b3: Wrapped16, - c1: I128, c2: TransparentI128, c3: WrappedI128, - d1: Packed, d2: TransparentPacked, d3: WrappedPacked, + a1: Align8, + a2: Transparent8, + a3: Wrapped8, + b1: Align16, + b2: Transparent16, + b3: Wrapped16, + c1: I128, + c2: TransparentI128, + c3: WrappedI128, + d1: Packed, + d2: TransparentPacked, + d3: WrappedPacked, ) { test_8(a1, a2, a3); test_16(b1, b2, b3); diff --git a/tests/codegen/abi-efiapi.rs b/tests/codegen/abi-efiapi.rs index fa73f649ed8..986d042268a 100644 --- a/tests/codegen/abi-efiapi.rs +++ b/tests/codegen/abi-efiapi.rs @@ -17,12 +17,12 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang="sized"] -trait Sized { } -#[lang="freeze"] -trait Freeze { } -#[lang="copy"] -trait Copy { } +#[lang = "sized"] +trait Sized {} +#[lang = "freeze"] +trait Freeze {} +#[lang = "copy"] +trait Copy {} //x86_64: define win64cc void @has_efiapi //i686: define void @has_efiapi diff --git a/tests/codegen/abi-main-signature-16bit-c-int.rs b/tests/codegen/abi-main-signature-16bit-c-int.rs index 9832088ab33..d44b80475e4 100644 --- a/tests/codegen/abi-main-signature-16bit-c-int.rs +++ b/tests/codegen/abi-main-signature-16bit-c-int.rs @@ -6,8 +6,6 @@ //@[avr] only-avr //@[msp] only-msp430 - -fn main() { -} +fn main() {} // CHECK: define i16 @main(i16, i8**) diff --git a/tests/codegen/abi-main-signature-32bit-c-int.rs b/tests/codegen/abi-main-signature-32bit-c-int.rs index 7684024a2e3..ce475adde44 100644 --- a/tests/codegen/abi-main-signature-32bit-c-int.rs +++ b/tests/codegen/abi-main-signature-32bit-c-int.rs @@ -6,7 +6,6 @@ //@ ignore-avr //@ ignore-wasi wasi codegens the main symbol differently -fn main() { -} +fn main() {} // CHECK: define{{( hidden| noundef)*}} i32 @main(i32{{( %0)?}}, ptr{{( %1)?}}) diff --git a/tests/codegen/abi-repr-ext.rs b/tests/codegen/abi-repr-ext.rs index 2e100a37235..a42f7356696 100644 --- a/tests/codegen/abi-repr-ext.rs +++ b/tests/codegen/abi-repr-ext.rs @@ -24,14 +24,17 @@ #![no_std] #![no_core] -#[lang="sized"] trait Sized { } -#[lang="freeze"] trait Freeze { } -#[lang="copy"] trait Copy { } +#[lang = "sized"] +trait Sized {} +#[lang = "freeze"] +trait Freeze {} +#[lang = "copy"] +trait Copy {} #[repr(i8)] pub enum Type { Type1 = 0, - Type2 = 1 + Type2 = 1, } // To accommodate rust#97800, one might consider writing the below as: @@ -50,7 +53,6 @@ pub enum Type { // riscv-SAME: signext // CHECK-SAME: i8 @test() - #[no_mangle] pub extern "C" fn test() -> Type { Type::Type1 diff --git a/tests/codegen/abi-x86_64_sysv.rs b/tests/codegen/abi-x86_64_sysv.rs index 659c1d93e20..09909f994d6 100644 --- a/tests/codegen/abi-x86_64_sysv.rs +++ b/tests/codegen/abi-x86_64_sysv.rs @@ -5,25 +5,25 @@ #![crate_type = "lib"] pub struct S24 { - a: i8, - b: i8, - c: i8, + a: i8, + b: i8, + c: i8, } pub struct S48 { - a: i16, - b: i16, - c: i8, + a: i16, + b: i16, + c: i8, } // CHECK: i24 @struct_24_bits(i24 #[no_mangle] pub extern "sysv64" fn struct_24_bits(a: S24) -> S24 { - a + a } // CHECK: i48 @struct_48_bits(i48 #[no_mangle] pub extern "sysv64" fn struct_48_bits(a: S48) -> S48 { - a + a } diff --git a/tests/codegen/adjustments.rs b/tests/codegen/adjustments.rs index 549a9737eb1..7f7831def08 100644 --- a/tests/codegen/adjustments.rs +++ b/tests/codegen/adjustments.rs @@ -5,17 +5,16 @@ // Hack to get the correct size for the length part in slices // CHECK: @helper([[USIZE:i[0-9]+]] %_1) #[no_mangle] -pub fn helper(_: usize) { -} +pub fn helper(_: usize) {} // CHECK-LABEL: @no_op_slice_adjustment #[no_mangle] pub fn no_op_slice_adjustment(x: &[u8]) -> &[u8] { // We used to generate an extra alloca and memcpy for the block's trailing expression value, so // check that we copy directly to the return value slot -// CHECK: %0 = insertvalue { ptr, [[USIZE]] } poison, ptr %x.0, 0 -// CHECK: %1 = insertvalue { ptr, [[USIZE]] } %0, [[USIZE]] %x.1, 1 -// CHECK: ret { ptr, [[USIZE]] } %1 + // CHECK: %0 = insertvalue { ptr, [[USIZE]] } poison, ptr %x.0, 0 + // CHECK: %1 = insertvalue { ptr, [[USIZE]] } %0, [[USIZE]] %x.1, 1 + // CHECK: ret { ptr, [[USIZE]] } %1 { x } } @@ -24,6 +23,6 @@ pub fn no_op_slice_adjustment(x: &[u8]) -> &[u8] { pub fn no_op_slice_adjustment2(x: &[u8]) -> &[u8] { // We used to generate an extra alloca and memcpy for the function's return value, so check // that there's no memcpy (the slice is written to sret_slot element-wise) -// CHECK-NOT: call void @llvm.memcpy. + // CHECK-NOT: call void @llvm.memcpy. no_op_slice_adjustment(x) } diff --git a/tests/codegen/align-byval.rs b/tests/codegen/align-byval.rs index 3a2be2b2b9c..223696229cb 100644 --- a/tests/codegen/align-byval.rs +++ b/tests/codegen/align-byval.rs @@ -23,9 +23,12 @@ #![no_std] #![no_core] -#[lang="sized"] trait Sized { } -#[lang="freeze"] trait Freeze { } -#[lang="copy"] trait Copy { } +#[lang = "sized"] +trait Sized {} +#[lang = "freeze"] +trait Freeze {} +#[lang = "copy"] +trait Copy {} impl Copy for i32 {} impl Copy for i64 {} @@ -58,7 +61,7 @@ pub struct ForceAlign4 { pub struct NaturalAlign8 { a: i64, b: i64, - c: i64 + c: i64, } // On i686-windows, this is passed by reference (because alignment is >4 and requested/forced), @@ -68,7 +71,7 @@ pub struct NaturalAlign8 { pub struct ForceAlign8 { a: i64, b: i64, - c: i64 + c: i64, } // On i686-windows, this is passed on stack, because requested alignment is <=4. @@ -77,28 +80,28 @@ pub struct ForceAlign8 { pub struct LowerFA8 { a: i64, b: i64, - c: i64 + c: i64, } // On i686-windows, this is passed by reference, because it contains a field with // requested/forced alignment. #[repr(C)] pub struct WrappedFA8 { - a: ForceAlign8 + a: ForceAlign8, } // On i686-windows, this has the same ABI as ForceAlign8, i.e. passed by reference. #[repr(transparent)] pub struct TransparentFA8 { _0: (), - a: ForceAlign8 + a: ForceAlign8, } #[repr(C)] #[repr(align(16))] pub struct ForceAlign16 { a: [i32; 16], - b: i8 + b: i8, } // CHECK-LABEL: @call_na1 diff --git a/tests/codegen/align-enum.rs b/tests/codegen/align-enum.rs index 93d5a87fb30..e8dd95d3afb 100644 --- a/tests/codegen/align-enum.rs +++ b/tests/codegen/align-enum.rs @@ -18,8 +18,8 @@ pub struct Nested64 { // CHECK-LABEL: @align64 #[no_mangle] pub fn align64(a: u32) -> Align64 { -// CHECK: %a64 = alloca [64 x i8], align 64 -// CHECK: call void @llvm.memcpy.{{.*}}(ptr align 64 %{{.*}}, ptr align 64 %{{.*}}, i{{[0-9]+}} 64, i1 false) + // CHECK: %a64 = alloca [64 x i8], align 64 + // CHECK: call void @llvm.memcpy.{{.*}}(ptr align 64 %{{.*}}, ptr align 64 %{{.*}}, i{{[0-9]+}} 64, i1 false) let a64 = Align64::A(a); a64 } @@ -27,7 +27,7 @@ pub fn align64(a: u32) -> Align64 { // CHECK-LABEL: @nested64 #[no_mangle] pub fn nested64(a: u8, b: u32, c: u16) -> Nested64 { -// CHECK: %n64 = alloca [128 x i8], align 64 + // CHECK: %n64 = alloca [128 x i8], align 64 let n64 = Nested64 { a, b: Align64::B(b), c }; n64 } diff --git a/tests/codegen/align-offset.rs b/tests/codegen/align-offset.rs index 15b11f413cb..aeac230f718 100644 --- a/tests/codegen/align-offset.rs +++ b/tests/codegen/align-offset.rs @@ -53,7 +53,6 @@ pub fn align_offset_word_slice(slice: &[Align4]) -> usize { slice.as_ptr().align_offset(32) } - // CHECK-LABEL: @align_offset_word_ptr(ptr{{.+}}%ptr #[no_mangle] pub fn align_offset_word_ptr(ptr: *const Align4) -> usize { diff --git a/tests/codegen/align-struct.rs b/tests/codegen/align-struct.rs index e70b42b47db..cc65b08a922 100644 --- a/tests/codegen/align-struct.rs +++ b/tests/codegen/align-struct.rs @@ -25,9 +25,9 @@ pub enum Enum64 { // CHECK-LABEL: @align64 #[no_mangle] -pub fn align64(i : i32) -> Align64 { -// CHECK: %a64 = alloca [64 x i8], align 64 -// CHECK: call void @llvm.memcpy.{{.*}}(ptr align 64 %{{.*}}, ptr align 64 %{{.*}}, i{{[0-9]+}} 64, i1 false) +pub fn align64(i: i32) -> Align64 { + // CHECK: %a64 = alloca [64 x i8], align 64 + // CHECK: call void @llvm.memcpy.{{.*}}(ptr align 64 %{{.*}}, ptr align 64 %{{.*}}, i{{[0-9]+}} 64, i1 false) let a64 = Align64(i); a64 } @@ -37,14 +37,14 @@ pub fn align64(i : i32) -> Align64 { // CHECK-LABEL: @align64_load #[no_mangle] pub fn align64_load(a: Align64) -> i32 { -// CHECK: {{%.*}} = load i32, ptr {{%.*}}, align 64 + // CHECK: {{%.*}} = load i32, ptr {{%.*}}, align 64 a.0 } // CHECK-LABEL: @nested64 #[no_mangle] pub fn nested64(a: Align64, b: i32, c: i32, d: i8) -> Nested64 { -// CHECK: %n64 = alloca [128 x i8], align 64 + // CHECK: %n64 = alloca [128 x i8], align 64 let n64 = Nested64 { a, b, c, d }; n64 } @@ -52,7 +52,7 @@ pub fn nested64(a: Align64, b: i32, c: i32, d: i8) -> Nested64 { // CHECK-LABEL: @enum4 #[no_mangle] pub fn enum4(a: i32) -> Enum4 { -// CHECK: %e4 = alloca [8 x i8], align 4 + // CHECK: %e4 = alloca [8 x i8], align 4 let e4 = Enum4::A(a); e4 } @@ -60,7 +60,7 @@ pub fn enum4(a: i32) -> Enum4 { // CHECK-LABEL: @enum64 #[no_mangle] pub fn enum64(a: Align64) -> Enum64 { -// CHECK: %e64 = alloca [128 x i8], align 64 + // CHECK: %e64 = alloca [128 x i8], align 64 let e64 = Enum64::A(a); e64 } diff --git a/tests/codegen/array-cmp.rs b/tests/codegen/array-cmp.rs index 194c0adf1d2..2565a385b61 100644 --- a/tests/codegen/array-cmp.rs +++ b/tests/codegen/array-cmp.rs @@ -10,9 +10,10 @@ #[no_mangle] pub fn compare() -> bool { let bytes = 12.5f32.to_ne_bytes(); - bytes == if cfg!(target_endian = "big") { - [0x41, 0x48, 0x00, 0x00] - } else { - [0x00, 0x00, 0x48, 0x41] - } + bytes + == if cfg!(target_endian = "big") { + [0x41, 0x48, 0x00, 0x00] + } else { + [0x00, 0x00, 0x48, 0x41] + } } diff --git a/tests/codegen/asm-maybe-uninit.rs b/tests/codegen/asm-maybe-uninit.rs index f9bf280b384..55813c35a46 100644 --- a/tests/codegen/asm-maybe-uninit.rs +++ b/tests/codegen/asm-maybe-uninit.rs @@ -4,8 +4,8 @@ #![crate_type = "rlib"] #![allow(asm_sub_register)] -use std::mem::MaybeUninit; use std::arch::asm; +use std::mem::MaybeUninit; // CHECK-LABEL: @int #[no_mangle] diff --git a/tests/codegen/asm-sanitize-llvm.rs b/tests/codegen/asm-sanitize-llvm.rs index 8638ed2236a..fb332f9a0f3 100644 --- a/tests/codegen/asm-sanitize-llvm.rs +++ b/tests/codegen/asm-sanitize-llvm.rs @@ -21,14 +21,10 @@ trait Copy {} pub unsafe fn we_escape_dollar_signs() { // CHECK: call void asm sideeffect alignstack inteldialect "banana$$:" - asm!( - r"banana$:", - ) + asm!(r"banana$:",) } pub unsafe fn we_escape_escapes_too() { // CHECK: call void asm sideeffect alignstack inteldialect "banana\{{(\\|5C)}}36:" - asm!( - r"banana\36:", - ) + asm!(r"banana\36:",) } diff --git a/tests/codegen/atomicptr.rs b/tests/codegen/atomicptr.rs index cbbd5615512..ea8b382c8fc 100644 --- a/tests/codegen/atomicptr.rs +++ b/tests/codegen/atomicptr.rs @@ -6,13 +6,12 @@ //@ compile-flags: -O -Cno-prepopulate-passes #![crate_type = "lib"] - #![feature(strict_provenance)] #![feature(strict_provenance_atomic_ptr)] +use std::ptr::without_provenance_mut; use std::sync::atomic::AtomicPtr; use std::sync::atomic::Ordering::Relaxed; -use std::ptr::without_provenance_mut; // Portability hack so that we can say [[USIZE]] instead of i64/i32/i16 for usize. // CHECK: @helper([[USIZE:i[0-9]+]] noundef %_1) diff --git a/tests/codegen/autovectorize-f32x4.rs b/tests/codegen/autovectorize-f32x4.rs index 90c9f369104..254362842f9 100644 --- a/tests/codegen/autovectorize-f32x4.rs +++ b/tests/codegen/autovectorize-f32x4.rs @@ -5,25 +5,20 @@ // CHECK-LABEL: @auto_vectorize_direct #[no_mangle] pub fn auto_vectorize_direct(a: [f32; 4], b: [f32; 4]) -> [f32; 4] { -// CHECK: load <4 x float> -// CHECK: load <4 x float> -// CHECK: fadd <4 x float> -// CHECK: store <4 x float> - [ - a[0] + b[0], - a[1] + b[1], - a[2] + b[2], - a[3] + b[3], - ] + // CHECK: load <4 x float> + // CHECK: load <4 x float> + // CHECK: fadd <4 x float> + // CHECK: store <4 x float> + [a[0] + b[0], a[1] + b[1], a[2] + b[2], a[3] + b[3]] } // CHECK-LABEL: @auto_vectorize_loop #[no_mangle] pub fn auto_vectorize_loop(a: [f32; 4], b: [f32; 4]) -> [f32; 4] { -// CHECK: load <4 x float> -// CHECK: load <4 x float> -// CHECK: fadd <4 x float> -// CHECK: store <4 x float> + // CHECK: load <4 x float> + // CHECK: load <4 x float> + // CHECK: fadd <4 x float> + // CHECK: store <4 x float> let mut c = [0.0; 4]; for i in 0..4 { c[i] = a[i] + b[i]; @@ -34,9 +29,9 @@ // CHECK-LABEL: @auto_vectorize_array_from_fn #[no_mangle] pub fn auto_vectorize_array_from_fn(a: [f32; 4], b: [f32; 4]) -> [f32; 4] { -// CHECK: load <4 x float> -// CHECK: load <4 x float> -// CHECK: fadd <4 x float> -// CHECK: store <4 x float> + // CHECK: load <4 x float> + // CHECK: load <4 x float> + // CHECK: fadd <4 x float> + // CHECK: store <4 x float> std::array::from_fn(|i| a[i] + b[i]) } diff --git a/tests/codegen/auxiliary/extern_decl.rs b/tests/codegen/auxiliary/extern_decl.rs index edc48351869..d17e77b1444 100644 --- a/tests/codegen/auxiliary/extern_decl.rs +++ b/tests/codegen/auxiliary/extern_decl.rs @@ -5,7 +5,9 @@ #![crate_type = "lib"] #[no_mangle] -pub fn extern_fn() -> u8 { unsafe { extern_static } } +pub fn extern_fn() -> u8 { + unsafe { extern_static } +} #[no_mangle] pub static mut extern_static: u8 = 71; diff --git a/tests/codegen/auxiliary/nounwind.rs b/tests/codegen/auxiliary/nounwind.rs index 73c5aee3387..40f66442c6e 100644 --- a/tests/codegen/auxiliary/nounwind.rs +++ b/tests/codegen/auxiliary/nounwind.rs @@ -1,3 +1,2 @@ #[no_mangle] -pub fn bar() { -} +pub fn bar() {} diff --git a/tests/codegen/avr/avr-func-addrspace.rs b/tests/codegen/avr/avr-func-addrspace.rs index fb53abecfdb..2d9efb52c7c 100644 --- a/tests/codegen/avr/avr-func-addrspace.rs +++ b/tests/codegen/avr/avr-func-addrspace.rs @@ -14,15 +14,18 @@ #![no_core] #[lang = "sized"] -pub trait Sized { } +pub trait Sized {} #[lang = "copy"] -pub trait Copy { } +pub trait Copy {} #[lang = "receiver"] -pub trait Receiver { } +pub trait Receiver {} #[lang = "tuple_trait"] -pub trait Tuple { } +pub trait Tuple {} -pub struct Result { _a: T, _b: E } +pub struct Result { + _a: T, + _b: E, +} impl Copy for usize {} impl Copy for &usize {} @@ -39,7 +42,7 @@ pub trait FnOnce { } #[lang = "fn_mut"] -pub trait FnMut : FnOnce { +pub trait FnMut: FnOnce { extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output; } @@ -64,7 +67,7 @@ fn arbitrary_black_box(ptr: &usize, _: &mut u32) -> Result<(), ()> { #[inline(never)] #[no_mangle] -fn call_through_fn_trait(a: &mut impl Fn<(), Output=()>) { +fn call_through_fn_trait(a: &mut impl Fn<(), Output = ()>) { (*a)() } @@ -110,7 +113,10 @@ pub unsafe fn transmute_fn_ptr_to_data(x: fn()) -> *const () { transmute(x) } -pub enum Either { A(T), B(U) } +pub enum Either { + A(T), + B(U), +} // Previously, we would codegen this as passing/returning a scalar pair of `{ i8, ptr }`, // with the `ptr` field representing both `&i32` and `fn()` depending on the variant. diff --git a/tests/codegen/binary-search-index-no-bound-check.rs b/tests/codegen/binary-search-index-no-bound-check.rs index 96f6bb54b3f..a213c015a40 100644 --- a/tests/codegen/binary-search-index-no-bound-check.rs +++ b/tests/codegen/binary-search-index-no-bound-check.rs @@ -11,11 +11,7 @@ pub fn binary_search_index_no_bounds_check(s: &[u8]) -> u8 { // CHECK-NOT: slice_start_index_len_fail // CHECK-NOT: slice_end_index_len_fail // CHECK-NOT: panic_bounds_check - if let Ok(idx) = s.binary_search(&b'\\') { - s[idx] - } else { - 42 - } + if let Ok(idx) = s.binary_search(&b'\\') { s[idx] } else { 42 } } // Similarly, check that `partition_point` is known to return a valid fencepost. diff --git a/tests/codegen/bool-cmp.rs b/tests/codegen/bool-cmp.rs index 29ee3e0627b..71d3411689f 100644 --- a/tests/codegen/bool-cmp.rs +++ b/tests/codegen/bool-cmp.rs @@ -10,9 +10,9 @@ // CHECK-LABEL: @cmp_bool #[no_mangle] pub fn cmp_bool(a: bool, b: bool) -> Ordering { -// LLVM 10 produces (zext a) + (sext b), but the final lowering is (zext a) - (zext b). -// CHECK: zext i1 -// CHECK: {{z|s}}ext i1 -// CHECK: {{sub|add}} nsw + // LLVM 10 produces (zext a) + (sext b), but the final lowering is (zext a) - (zext b). + // CHECK: zext i1 + // CHECK: {{z|s}}ext i1 + // CHECK: {{sub|add}} nsw a.cmp(&b) } diff --git a/tests/codegen/branch-protection.rs b/tests/codegen/branch-protection.rs index 0961b1b9f52..a29ec67d578 100644 --- a/tests/codegen/branch-protection.rs +++ b/tests/codegen/branch-protection.rs @@ -12,12 +12,11 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang="sized"] -trait Sized { } +#[lang = "sized"] +trait Sized {} // A basic test function. -pub fn test() { -} +pub fn test() {} // BTI: !"branch-target-enforcement", i32 1 // BTI: !"sign-return-address", i32 0 diff --git a/tests/codegen/cast-target-abi.rs b/tests/codegen/cast-target-abi.rs index 9c31acc9bb7..c6a8b7bbf37 100644 --- a/tests/codegen/cast-target-abi.rs +++ b/tests/codegen/cast-target-abi.rs @@ -18,9 +18,12 @@ #![no_std] #![no_core] -#[lang="sized"] trait Sized { } -#[lang="freeze"] trait Freeze { } -#[lang="copy"] trait Copy { } +#[lang = "sized"] +trait Sized {} +#[lang = "freeze"] +trait Freeze {} +#[lang = "copy"] +trait Copy {} // This struct will be passed as a single `i64` or `i32`. // This may be (if `i64)) larger than the Rust layout, which is just `{ i16, i16 }`. @@ -104,7 +107,6 @@ pub unsafe fn return_twou16s() -> TwoU16s { // powerpc64: [[RETVAL:%.+]] = alloca [4 x i8], align 2 // powerpc64: call void @returns_twou16s(ptr {{.+}} [[RETVAL]]) - // The other targets copy the cast ABI type to an alloca. // aarch64: [[ABI_ALLOCA:%.+]] = alloca [8 x i8], align [[ABI_ALIGN:8]] @@ -151,7 +153,6 @@ pub unsafe fn return_fiveu16s() -> FiveU16s { // powerpc64: call void @returns_fiveu16s(ptr {{.+}} [[RET_PTR]]) - // The other targets copy the cast ABI type to the sret pointer. // aarch64: [[ABI_ALLOCA:%.+]] = alloca [16 x i8], align [[ABI_ALIGN:8]] @@ -199,7 +200,6 @@ pub unsafe fn return_doubledouble() -> DoubleDouble { // powerpc64: [[RETVAL:%.+]] = alloca [16 x i8], align 8 // powerpc64: call void @returns_doubledouble(ptr {{.+}} [[RETVAL]]) - // The other targets copy the cast ABI type to an alloca. // aarch64: [[ABI_ALLOCA:%.+]] = alloca [16 x i8], align [[ABI_ALIGN:8]] @@ -266,7 +266,6 @@ pub unsafe fn return_doublefloat() -> DoubleFloat { // powerpc64: [[RETVAL:%.+]] = alloca [16 x i8], align 8 // powerpc64: call void @returns_doublefloat(ptr {{.+}} [[RETVAL]]) - // The other targets copy the cast ABI type to an alloca. // aarch64: [[ABI_ALLOCA:%.+]] = alloca [16 x i8], align [[ABI_ALIGN:8]] diff --git a/tests/codegen/cf-protection.rs b/tests/codegen/cf-protection.rs index 5120bbf114d..244d1eb2544 100644 --- a/tests/codegen/cf-protection.rs +++ b/tests/codegen/cf-protection.rs @@ -13,12 +13,11 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang="sized"] -trait Sized { } +#[lang = "sized"] +trait Sized {} // A basic test function. -pub fn test() { -} +pub fn test() {} // undefined-NOT: !"cf-protection-branch" // undefined-NOT: !"cf-protection-return" diff --git a/tests/codegen/cffi/ffi-const.rs b/tests/codegen/cffi/ffi-const.rs index 8044ad105d5..564b8f7f8d8 100644 --- a/tests/codegen/cffi/ffi-const.rs +++ b/tests/codegen/cffi/ffi-const.rs @@ -2,12 +2,15 @@ #![crate_type = "lib"] #![feature(ffi_const)] -pub fn bar() { unsafe { foo() } } +pub fn bar() { + unsafe { foo() } +} extern "C" { // CHECK-LABEL: declare{{.*}}void @foo() // CHECK-SAME: [[ATTRS:#[0-9]+]] // The attribute changed from `readnone` to `memory(none)` with LLVM 16.0. // CHECK-DAG: attributes [[ATTRS]] = { {{.*}}{{readnone|memory\(none\)}}{{.*}} } - #[ffi_const] pub fn foo(); + #[ffi_const] + pub fn foo(); } diff --git a/tests/codegen/cffi/ffi-out-of-bounds-loads.rs b/tests/codegen/cffi/ffi-out-of-bounds-loads.rs index 35bf00f8f3c..614d5d94f62 100644 --- a/tests/codegen/cffi/ffi-out-of-bounds-loads.rs +++ b/tests/codegen/cffi/ffi-out-of-bounds-loads.rs @@ -13,9 +13,12 @@ #![no_std] #![no_core] -#[lang="sized"] trait Sized { } -#[lang="freeze"] trait Freeze { } -#[lang="copy"] trait Copy { } +#[lang = "sized"] +trait Sized {} +#[lang = "freeze"] +trait Freeze {} +#[lang = "copy"] +trait Copy {} #[repr(C)] struct S { diff --git a/tests/codegen/cffi/ffi-pure.rs b/tests/codegen/cffi/ffi-pure.rs index 51135fd3753..601509d5c90 100644 --- a/tests/codegen/cffi/ffi-pure.rs +++ b/tests/codegen/cffi/ffi-pure.rs @@ -2,12 +2,15 @@ #![crate_type = "lib"] #![feature(ffi_pure)] -pub fn bar() { unsafe { foo() } } +pub fn bar() { + unsafe { foo() } +} extern "C" { // CHECK-LABEL: declare{{.*}}void @foo() // CHECK-SAME: [[ATTRS:#[0-9]+]] // The attribute changed from `readonly` to `memory(read)` with LLVM 16.0. // CHECK-DAG: attributes [[ATTRS]] = { {{.*}}{{readonly|memory\(read\)}}{{.*}} } - #[ffi_pure] pub fn foo(); + #[ffi_pure] + pub fn foo(); } diff --git a/tests/codegen/cfguard-checks.rs b/tests/codegen/cfguard-checks.rs index 2b09a5fe12c..cdf6406ad61 100644 --- a/tests/codegen/cfguard-checks.rs +++ b/tests/codegen/cfguard-checks.rs @@ -4,8 +4,7 @@ #![crate_type = "lib"] // A basic test function. -pub fn test() { -} +pub fn test() {} // Ensure the module flag cfguard=2 is present // CHECK: !"cfguard", i32 2 diff --git a/tests/codegen/cfguard-disabled.rs b/tests/codegen/cfguard-disabled.rs index 105e0207261..90915c0f0c6 100644 --- a/tests/codegen/cfguard-disabled.rs +++ b/tests/codegen/cfguard-disabled.rs @@ -4,8 +4,7 @@ #![crate_type = "lib"] // A basic test function. -pub fn test() { -} +pub fn test() {} // Ensure the module flag cfguard is not present // CHECK-NOT: !"cfguard" diff --git a/tests/codegen/cfguard-nochecks.rs b/tests/codegen/cfguard-nochecks.rs index 0443880d72d..5f386533ec1 100644 --- a/tests/codegen/cfguard-nochecks.rs +++ b/tests/codegen/cfguard-nochecks.rs @@ -4,8 +4,7 @@ #![crate_type = "lib"] // A basic test function. -pub fn test() { -} +pub fn test() {} // Ensure the module flag cfguard=1 is present // CHECK: !"cfguard", i32 1 diff --git a/tests/codegen/cfguard-non-msvc.rs b/tests/codegen/cfguard-non-msvc.rs index 5d266de8a94..1e6559aaf5d 100644 --- a/tests/codegen/cfguard-non-msvc.rs +++ b/tests/codegen/cfguard-non-msvc.rs @@ -4,8 +4,7 @@ #![crate_type = "lib"] // A basic test function. -pub fn test() { -} +pub fn test() {} // Ensure the cfguard module flag is not added for non-MSVC targets. // CHECK-NOT: !"cfguard" diff --git a/tests/codegen/coercions.rs b/tests/codegen/coercions.rs index a205e541df1..63c1742c639 100644 --- a/tests/codegen/coercions.rs +++ b/tests/codegen/coercions.rs @@ -7,7 +7,7 @@ // CHECK-LABEL: @raw_ptr_to_raw_ptr_noop // CHECK-NOT: alloca #[no_mangle] -pub fn raw_ptr_to_raw_ptr_noop() -> *const i32{ +pub fn raw_ptr_to_raw_ptr_noop() -> *const i32 { &X as *const i32 } diff --git a/tests/codegen/constant-branch.rs b/tests/codegen/constant-branch.rs index 3328b1eb4a8..a2710cc4b25 100644 --- a/tests/codegen/constant-branch.rs +++ b/tests/codegen/constant-branch.rs @@ -8,18 +8,10 @@ #[no_mangle] pub fn if_bool() { // CHECK: br label %{{.+}} - _ = if true { - 0 - } else { - 1 - }; + _ = if true { 0 } else { 1 }; // CHECK: br label %{{.+}} - _ = if false { - 0 - } else { - 1 - }; + _ = if false { 0 } else { 1 }; } // CHECK-LABEL: @if_constant_int_eq @@ -27,18 +19,10 @@ pub fn if_bool() { pub fn if_constant_int_eq() { let val = 0; // CHECK: br label %{{.+}} - _ = if val == 0 { - 0 - } else { - 1 - }; + _ = if val == 0 { 0 } else { 1 }; // CHECK: br label %{{.+}} - _ = if val == 1 { - 0 - } else { - 1 - }; + _ = if val == 1 { 0 } else { 1 }; } // CHECK-LABEL: @if_constant_match @@ -48,19 +32,19 @@ pub fn if_constant_match() { _ = match 1 { 1 => 2, 2 => 3, - _ => 4 + _ => 4, }; // CHECK: br label %{{.+}} _ = match 1 { 2 => 3, - _ => 4 + _ => 4, }; // CHECK: br label %[[MINUS1:.+]] _ = match -1 { - // CHECK: [[MINUS1]]: - // CHECK: store i32 1 + // CHECK: [[MINUS1]]: + // CHECK: store i32 1 -1 => 1, _ => 0, } diff --git a/tests/codegen/coroutine-debug-msvc.rs b/tests/codegen/coroutine-debug-msvc.rs index e2296db1d59..9e2ec3ea28a 100644 --- a/tests/codegen/coroutine-debug-msvc.rs +++ b/tests/codegen/coroutine-debug-msvc.rs @@ -11,7 +11,8 @@ use std::ops::Coroutine; fn coroutine_test() -> impl Coroutine { - #[coroutine] || { + #[coroutine] + || { yield 0; let s = String::from("foo"); yield 1; @@ -23,23 +24,23 @@ fn coroutine_test() -> impl Coroutine { // CHECK-DAG: [[GEN:!.*]] = !DICompositeType(tag: DW_TAG_union_type, name: "enum2$" // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "variant0", scope: [[GEN]], // For brevity, we only check the struct name and members of the last variant. -// CHECK-SAME: file: [[FILE:![0-9]*]], line: 14, +// CHECK-SAME: file: [[FILE:![0-9]*]], line: 15, // CHECK-NOT: flags: DIFlagArtificial // CHECK-SAME: ) // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "variant1", scope: [[GEN]], -// CHECK-SAME: file: [[FILE]], line: 18, +// CHECK-SAME: file: [[FILE]], line: 19, // CHECK-NOT: flags: DIFlagArtificial // CHECK-SAME: ) // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "variant2", scope: [[GEN]], -// CHECK-SAME: file: [[FILE]], line: 18, +// CHECK-SAME: file: [[FILE]], line: 19, // CHECK-NOT: flags: DIFlagArtificial // CHECK-SAME: ) // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "variant3", scope: [[GEN]], -// CHECK-SAME: file: [[FILE]], line: 15, +// CHECK-SAME: file: [[FILE]], line: 16, // CHECK-NOT: flags: DIFlagArtificial // CHECK-SAME: ) // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "variant4", scope: [[GEN]], -// CHECK-SAME: file: [[FILE]], line: 17, +// CHECK-SAME: file: [[FILE]], line: 18, // CHECK-SAME: baseType: [[VARIANT_WRAPPER:![0-9]*]] // CHECK-NOT: flags: DIFlagArtificial // CHECK-SAME: ) diff --git a/tests/codegen/coroutine-debug.rs b/tests/codegen/coroutine-debug.rs index 914515f58b8..d00667a37d5 100644 --- a/tests/codegen/coroutine-debug.rs +++ b/tests/codegen/coroutine-debug.rs @@ -11,7 +11,8 @@ use std::ops::Coroutine; fn coroutine_test() -> impl Coroutine { - #[coroutine] || { + #[coroutine] + || { yield 0; let s = String::from("foo"); yield 1; @@ -26,26 +27,26 @@ fn coroutine_test() -> impl Coroutine { // CHECK-NOT: flags: DIFlagArtificial // CHECK-SAME: discriminator: [[DISC:![0-9]*]] // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "0", scope: [[VARIANT]], -// CHECK-SAME: file: [[FILE:![0-9]*]], line: 14, +// CHECK-SAME: file: [[FILE:![0-9]*]], line: 15, // CHECK-NOT: flags: DIFlagArtificial // CHECK-SAME: ) // CHECK: {{!.*}} = !DICompositeType(tag: DW_TAG_structure_type, name: "Unresumed", scope: [[GEN]], // CHECK-NOT: flags: DIFlagArtificial // CHECK-SAME: ) // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "1", scope: [[VARIANT]], -// CHECK-SAME: file: [[FILE]], line: 18, +// CHECK-SAME: file: [[FILE]], line: 19, // CHECK-NOT: flags: DIFlagArtificial // CHECK-SAME: ) // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "2", scope: [[VARIANT]], -// CHECK-SAME: file: [[FILE]], line: 18, +// CHECK-SAME: file: [[FILE]], line: 19, // CHECK-NOT: flags: DIFlagArtificial // CHECK-SAME: ) // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "3", scope: [[VARIANT]], -// CHECK-SAME: file: [[FILE]], line: 15, +// CHECK-SAME: file: [[FILE]], line: 16, // CHECK-NOT: flags: DIFlagArtificial // CHECK-SAME: ) // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "4", scope: [[VARIANT]], -// CHECK-SAME: file: [[FILE]], line: 17, +// CHECK-SAME: file: [[FILE]], line: 18, // CHECK-NOT: flags: DIFlagArtificial // CHECK-SAME: ) // CHECK: [[S1:!.*]] = !DICompositeType(tag: DW_TAG_structure_type, name: "Suspend1", scope: [[GEN]], diff --git a/tests/codegen/dealloc-no-unwind.rs b/tests/codegen/dealloc-no-unwind.rs index 667f6fea185..ead26da610e 100644 --- a/tests/codegen/dealloc-no-unwind.rs +++ b/tests/codegen/dealloc-no-unwind.rs @@ -1,13 +1,17 @@ //@ compile-flags: -O -#![crate_type="lib"] +#![crate_type = "lib"] struct A; impl Drop for A { fn drop(&mut self) { - extern "C" { fn foo(); } - unsafe { foo(); } + extern "C" { + fn foo(); + } + unsafe { + foo(); + } } } diff --git a/tests/codegen/debug-column.rs b/tests/codegen/debug-column.rs index ff25fbe1b13..d14a5c29142 100644 --- a/tests/codegen/debug-column.rs +++ b/tests/codegen/debug-column.rs @@ -3,6 +3,7 @@ //@ ignore-windows //@ compile-flags: -C debuginfo=2 +#[rustfmt::skip] fn main() { unsafe { // Column numbers are 1-based. Regression test for #65437. @@ -13,8 +14,8 @@ fn main() { // CHECK: call void @turtle(){{( #[0-9]+)?}}, !dbg [[B:!.*]] /* ż */ turtle(); - // CHECK: [[A]] = !DILocation(line: 10, column: 9, - // CHECK: [[B]] = !DILocation(line: 14, column: 10, + // CHECK: [[A]] = !DILocation(line: 11, column: 9, + // CHECK: [[B]] = !DILocation(line: 15, column: 10, } } diff --git a/tests/codegen/debug-compile-unit-path.rs b/tests/codegen/debug-compile-unit-path.rs index 4be418d6610..6131d9d7351 100644 --- a/tests/codegen/debug-compile-unit-path.rs +++ b/tests/codegen/debug-compile-unit-path.rs @@ -3,7 +3,7 @@ // // Ensure that we remap the compile unit directory and that we set it to the compilers current // working directory and not something else. -#![crate_type="rlib"] +#![crate_type = "rlib"] // CHECK-DAG: [[FILE:![0-9]*]] = !DIFile(filename: "/base/debug-compile-unit-path.rs{{.*}}", directory: "/cwd/") // CHECK-DAG: {{![0-9]*}} = distinct !DICompileUnit({{.*}}file: [[FILE]] diff --git a/tests/codegen/debuginfo-generic-closure-env-names.rs b/tests/codegen/debuginfo-generic-closure-env-names.rs index 04ff7fff439..6d56fbc40ab 100644 --- a/tests/codegen/debuginfo-generic-closure-env-names.rs +++ b/tests/codegen/debuginfo-generic-closure-env-names.rs @@ -46,7 +46,6 @@ // NONMSVC-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "{closure_env#0}", scope: ![[function_containing_closure_NAMESPACE]] // MSVC-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "closure_env$0", scope: ![[function_containing_closure_NAMESPACE]] - #![crate_type = "lib"] use std::future::Future; @@ -70,11 +69,9 @@ async fn generic_async_function(x: T) -> T { x } -fn generic_async_block(x: T) -> impl Future { +fn generic_async_block(x: T) -> impl Future { static _X: u8 = 0; // Same as above - async move { - x - } + async move { x } } pub fn instantiate_generics() { diff --git a/tests/codegen/dllimports/auxiliary/wrapper.rs b/tests/codegen/dllimports/auxiliary/wrapper.rs index 7d1f6ab70d5..00a29f7ee7e 100644 --- a/tests/codegen/dllimports/auxiliary/wrapper.rs +++ b/tests/codegen/dllimports/auxiliary/wrapper.rs @@ -1,13 +1,13 @@ //@ no-prefer-dynamic #![crate_type = "rlib"] -#[link(name = "dummy", kind="dylib")] +#[link(name = "dummy", kind = "dylib")] extern "C" { pub fn dylib_func2(x: i32) -> i32; pub static dylib_global2: i32; } -#[link(name = "dummy", kind="static")] +#[link(name = "dummy", kind = "static")] extern "C" { pub fn static_func2(x: i32) -> i32; pub static static_global2: i32; diff --git a/tests/codegen/dllimports/main.rs b/tests/codegen/dllimports/main.rs index c1626853b16..93d350a2238 100644 --- a/tests/codegen/dllimports/main.rs +++ b/tests/codegen/dllimports/main.rs @@ -1,4 +1,4 @@ - // This test is for *-windows-msvc only. +// This test is for *-windows-msvc only. //@ only-windows //@ ignore-gnu @@ -20,13 +20,13 @@ // CHECK: declare noundef i32 @static_func1(i32 noundef) // CHECK: declare noundef i32 @static_func2(i32 noundef) -#[link(name = "dummy", kind="dylib")] +#[link(name = "dummy", kind = "dylib")] extern "C" { pub fn dylib_func1(x: i32) -> i32; pub static dylib_global1: i32; } -#[link(name = "dummy", kind="static")] +#[link(name = "dummy", kind = "static")] extern "C" { pub fn static_func1(x: i32) -> i32; pub static static_global1: i32; diff --git a/tests/codegen/drop-in-place-noalias.rs b/tests/codegen/drop-in-place-noalias.rs index 36532ea8f53..2dc769df1c9 100644 --- a/tests/codegen/drop-in-place-noalias.rs +++ b/tests/codegen/drop-in-place-noalias.rs @@ -3,7 +3,7 @@ // Tests that the compiler can apply `noalias` and other &mut attributes to `drop_in_place`. // Note that non-Unpin types should not get `noalias`, matching &mut behavior. -#![crate_type="lib"] +#![crate_type = "lib"] use std::marker::PhantomPinned; diff --git a/tests/codegen/drop.rs b/tests/codegen/drop.rs index 1e80247ba8a..b22a8ef27d2 100644 --- a/tests/codegen/drop.rs +++ b/tests/codegen/drop.rs @@ -7,28 +7,26 @@ impl Drop for SomeUniqueName { #[inline(never)] - fn drop(&mut self) { - } + fn drop(&mut self) {} } #[inline(never)] -pub fn possibly_unwinding() { -} +pub fn possibly_unwinding() {} // CHECK-LABEL: @droppy #[no_mangle] pub fn droppy() { -// Check that there are exactly 6 drop calls. The cleanups for the unwinding should be reused, so -// that's one new drop call per call to possibly_unwinding(), and finally 3 drop calls for the -// regular function exit. We used to have problems with quadratic growths of drop calls in such -// functions. -// FIXME(eddyb) the `void @` forces a match on the instruction, instead of the -// comment, that's `; call core::ptr::drop_in_place::` -// for the `v0` mangling, should switch to matching on that once `legacy` is gone. -// CHECK-COUNT-6: {{(call|invoke) void @.*}}drop_in_place{{.*}}SomeUniqueName -// CHECK-NOT: {{(call|invoke) void @.*}}drop_in_place{{.*}}SomeUniqueName -// The next line checks for the } that ends the function definition -// CHECK-LABEL: {{^[}]}} + // Check that there are exactly 6 drop calls. The cleanups for the unwinding should be reused, + // so that's one new drop call per call to possibly_unwinding(), and finally 3 drop calls for + // the regular function exit. We used to have problems with quadratic growths of drop calls in + // such functions. + // FIXME(eddyb) the `void @` forces a match on the instruction, instead of the + // comment, that's `; call core::ptr::drop_in_place::` + // for the `v0` mangling, should switch to matching on that once `legacy` is gone. + // CHECK-COUNT-6: {{(call|invoke) void @.*}}drop_in_place{{.*}}SomeUniqueName + // CHECK-NOT: {{(call|invoke) void @.*}}drop_in_place{{.*}}SomeUniqueName + // The next line checks for the } that ends the function definition + // CHECK-LABEL: {{^[}]}} let _s = SomeUniqueName; possibly_unwinding(); let _s = SomeUniqueName; diff --git a/tests/codegen/dst-offset.rs b/tests/codegen/dst-offset.rs index ce735baeb6a..7177a960432 100644 --- a/tests/codegen/dst-offset.rs +++ b/tests/codegen/dst-offset.rs @@ -3,7 +3,6 @@ //@ compile-flags: -C no-prepopulate-passes -Copt-level=0 #![crate_type = "lib"] - #![feature(extern_types)] use std::ptr::addr_of; @@ -11,8 +10,7 @@ // Hack to get the correct type for usize // CHECK: @helper([[USIZE:i[0-9]+]] %_1) #[no_mangle] -pub fn helper(_: usize) { -} +pub fn helper(_: usize) {} struct Dst { x: u32, @@ -23,30 +21,31 @@ struct Dst { // CHECK: @dst_dyn_trait_offset(ptr align {{[0-9]+}} [[DATA_PTR:%.+]], ptr align {{[0-9]+}} [[VTABLE_PTR:%.+]]) #[no_mangle] pub fn dst_dyn_trait_offset(s: &Dst) -> &dyn Drop { -// The alignment of dyn trait is unknown, so we compute the offset based on align from the vtable. + // The alignment of dyn trait is unknown, so we compute the offset based on align from the + // vtable. -// CHECK: [[SIZE_PTR:%[0-9]+]] = getelementptr inbounds i8, ptr [[VTABLE_PTR]] -// CHECK: load [[USIZE]], ptr [[SIZE_PTR]] -// CHECK: [[ALIGN_PTR:%[0-9]+]] = getelementptr inbounds i8, ptr [[VTABLE_PTR]] -// CHECK: load [[USIZE]], ptr [[ALIGN_PTR]] + // CHECK: [[SIZE_PTR:%[0-9]+]] = getelementptr inbounds i8, ptr [[VTABLE_PTR]] + // CHECK: load [[USIZE]], ptr [[SIZE_PTR]] + // CHECK: [[ALIGN_PTR:%[0-9]+]] = getelementptr inbounds i8, ptr [[VTABLE_PTR]] + // CHECK: load [[USIZE]], ptr [[ALIGN_PTR]] -// CHECK: getelementptr inbounds i8, ptr [[DATA_PTR]] -// CHECK-NEXT: insertvalue -// CHECK-NEXT: insertvalue -// CHECK-NEXT: ret + // CHECK: getelementptr inbounds i8, ptr [[DATA_PTR]] + // CHECK-NEXT: insertvalue + // CHECK-NEXT: insertvalue + // CHECK-NEXT: ret &s.z } // CHECK-LABEL: @dst_slice_offset #[no_mangle] pub fn dst_slice_offset(s: &Dst<[u16]>) -> &[u16] { -// The alignment of [u16] is known, so we generate a GEP directly. + // The alignment of [u16] is known, so we generate a GEP directly. -// CHECK: start: -// CHECK-NEXT: getelementptr inbounds i8, {{.+}}, [[USIZE]] 6 -// CHECK-NEXT: insertvalue -// CHECK-NEXT: insertvalue -// CHECK-NEXT: ret + // CHECK: start: + // CHECK-NEXT: getelementptr inbounds i8, {{.+}}, [[USIZE]] 6 + // CHECK-NEXT: insertvalue + // CHECK-NEXT: insertvalue + // CHECK-NEXT: ret &s.z } @@ -60,25 +59,25 @@ struct PackedDstSlice { // CHECK-LABEL: @packed_dst_slice_offset #[no_mangle] pub fn packed_dst_slice_offset(s: &PackedDstSlice) -> *const [u16] { -// The alignment of [u16] is known, so we generate a GEP directly. + // The alignment of [u16] is known, so we generate a GEP directly. -// CHECK: start: -// CHECK-NEXT: getelementptr inbounds i8, {{.+}}, [[USIZE]] 5 -// CHECK-NEXT: insertvalue -// CHECK-NEXT: insertvalue -// CHECK-NEXT: ret + // CHECK: start: + // CHECK-NEXT: getelementptr inbounds i8, {{.+}}, [[USIZE]] 5 + // CHECK-NEXT: insertvalue + // CHECK-NEXT: insertvalue + // CHECK-NEXT: ret addr_of!(s.z) } -extern { +extern "C" { pub type Extern; } // CHECK-LABEL: @dst_extern #[no_mangle] pub fn dst_extern(s: &Dst) -> &Extern { -// Computing the alignment of an extern type is currently unsupported and just panics. + // Computing the alignment of an extern type is currently unsupported and just panics. -// CHECK: call void @{{.+}}panic + // CHECK: call void @{{.+}}panic &s.z } diff --git a/tests/codegen/dst-vtable-align-nonzero.rs b/tests/codegen/dst-vtable-align-nonzero.rs index b0507f4c217..cb07e43238c 100644 --- a/tests/codegen/dst-vtable-align-nonzero.rs +++ b/tests/codegen/dst-vtable-align-nonzero.rs @@ -10,9 +10,15 @@ pub trait Trait { fn f(&self); } -pub struct WrapperWithAlign1 { x: u8, y: T } +pub struct WrapperWithAlign1 { + x: u8, + y: T, +} -pub struct WrapperWithAlign2 { x: u16, y: T } +pub struct WrapperWithAlign2 { + x: u16, + y: T, +} pub struct Struct { _field: i8, @@ -22,7 +28,7 @@ pub struct Struct { // CHECK-LABEL: @eliminates_runtime_check_when_align_1 #[no_mangle] pub fn eliminates_runtime_check_when_align_1( - x: &Struct> + x: &Struct>, ) -> &WrapperWithAlign1 { // CHECK: load [[USIZE:i[0-9]+]], {{.+}} !range [[RANGE_META:![0-9]+]] // CHECK-NOT: llvm.umax @@ -35,7 +41,7 @@ pub fn eliminates_runtime_check_when_align_1( // CHECK-LABEL: @does_not_eliminate_runtime_check_when_align_2 #[no_mangle] pub fn does_not_eliminate_runtime_check_when_align_2( - x: &Struct> + x: &Struct>, ) -> &WrapperWithAlign2 { // CHECK: [[X0:%[0-9]+]] = load [[USIZE]], {{.+}} !range [[RANGE_META]] // CHECK: {{icmp|llvm.umax}} diff --git a/tests/codegen/ehcontguard_disabled.rs b/tests/codegen/ehcontguard_disabled.rs index dc4b5eb430b..9efb2721b3e 100644 --- a/tests/codegen/ehcontguard_disabled.rs +++ b/tests/codegen/ehcontguard_disabled.rs @@ -3,8 +3,7 @@ #![crate_type = "lib"] // A basic test function. -pub fn test() { -} +pub fn test() {} // Ensure the module flag ehcontguard is not present // CHECK-NOT: !"ehcontguard" diff --git a/tests/codegen/ehcontguard_enabled.rs b/tests/codegen/ehcontguard_enabled.rs index fde66f1c148..ecc5512fd5d 100644 --- a/tests/codegen/ehcontguard_enabled.rs +++ b/tests/codegen/ehcontguard_enabled.rs @@ -3,8 +3,7 @@ #![crate_type = "lib"] // A basic test function. -pub fn test() { -} +pub fn test() {} // Ensure the module flag ehcontguard=1 is present // CHECK: !"ehcontguard", i32 1 diff --git a/tests/codegen/emcripten-catch-unwind.rs b/tests/codegen/emcripten-catch-unwind.rs index 7de7bd81b5c..6cda8c6799f 100644 --- a/tests/codegen/emcripten-catch-unwind.rs +++ b/tests/codegen/emcripten-catch-unwind.rs @@ -9,18 +9,23 @@ #![no_std] #![no_core] -#[lang="sized"] trait Sized { } -#[lang="freeze"] trait Freeze { } -#[lang="copy"] trait Copy { } +#[lang = "sized"] +trait Sized {} +#[lang = "freeze"] +trait Freeze {} +#[lang = "copy"] +trait Copy {} #[rustc_intrinsic] -fn size_of() -> usize { loop {} } +fn size_of() -> usize { + loop {} +} extern "rust-intrinsic" { fn catch_unwind( try_fn: fn(_: *mut u8), data: *mut u8, - catch_fn: fn(_: *mut u8, _: *mut u8) + catch_fn: fn(_: *mut u8, _: *mut u8), ) -> i32; } @@ -36,7 +41,7 @@ pub fn ptr_size() -> usize { pub unsafe fn test_catch_unwind( try_fn: fn(_: *mut u8), data: *mut u8, - catch_fn: fn(_: *mut u8, _: *mut u8) + catch_fn: fn(_: *mut u8, _: *mut u8), ) -> i32 { // CHECK: start: // CHECK: [[ALLOCA:%.*]] = alloca diff --git a/tests/codegen/enable-lto-unit-splitting.rs b/tests/codegen/enable-lto-unit-splitting.rs index e4698094477..51c2671bc4e 100644 --- a/tests/codegen/enable-lto-unit-splitting.rs +++ b/tests/codegen/enable-lto-unit-splitting.rs @@ -2,9 +2,8 @@ // //@ compile-flags: -Clto -Ctarget-feature=-crt-static -Zsplit-lto-unit -#![crate_type="lib"] +#![crate_type = "lib"] -pub fn foo() { -} +pub fn foo() {} // CHECK: !{{[0-9]+}} = !{i32 4, !"EnableSplitLTOUnit", i32 1} diff --git a/tests/codegen/enum/enum-bounds-check.rs b/tests/codegen/enum/enum-bounds-check.rs index a1b32ec9295..c44c007ed6a 100644 --- a/tests/codegen/enum/enum-bounds-check.rs +++ b/tests/codegen/enum/enum-bounds-check.rs @@ -3,7 +3,8 @@ #![crate_type = "lib"] pub enum Foo { - A, B + A, + B, } // CHECK-LABEL: @lookup @@ -15,7 +16,7 @@ pub enum Foo { pub enum Bar { A = 2, - B = 3 + B = 3, } // CHECK-LABEL: @lookup_unmodified diff --git a/tests/codegen/enum/enum-debug-clike.rs b/tests/codegen/enum/enum-debug-clike.rs index 59ad5878443..89c803cce5e 100644 --- a/tests/codegen/enum/enum-debug-clike.rs +++ b/tests/codegen/enum/enum-debug-clike.rs @@ -17,7 +17,11 @@ #![allow(unused_variables)] #![allow(unused_assignments)] -enum E { A, B, C } +enum E { + A, + B, + C, +} pub fn main() { let e = E::C; diff --git a/tests/codegen/enum/enum-debug-niche.rs b/tests/codegen/enum/enum-debug-niche.rs index 90de928bced..59e8b8a78b4 100644 --- a/tests/codegen/enum/enum-debug-niche.rs +++ b/tests/codegen/enum/enum-debug-niche.rs @@ -23,7 +23,12 @@ #![allow(unused_variables)] #![allow(unused_assignments)] -enum E { A, B, C, D(bool) } +enum E { + A, + B, + C, + D(bool), +} pub fn main() { let e = E::D(true); diff --git a/tests/codegen/enum/enum-debug-tagged.rs b/tests/codegen/enum/enum-debug-tagged.rs index f13922ee33b..e8f147665b0 100644 --- a/tests/codegen/enum/enum-debug-tagged.rs +++ b/tests/codegen/enum/enum-debug-tagged.rs @@ -21,7 +21,10 @@ #![allow(unused_variables)] #![allow(unused_assignments)] -enum E { A(u32), B(u32) } +enum E { + A(u32), + B(u32), +} pub fn main() { let e = E::A(23); diff --git a/tests/codegen/enum/enum-match.rs b/tests/codegen/enum/enum-match.rs index ced26c0a434..8da5de63e67 100644 --- a/tests/codegen/enum/enum-match.rs +++ b/tests/codegen/enum/enum-match.rs @@ -50,6 +50,7 @@ pub fn match1(e: Enum1) -> u8 { } // Case 2: Special cases don't apply. +#[rustfmt::skip] pub enum X { _2=2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, diff --git a/tests/codegen/enum/unreachable_enum_default_branch.rs b/tests/codegen/enum/unreachable_enum_default_branch.rs index dae01cfb055..81a258f2722 100644 --- a/tests/codegen/enum/unreachable_enum_default_branch.rs +++ b/tests/codegen/enum/unreachable_enum_default_branch.rs @@ -22,8 +22,7 @@ // CHECK-NEXT: ret i1 [[SPEC_SELECT]] #[no_mangle] pub fn implicit_match(x: Int) -> bool { - (x >= A && x <= B) - || x == C + (x >= A && x <= B) || x == C } // The code is from https://github.com/rust-lang/rust/issues/110097. @@ -35,9 +34,5 @@ pub fn implicit_match(x: Int) -> bool { // CHECK-NEXT: ret #[no_mangle] pub fn if_let(val: Result) -> Result { - if let Ok(x) = val { - Ok(x) - } else { - Err(()) - } + if let Ok(x) = val { Ok(x) } else { Err(()) } } diff --git a/tests/codegen/fatptr.rs b/tests/codegen/fatptr.rs index 0f13e66fbad..041807202b8 100644 --- a/tests/codegen/fatptr.rs +++ b/tests/codegen/fatptr.rs @@ -7,6 +7,6 @@ pub trait T {} // CHECK-LABEL: @copy_fat_ptr #[no_mangle] pub fn copy_fat_ptr(x: &T) { -// CHECK-NOT: extractvalue + // CHECK-NOT: extractvalue let x2 = x; } diff --git a/tests/codegen/float_math.rs b/tests/codegen/float_math.rs index dcca51c2f5e..31387ec82b9 100644 --- a/tests/codegen/float_math.rs +++ b/tests/codegen/float_math.rs @@ -3,48 +3,40 @@ #![crate_type = "lib"] #![feature(core_intrinsics)] -use std::intrinsics::{fadd_fast, fsub_fast, fmul_fast, fdiv_fast, frem_fast}; +use std::intrinsics::{fadd_fast, fdiv_fast, fmul_fast, frem_fast, fsub_fast}; // CHECK-LABEL: @add #[no_mangle] pub fn add(x: f32, y: f32) -> f32 { -// CHECK: fadd float -// CHECK-NOT: fast + // CHECK: fadd float + // CHECK-NOT: fast x + y } // CHECK-LABEL: @addition #[no_mangle] pub fn addition(x: f32, y: f32) -> f32 { -// CHECK: fadd fast float - unsafe { - fadd_fast(x, y) - } + // CHECK: fadd fast float + unsafe { fadd_fast(x, y) } } // CHECK-LABEL: @subtraction #[no_mangle] pub fn subtraction(x: f32, y: f32) -> f32 { -// CHECK: fsub fast float - unsafe { - fsub_fast(x, y) - } + // CHECK: fsub fast float + unsafe { fsub_fast(x, y) } } // CHECK-LABEL: @multiplication #[no_mangle] pub fn multiplication(x: f32, y: f32) -> f32 { -// CHECK: fmul fast float - unsafe { - fmul_fast(x, y) - } + // CHECK: fmul fast float + unsafe { fmul_fast(x, y) } } // CHECK-LABEL: @division #[no_mangle] pub fn division(x: f32, y: f32) -> f32 { -// CHECK: fdiv fast float - unsafe { - fdiv_fast(x, y) - } + // CHECK: fdiv fast float + unsafe { fdiv_fast(x, y) } } diff --git a/tests/codegen/force-frame-pointers.rs b/tests/codegen/force-frame-pointers.rs index c41824e024f..84e0bcb39ad 100644 --- a/tests/codegen/force-frame-pointers.rs +++ b/tests/codegen/force-frame-pointers.rs @@ -1,6 +1,6 @@ //@ compile-flags: -C no-prepopulate-passes -C force-frame-pointers=y -Copt-level=0 -#![crate_type="lib"] +#![crate_type = "lib"] // CHECK: attributes #{{.*}} "frame-pointer"="all" pub fn foo() {} diff --git a/tests/codegen/force-no-unwind-tables.rs b/tests/codegen/force-no-unwind-tables.rs index 0189ae7c0a6..e823bedac0f 100644 --- a/tests/codegen/force-no-unwind-tables.rs +++ b/tests/codegen/force-no-unwind-tables.rs @@ -1,7 +1,7 @@ //@ compile-flags: -C no-prepopulate-passes -C panic=abort -C force-unwind-tables=n //@ ignore-windows -#![crate_type="lib"] +#![crate_type = "lib"] // CHECK-LABEL: define{{.*}}void @foo // CHECK-NOT: attributes #{{.*}} uwtable diff --git a/tests/codegen/force-unwind-tables.rs b/tests/codegen/force-unwind-tables.rs index 33fdf7653f4..a2ef8a10454 100644 --- a/tests/codegen/force-unwind-tables.rs +++ b/tests/codegen/force-unwind-tables.rs @@ -1,6 +1,6 @@ //@ compile-flags: -C no-prepopulate-passes -C force-unwind-tables=y -Copt-level=0 -#![crate_type="lib"] +#![crate_type = "lib"] // CHECK: attributes #{{.*}} uwtable pub fn foo() {} diff --git a/tests/codegen/frame-pointer.rs b/tests/codegen/frame-pointer.rs index 879535bcc36..da81c2e9cd9 100644 --- a/tests/codegen/frame-pointer.rs +++ b/tests/codegen/frame-pointer.rs @@ -13,13 +13,12 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang="sized"] -trait Sized { } -#[lang="copy"] -trait Copy { } +#[lang = "sized"] +trait Sized {} +#[lang = "copy"] +trait Copy {} impl Copy for u32 {} - // CHECK: define i32 @peach{{.*}}[[PEACH_ATTRS:\#[0-9]+]] { #[no_mangle] pub fn peach(x: u32) -> u32 { diff --git a/tests/codegen/function-arguments-noopt.rs b/tests/codegen/function-arguments-noopt.rs index 0d42915893b..c80f119696d 100644 --- a/tests/codegen/function-arguments-noopt.rs +++ b/tests/codegen/function-arguments-noopt.rs @@ -7,63 +7,63 @@ #![feature(rustc_attrs)] pub struct S { - _field: [i32; 8], + _field: [i32; 8], } // CHECK: zeroext i1 @boolean(i1 zeroext %x) #[no_mangle] pub fn boolean(x: bool) -> bool { - x + x } // CHECK-LABEL: @boolean_call #[no_mangle] pub fn boolean_call(x: bool, f: fn(bool) -> bool) -> bool { -// CHECK: call zeroext i1 %f(i1 zeroext %x) - f(x) + // CHECK: call zeroext i1 %f(i1 zeroext %x) + f(x) } // CHECK: align 4 ptr @borrow(ptr align 4 %x) #[no_mangle] pub fn borrow(x: &i32) -> &i32 { - x + x } // CHECK: align 4 ptr @borrow_mut(ptr align 4 %x) #[no_mangle] pub fn borrow_mut(x: &mut i32) -> &mut i32 { - x + x } // CHECK-LABEL: @borrow_call #[no_mangle] pub fn borrow_call(x: &i32, f: fn(&i32) -> &i32) -> &i32 { - // CHECK: call align 4 ptr %f(ptr align 4 %x) - f(x) + // CHECK: call align 4 ptr %f(ptr align 4 %x) + f(x) } // CHECK: void @struct_(ptr sret([32 x i8]) align 4{{( %_0)?}}, ptr align 4 %x) #[no_mangle] pub fn struct_(x: S) -> S { - x + x } // CHECK-LABEL: @struct_call #[no_mangle] pub fn struct_call(x: S, f: fn(S) -> S) -> S { - // CHECK: call void %f(ptr sret([32 x i8]) align 4{{( %_0)?}}, ptr align 4 %{{.+}}) - f(x) + // CHECK: call void %f(ptr sret([32 x i8]) align 4{{( %_0)?}}, ptr align 4 %{{.+}}) + f(x) } // CHECK: { i1, i8 } @enum_(i1 zeroext %x.0, i8 %x.1) #[no_mangle] pub fn enum_(x: Option) -> Option { - x + x } // CHECK-LABEL: @enum_call #[no_mangle] pub fn enum_call(x: Option, f: fn(Option) -> Option) -> Option { - // CHECK: call { i1, i8 } %f(i1 zeroext %x.0, i8 %x.1) - f(x) + // CHECK: call { i1, i8 } %f(i1 zeroext %x.0, i8 %x.1) + f(x) } diff --git a/tests/codegen/function-arguments.rs b/tests/codegen/function-arguments.rs index ebcbcae8563..56504df4034 100644 --- a/tests/codegen/function-arguments.rs +++ b/tests/codegen/function-arguments.rs @@ -3,129 +3,123 @@ #![feature(dyn_star)] #![feature(allocator_api)] +use std::marker::PhantomPinned; use std::mem::MaybeUninit; use std::num::NonZero; -use std::marker::PhantomPinned; use std::ptr::NonNull; pub struct S { - _field: [i32; 8], + _field: [i32; 8], } pub struct UnsafeInner { - _field: std::cell::UnsafeCell, + _field: std::cell::UnsafeCell, } pub struct NotUnpin { - _field: i32, - _marker: PhantomPinned, + _field: i32, + _marker: PhantomPinned, } pub enum MyBool { - True, - False, + True, + False, } // CHECK: noundef zeroext i1 @boolean(i1 noundef zeroext %x) #[no_mangle] pub fn boolean(x: bool) -> bool { - x + x } // CHECK: i8 @maybeuninit_boolean(i8 %x) #[no_mangle] pub fn maybeuninit_boolean(x: MaybeUninit) -> MaybeUninit { - x + x } // CHECK: noundef zeroext i1 @enum_bool(i1 noundef zeroext %x) #[no_mangle] pub fn enum_bool(x: MyBool) -> MyBool { - x + x } // CHECK: i8 @maybeuninit_enum_bool(i8 %x) #[no_mangle] pub fn maybeuninit_enum_bool(x: MaybeUninit) -> MaybeUninit { - x + x } // CHECK: noundef i32 @char(i32 noundef %x) #[no_mangle] pub fn char(x: char) -> char { - x + x } // CHECK: i32 @maybeuninit_char(i32 %x) #[no_mangle] pub fn maybeuninit_char(x: MaybeUninit) -> MaybeUninit { - x + x } // CHECK: noundef i64 @int(i64 noundef %x) #[no_mangle] pub fn int(x: u64) -> u64 { - x + x } // CHECK: noundef i64 @nonzero_int(i64 noundef %x) #[no_mangle] pub fn nonzero_int(x: NonZero) -> NonZero { - x + x } // CHECK: noundef i64 @option_nonzero_int(i64 noundef %x) #[no_mangle] pub fn option_nonzero_int(x: Option>) -> Option> { - x + x } // CHECK: @readonly_borrow(ptr noalias noundef readonly align 4 dereferenceable(4) %_1) // FIXME #25759 This should also have `nocapture` #[no_mangle] -pub fn readonly_borrow(_: &i32) { -} +pub fn readonly_borrow(_: &i32) {} // CHECK: noundef align 4 dereferenceable(4) ptr @readonly_borrow_ret() #[no_mangle] pub fn readonly_borrow_ret() -> &'static i32 { - loop {} + loop {} } // CHECK: @static_borrow(ptr noalias noundef readonly align 4 dereferenceable(4) %_1) // static borrow may be captured #[no_mangle] -pub fn static_borrow(_: &'static i32) { -} +pub fn static_borrow(_: &'static i32) {} // CHECK: @named_borrow(ptr noalias noundef readonly align 4 dereferenceable(4) %_1) // borrow with named lifetime may be captured #[no_mangle] -pub fn named_borrow<'r>(_: &'r i32) { -} +pub fn named_borrow<'r>(_: &'r i32) {} // CHECK: @unsafe_borrow(ptr noundef nonnull align 2 %_1) // unsafe interior means this isn't actually readonly and there may be aliases ... #[no_mangle] -pub fn unsafe_borrow(_: &UnsafeInner) { -} +pub fn unsafe_borrow(_: &UnsafeInner) {} // CHECK: @mutable_unsafe_borrow(ptr noalias noundef align 2 dereferenceable(2) %_1) // ... unless this is a mutable borrow, those never alias #[no_mangle] -pub fn mutable_unsafe_borrow(_: &mut UnsafeInner) { -} +pub fn mutable_unsafe_borrow(_: &mut UnsafeInner) {} // CHECK: @mutable_borrow(ptr noalias noundef align 4 dereferenceable(4) %_1) // FIXME #25759 This should also have `nocapture` #[no_mangle] -pub fn mutable_borrow(_: &mut i32) { -} +pub fn mutable_borrow(_: &mut i32) {} // CHECK: noundef align 4 dereferenceable(4) ptr @mutable_borrow_ret() #[no_mangle] pub fn mutable_borrow_ret() -> &'static mut i32 { - loop {} + loop {} } #[no_mangle] @@ -133,53 +127,44 @@ pub fn mutable_borrow_ret() -> &'static mut i32 { // This one is *not* `noalias` because it might be self-referential. // It is also not `dereferenceable` due to // . -pub fn mutable_notunpin_borrow(_: &mut NotUnpin) { -} +pub fn mutable_notunpin_borrow(_: &mut NotUnpin) {} // CHECK: @notunpin_borrow(ptr noalias noundef readonly align 4 dereferenceable(4) %_1) // But `&NotUnpin` behaves perfectly normal. #[no_mangle] -pub fn notunpin_borrow(_: &NotUnpin) { -} +pub fn notunpin_borrow(_: &NotUnpin) {} // CHECK: @indirect_struct(ptr noalias nocapture noundef readonly align 4 dereferenceable(32) %_1) #[no_mangle] -pub fn indirect_struct(_: S) { -} +pub fn indirect_struct(_: S) {} // CHECK: @borrowed_struct(ptr noalias noundef readonly align 4 dereferenceable(32) %_1) // FIXME #25759 This should also have `nocapture` #[no_mangle] -pub fn borrowed_struct(_: &S) { -} +pub fn borrowed_struct(_: &S) {} // CHECK: @option_borrow(ptr noalias noundef readonly align 4 dereferenceable_or_null(4) %x) #[no_mangle] -pub fn option_borrow(x: Option<&i32>) { -} +pub fn option_borrow(x: Option<&i32>) {} // CHECK: @option_borrow_mut(ptr noalias noundef align 4 dereferenceable_or_null(4) %x) #[no_mangle] -pub fn option_borrow_mut(x: Option<&mut i32>) { -} +pub fn option_borrow_mut(x: Option<&mut i32>) {} // CHECK: @raw_struct(ptr noundef %_1) #[no_mangle] -pub fn raw_struct(_: *const S) { -} +pub fn raw_struct(_: *const S) {} // CHECK: @raw_option_nonnull_struct(ptr noundef %_1) #[no_mangle] -pub fn raw_option_nonnull_struct(_: Option>) { -} - +pub fn raw_option_nonnull_struct(_: Option>) {} // `Box` can get deallocated during execution of the function, so it should // not get `dereferenceable`. // CHECK: noundef nonnull align 4 ptr @_box(ptr noalias noundef nonnull align 4 %x) #[no_mangle] pub fn _box(x: Box) -> Box { - x + x } // With a custom allocator, it should *not* have `noalias`. (See @@ -188,106 +173,93 @@ pub fn _box(x: Box) -> Box { // CHECK: @_box_custom(ptr noundef nonnull align 4 %x.0, ptr noalias noundef nonnull readonly align 1 %x.1) #[no_mangle] pub fn _box_custom(x: Box) { - drop(x) + drop(x) } // CHECK: noundef nonnull align 4 ptr @notunpin_box(ptr noundef nonnull align 4 %x) #[no_mangle] pub fn notunpin_box(x: Box) -> Box { - x + x } // CHECK: @struct_return(ptr{{( dead_on_unwind)?}} noalias nocapture noundef{{( writable)?}} sret([32 x i8]) align 4 dereferenceable(32){{( %_0)?}}) #[no_mangle] pub fn struct_return() -> S { - S { - _field: [0, 0, 0, 0, 0, 0, 0, 0] - } + S { _field: [0, 0, 0, 0, 0, 0, 0, 0] } } // Hack to get the correct size for the length part in slices // CHECK: @helper([[USIZE:i[0-9]+]] noundef %_1) #[no_mangle] -pub fn helper(_: usize) { -} +pub fn helper(_: usize) {} // CHECK: @slice(ptr noalias noundef nonnull readonly align 1 %_1.0, [[USIZE]] noundef %_1.1) // FIXME #25759 This should also have `nocapture` #[no_mangle] -pub fn slice(_: &[u8]) { -} +pub fn slice(_: &[u8]) {} // CHECK: @mutable_slice(ptr noalias noundef nonnull align 1 %_1.0, [[USIZE]] noundef %_1.1) // FIXME #25759 This should also have `nocapture` #[no_mangle] -pub fn mutable_slice(_: &mut [u8]) { -} +pub fn mutable_slice(_: &mut [u8]) {} // CHECK: @unsafe_slice(ptr noundef nonnull align 2 %_1.0, [[USIZE]] noundef %_1.1) // unsafe interior means this isn't actually readonly and there may be aliases ... #[no_mangle] -pub fn unsafe_slice(_: &[UnsafeInner]) { -} +pub fn unsafe_slice(_: &[UnsafeInner]) {} // CHECK: @raw_slice(ptr noundef %_1.0, [[USIZE]] noundef %_1.1) #[no_mangle] -pub fn raw_slice(_: *const [u8]) { -} +pub fn raw_slice(_: *const [u8]) {} // CHECK: @str(ptr noalias noundef nonnull readonly align 1 %_1.0, [[USIZE]] noundef %_1.1) // FIXME #25759 This should also have `nocapture` #[no_mangle] -pub fn str(_: &[u8]) { -} +pub fn str(_: &[u8]) {} // CHECK: @trait_borrow(ptr noundef nonnull align 1 %_1.0, {{.+}} noalias noundef readonly align {{.*}} dereferenceable({{.*}}) %_1.1) // FIXME #25759 This should also have `nocapture` #[no_mangle] -pub fn trait_borrow(_: &dyn Drop) { -} +pub fn trait_borrow(_: &dyn Drop) {} // CHECK: @option_trait_borrow(ptr noundef align 1 %x.0, ptr %x.1) #[no_mangle] -pub fn option_trait_borrow(x: Option<&dyn Drop>) { -} +pub fn option_trait_borrow(x: Option<&dyn Drop>) {} // CHECK: @option_trait_borrow_mut(ptr noundef align 1 %x.0, ptr %x.1) #[no_mangle] -pub fn option_trait_borrow_mut(x: Option<&mut dyn Drop>) { -} +pub fn option_trait_borrow_mut(x: Option<&mut dyn Drop>) {} // CHECK: @trait_raw(ptr noundef %_1.0, {{.+}} noalias noundef readonly align {{.*}} dereferenceable({{.*}}) %_1.1) #[no_mangle] -pub fn trait_raw(_: *const dyn Drop) { -} +pub fn trait_raw(_: *const dyn Drop) {} // CHECK: @trait_box(ptr noalias noundef nonnull align 1{{( %0)?}}, {{.+}} noalias noundef readonly align {{.*}} dereferenceable({{.*}}){{( %1)?}}) #[no_mangle] -pub fn trait_box(_: Box) { -} +pub fn trait_box(_: Box) {} // CHECK: { ptr, ptr } @trait_option(ptr noalias noundef align 1 %x.0, ptr %x.1) #[no_mangle] pub fn trait_option(x: Option>) -> Option> { - x + x } // CHECK: { ptr, [[USIZE]] } @return_slice(ptr noalias noundef nonnull readonly align 2 %x.0, [[USIZE]] noundef %x.1) #[no_mangle] pub fn return_slice(x: &[u16]) -> &[u16] { - x + x } // CHECK: { i16, i16 } @enum_id_1(i16 noundef %x.0, i16 %x.1) #[no_mangle] pub fn enum_id_1(x: Option>) -> Option> { - x + x } // CHECK: { i1, i8 } @enum_id_2(i1 noundef zeroext %x.0, i8 %x.1) #[no_mangle] pub fn enum_id_2(x: Option) -> Option { - x + x } // CHECK: { ptr, {{.+}} } @dyn_star(ptr noundef %x.0, {{.+}} noalias noundef readonly align {{.*}} dereferenceable({{.*}}) %x.1) @@ -295,5 +267,5 @@ pub fn enum_id_2(x: Option) -> Option { // so do like the `trait_box` test and just match on `{{.+}}` for the vtable. #[no_mangle] pub fn dyn_star(x: dyn* Drop) -> dyn* Drop { - x + x } diff --git a/tests/codegen/generic-debug.rs b/tests/codegen/generic-debug.rs index 0f289026396..3423abe7187 100644 --- a/tests/codegen/generic-debug.rs +++ b/tests/codegen/generic-debug.rs @@ -13,6 +13,6 @@ pub struct Generic(Type); -fn main () { +fn main() { let generic = Generic(10); } diff --git a/tests/codegen/inline-always-works-always.rs b/tests/codegen/inline-always-works-always.rs index e9ca05d1756..07200fd9e37 100644 --- a/tests/codegen/inline-always-works-always.rs +++ b/tests/codegen/inline-always-works-always.rs @@ -3,7 +3,7 @@ //@[SIZE-OPT] compile-flags: -Copt-level=s //@[SPEED-OPT] compile-flags: -Copt-level=3 -#![crate_type="rlib"] +#![crate_type = "rlib"] #[no_mangle] #[inline(always)] diff --git a/tests/codegen/inline-debuginfo.rs b/tests/codegen/inline-debuginfo.rs index f327180560d..1e1c9037f5c 100644 --- a/tests/codegen/inline-debuginfo.rs +++ b/tests/codegen/inline-debuginfo.rs @@ -1,4 +1,4 @@ -#![crate_type="rlib"] +#![crate_type = "rlib"] //@ compile-flags: -Copt-level=3 -g // diff --git a/tests/codegen/instrument-coverage/instrument-coverage.rs b/tests/codegen/instrument-coverage/instrument-coverage.rs index d638a544d5a..65fa437d250 100644 --- a/tests/codegen/instrument-coverage/instrument-coverage.rs +++ b/tests/codegen/instrument-coverage/instrument-coverage.rs @@ -12,12 +12,10 @@ // CHECK: @__llvm_profile_filename = {{.*}}"default_%m_%p.profraw\00"{{.*}} // CHECK: @__llvm_coverage_mapping -#![crate_type="lib"] +#![crate_type = "lib"] #[inline(never)] -fn some_function() { - -} +fn some_function() {} pub fn some_other_function() { some_function(); diff --git a/tests/codegen/integer-cmp.rs b/tests/codegen/integer-cmp.rs index 46972878da5..bba112b246f 100644 --- a/tests/codegen/integer-cmp.rs +++ b/tests/codegen/integer-cmp.rs @@ -10,19 +10,19 @@ // CHECK-LABEL: @cmp_signed #[no_mangle] pub fn cmp_signed(a: i64, b: i64) -> Ordering { -// CHECK: icmp slt -// CHECK: icmp ne -// CHECK: zext i1 -// CHECK: select i1 + // CHECK: icmp slt + // CHECK: icmp ne + // CHECK: zext i1 + // CHECK: select i1 a.cmp(&b) } // CHECK-LABEL: @cmp_unsigned #[no_mangle] pub fn cmp_unsigned(a: u32, b: u32) -> Ordering { -// CHECK: icmp ult -// CHECK: icmp ne -// CHECK: zext i1 -// CHECK: select i1 + // CHECK: icmp ult + // CHECK: icmp ne + // CHECK: zext i1 + // CHECK: select i1 a.cmp(&b) } diff --git a/tests/codegen/integer-overflow.rs b/tests/codegen/integer-overflow.rs index 00780251bbc..a6407476fc2 100644 --- a/tests/codegen/integer-overflow.rs +++ b/tests/codegen/integer-overflow.rs @@ -2,7 +2,6 @@ #![crate_type = "lib"] - pub struct S1<'a> { data: &'a [u8], position: usize, @@ -12,7 +11,7 @@ pub struct S1<'a> { #[no_mangle] pub fn slice_no_index_order<'a>(s: &'a mut S1, n: usize) -> &'a [u8] { // CHECK-NOT: slice_index_order_fail - let d = &s.data[s.position..s.position+n]; + let d = &s.data[s.position..s.position + n]; s.position += n; return d; } diff --git a/tests/codegen/internalize-closures.rs b/tests/codegen/internalize-closures.rs index d37aa5fee8d..f226ea6faac 100644 --- a/tests/codegen/internalize-closures.rs +++ b/tests/codegen/internalize-closures.rs @@ -1,7 +1,6 @@ //@ compile-flags: -C no-prepopulate-passes -Zmir-opt-level=0 pub fn main() { - // We want to make sure that closures get 'internal' linkage instead of // 'weak_odr' when they are not shared between codegen units // FIXME(eddyb) `legacy` mangling uses `{{closure}}`, while `v0` @@ -9,6 +8,6 @@ pub fn main() { // CHECK-LABEL: ; internalize_closures::main::{{.*}}closure // CHECK-NEXT: ; Function Attrs: // CHECK-NEXT: define internal - let c = |x:i32| { x + 1 }; + let c = |x: i32| x + 1; let _ = c(1); } diff --git a/tests/codegen/intrinsic-no-unnamed-attr.rs b/tests/codegen/intrinsic-no-unnamed-attr.rs index 45d06c70a6d..fce0de80d7b 100644 --- a/tests/codegen/intrinsic-no-unnamed-attr.rs +++ b/tests/codegen/intrinsic-no-unnamed-attr.rs @@ -8,5 +8,7 @@ // CHECK: @llvm.sqrt.f32(float) #{{[0-9]*}} fn main() { - unsafe { sqrtf32(0.0f32); } + unsafe { + sqrtf32(0.0f32); + } } diff --git a/tests/codegen/intrinsics/const_eval_select.rs b/tests/codegen/intrinsics/const_eval_select.rs index c8debe8d711..baa985b00cd 100644 --- a/tests/codegen/intrinsics/const_eval_select.rs +++ b/tests/codegen/intrinsics/const_eval_select.rs @@ -6,10 +6,14 @@ use std::intrinsics::const_eval_select; -const fn foo(_: i32) -> i32 { 1 } +const fn foo(_: i32) -> i32 { + 1 +} #[no_mangle] -pub fn hi(n: i32) -> i32 { n } +pub fn hi(n: i32) -> i32 { + n +} #[no_mangle] pub unsafe fn hey() { diff --git a/tests/codegen/intrinsics/likely.rs b/tests/codegen/intrinsics/likely.rs index c5904085fc0..098fd9936ce 100644 --- a/tests/codegen/intrinsics/likely.rs +++ b/tests/codegen/intrinsics/likely.rs @@ -3,17 +3,13 @@ #![crate_type = "lib"] #![feature(core_intrinsics)] -use std::intrinsics::{likely,unlikely}; +use std::intrinsics::{likely, unlikely}; #[no_mangle] pub fn check_likely(x: i32, y: i32) -> Option { unsafe { // CHECK: call i1 @llvm.expect.i1(i1 %{{.*}}, i1 true) - if likely(x == y) { - None - } else { - Some(x + y) - } + if likely(x == y) { None } else { Some(x + y) } } } @@ -21,10 +17,6 @@ pub fn check_likely(x: i32, y: i32) -> Option { pub fn check_unlikely(x: i32, y: i32) -> Option { unsafe { // CHECK: call i1 @llvm.expect.i1(i1 %{{.*}}, i1 false) - if unlikely(x == y) { - None - } else { - Some(x + y) - } + if unlikely(x == y) { None } else { Some(x + y) } } } diff --git a/tests/codegen/intrinsics/prefetch.rs b/tests/codegen/intrinsics/prefetch.rs index edd8c20b38f..3f9f21c85cb 100644 --- a/tests/codegen/intrinsics/prefetch.rs +++ b/tests/codegen/intrinsics/prefetch.rs @@ -3,8 +3,9 @@ #![crate_type = "lib"] #![feature(core_intrinsics)] -use std::intrinsics::{prefetch_read_data, prefetch_write_data, - prefetch_read_instruction, prefetch_write_instruction}; +use std::intrinsics::{ + prefetch_read_data, prefetch_read_instruction, prefetch_write_data, prefetch_write_instruction, +}; #[no_mangle] pub fn check_prefetch_read_data(data: &[i8]) { diff --git a/tests/codegen/is_val_statically_known.rs b/tests/codegen/is_val_statically_known.rs index 255d8950a97..6af4f353a48 100644 --- a/tests/codegen/is_val_statically_known.rs +++ b/tests/codegen/is_val_statically_known.rs @@ -75,7 +75,7 @@ pub fn _slice_ref(a: &[u8]) -> i32 { #[no_mangle] pub fn _slice_ref_borrow() -> i32 { // CHECK: ret i32 6 - _slice_ref(&[0;3]) + _slice_ref(&[0; 3]) } // CHECK-LABEL: @_slice_ref_arg( diff --git a/tests/codegen/issue-97217.rs b/tests/codegen/issue-97217.rs index a0dfff2ef2e..ecf1fa1ddb3 100644 --- a/tests/codegen/issue-97217.rs +++ b/tests/codegen/issue-97217.rs @@ -16,6 +16,6 @@ pub fn issue97217() -> i32 { let v1 = vec![5, 6, 7]; let v1_iter = v1.iter(); let total: i32 = v1_iter.sum(); - println!("{}",total); + println!("{}", total); total } diff --git a/tests/codegen/issues/issue-103327.rs b/tests/codegen/issues/issue-103327.rs index 398b1f376b7..f8cf273e4a6 100644 --- a/tests/codegen/issues/issue-103327.rs +++ b/tests/codegen/issues/issue-103327.rs @@ -9,9 +9,5 @@ pub fn test(a: i32, b: i32) -> bool { let c1 = (a >= 0) && (a <= 10); let c2 = (b >= 0) && (b <= 20); - if c1 & c2 { - a + 100 != b - } else { - true - } + if c1 & c2 { a + 100 != b } else { true } } diff --git a/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs b/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs index 56b4330b1a6..db9eeda19a6 100644 --- a/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs +++ b/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs @@ -6,7 +6,8 @@ #[no_mangle] pub fn outer_function(x: S, y: S) -> usize { - (#[inline(always)]|| { + (#[inline(always)] + || { let _z = x; y.0[0] })() diff --git a/tests/codegen/issues/issue-119422.rs b/tests/codegen/issues/issue-119422.rs index aa56bfe79ac..682430a79f4 100644 --- a/tests/codegen/issues/issue-119422.rs +++ b/tests/codegen/issues/issue-119422.rs @@ -5,8 +5,8 @@ //@ only-64bit (because the LLVM type of i64 for usize shows up) #![crate_type = "lib"] -use core::ptr::NonNull; use core::num::NonZero; +use core::ptr::NonNull; // CHECK-LABEL: @check_non_null #[no_mangle] @@ -73,7 +73,7 @@ pub fn isize_try_from_i32(x: NonZero) -> NonZero { // CHECK-LABEL: @u64_from_nonzero_is_not_zero #[no_mangle] -pub fn u64_from_nonzero_is_not_zero(x: NonZero)->bool { +pub fn u64_from_nonzero_is_not_zero(x: NonZero) -> bool { // CHECK-NOT: br // CHECK: ret i1 false // CHECK-NOT: br diff --git a/tests/codegen/issues/issue-13018.rs b/tests/codegen/issues/issue-13018.rs index d0a8ce15911..66282dc4274 100644 --- a/tests/codegen/issues/issue-13018.rs +++ b/tests/codegen/issues/issue-13018.rs @@ -6,6 +6,6 @@ use std::rc::Rc; pub fn foo(t: &Rc>) { -// CHECK-NOT: __rust_dealloc + // CHECK-NOT: __rust_dealloc drop(t.clone()); } diff --git a/tests/codegen/issues/issue-32364.rs b/tests/codegen/issues/issue-32364.rs index 50006e3f218..016981d1947 100644 --- a/tests/codegen/issues/issue-32364.rs +++ b/tests/codegen/issues/issue-32364.rs @@ -7,10 +7,9 @@ struct Foo; impl Foo { -// CHECK: define internal x86_stdcallcc void @{{.*}}foo{{.*}}() + // CHECK: define internal x86_stdcallcc void @{{.*}}foo{{.*}}() #[inline(never)] - pub extern "stdcall" fn foo() { - } + pub extern "stdcall" fn foo() {} } fn main() { diff --git a/tests/codegen/issues/issue-37945.rs b/tests/codegen/issues/issue-37945.rs index 756a75e2f0e..01d1c694ec7 100644 --- a/tests/codegen/issues/issue-37945.rs +++ b/tests/codegen/issues/issue-37945.rs @@ -9,26 +9,26 @@ #[no_mangle] pub fn is_empty_1(xs: Iter) -> bool { -// CHECK-LABEL: @is_empty_1( -// CHECK-NEXT: start: -// CHECK-NEXT: [[A:%.*]] = icmp ne ptr {{%xs.0|%xs.1}}, null -// CHECK-NEXT: tail call void @llvm.assume(i1 [[A]]) -// The order between %xs.0 and %xs.1 on the next line doesn't matter -// and different LLVM versions produce different order. -// CHECK-NEXT: [[B:%.*]] = icmp eq ptr {{%xs.0, %xs.1|%xs.1, %xs.0}} -// CHECK-NEXT: ret i1 [[B:%.*]] - {xs}.next().is_none() + // CHECK-LABEL: @is_empty_1( + // CHECK-NEXT: start: + // CHECK-NEXT: [[A:%.*]] = icmp ne ptr {{%xs.0|%xs.1}}, null + // CHECK-NEXT: tail call void @llvm.assume(i1 [[A]]) + // The order between %xs.0 and %xs.1 on the next line doesn't matter + // and different LLVM versions produce different order. + // CHECK-NEXT: [[B:%.*]] = icmp eq ptr {{%xs.0, %xs.1|%xs.1, %xs.0}} + // CHECK-NEXT: ret i1 [[B:%.*]] + { xs }.next().is_none() } #[no_mangle] pub fn is_empty_2(xs: Iter) -> bool { -// CHECK-LABEL: @is_empty_2 -// CHECK-NEXT: start: -// CHECK-NEXT: [[C:%.*]] = icmp ne ptr {{%xs.0|%xs.1}}, null -// CHECK-NEXT: tail call void @llvm.assume(i1 [[C]]) -// The order between %xs.0 and %xs.1 on the next line doesn't matter -// and different LLVM versions produce different order. -// CHECK-NEXT: [[D:%.*]] = icmp eq ptr {{%xs.0, %xs.1|%xs.1, %xs.0}} -// CHECK-NEXT: ret i1 [[D:%.*]] + // CHECK-LABEL: @is_empty_2 + // CHECK-NEXT: start: + // CHECK-NEXT: [[C:%.*]] = icmp ne ptr {{%xs.0|%xs.1}}, null + // CHECK-NEXT: tail call void @llvm.assume(i1 [[C]]) + // The order between %xs.0 and %xs.1 on the next line doesn't matter + // and different LLVM versions produce different order. + // CHECK-NEXT: [[D:%.*]] = icmp eq ptr {{%xs.0, %xs.1|%xs.1, %xs.0}} + // CHECK-NEXT: ret i1 [[D:%.*]] xs.map(|&x| x).next().is_none() } diff --git a/tests/codegen/issues/issue-45466.rs b/tests/codegen/issues/issue-45466.rs index fc714247dfb..8a324fa555b 100644 --- a/tests/codegen/issues/issue-45466.rs +++ b/tests/codegen/issues/issue-45466.rs @@ -1,6 +1,6 @@ //@ compile-flags: -O -#![crate_type="rlib"] +#![crate_type = "rlib"] // CHECK-LABEL: @memzero // CHECK-NOT: store diff --git a/tests/codegen/issues/issue-45964-bounds-check-slice-pos.rs b/tests/codegen/issues/issue-45964-bounds-check-slice-pos.rs index b7568bea4d0..ea9288564e9 100644 --- a/tests/codegen/issues/issue-45964-bounds-check-slice-pos.rs +++ b/tests/codegen/issues/issue-45964-bounds-check-slice-pos.rs @@ -3,7 +3,7 @@ //@ compile-flags: -O -#![crate_type="rlib"] +#![crate_type = "rlib"] // CHECK-LABEL: @test #[no_mangle] diff --git a/tests/codegen/issues/issue-47278.rs b/tests/codegen/issues/issue-47278.rs index 9076274f45e..4f0a5bdf36f 100644 --- a/tests/codegen/issues/issue-47278.rs +++ b/tests/codegen/issues/issue-47278.rs @@ -1,9 +1,11 @@ // -C no-prepopulate-passes -#![crate_type="staticlib"] +#![crate_type = "staticlib"] #[repr(C)] pub struct Foo(u64); // CHECK: define {{.*}} @foo( #[no_mangle] -pub extern "C" fn foo(_: Foo) -> Foo { loop {} } +pub extern "C" fn foo(_: Foo) -> Foo { + loop {} +} diff --git a/tests/codegen/issues/issue-47442.rs b/tests/codegen/issues/issue-47442.rs index 6944336d335..445234e55ad 100644 --- a/tests/codegen/issues/issue-47442.rs +++ b/tests/codegen/issues/issue-47442.rs @@ -4,7 +4,7 @@ // CHECK-NOT: Unwind #![feature(test)] -#![crate_type="rlib"] +#![crate_type = "rlib"] extern crate test; diff --git a/tests/codegen/issues/issue-56267-2.rs b/tests/codegen/issues/issue-56267-2.rs index ced0d2d63bb..98e3732777e 100644 --- a/tests/codegen/issues/issue-56267-2.rs +++ b/tests/codegen/issues/issue-56267-2.rs @@ -1,6 +1,6 @@ //@ compile-flags: -C no-prepopulate-passes -#![crate_type="rlib"] +#![crate_type = "rlib"] #[allow(dead_code)] pub struct Foo { diff --git a/tests/codegen/issues/issue-56267.rs b/tests/codegen/issues/issue-56267.rs index fc3754f2d99..cabcc298482 100644 --- a/tests/codegen/issues/issue-56267.rs +++ b/tests/codegen/issues/issue-56267.rs @@ -1,6 +1,6 @@ //@ compile-flags: -C no-prepopulate-passes -#![crate_type="rlib"] +#![crate_type = "rlib"] #[allow(dead_code)] pub struct Foo { diff --git a/tests/codegen/issues/issue-56927.rs b/tests/codegen/issues/issue-56927.rs index e4a0a179141..a40718689b3 100644 --- a/tests/codegen/issues/issue-56927.rs +++ b/tests/codegen/issues/issue-56927.rs @@ -1,6 +1,6 @@ //@ compile-flags: -C no-prepopulate-passes -#![crate_type="rlib"] +#![crate_type = "rlib"] #[repr(align(16))] pub struct S { diff --git a/tests/codegen/issues/issue-73031.rs b/tests/codegen/issues/issue-73031.rs index 61a269999e9..db9c6d6db23 100644 --- a/tests/codegen/issues/issue-73031.rs +++ b/tests/codegen/issues/issue-73031.rs @@ -12,11 +12,7 @@ pub enum All { // CHECK-LABEL: @issue_73031 #[no_mangle] pub fn issue_73031(a: &mut All, q: i32) -> i32 { - *a = if q == 5 { - All::Foo - } else { - All::Bar - }; + *a = if q == 5 { All::Foo } else { All::Bar }; match *a { // CHECK-NOT: panic All::None => panic!(), diff --git a/tests/codegen/issues/issue-73258.rs b/tests/codegen/issues/issue-73258.rs index 48f14fe2dfe..e5c622b5656 100644 --- a/tests/codegen/issues/issue-73258.rs +++ b/tests/codegen/issues/issue-73258.rs @@ -7,7 +7,10 @@ #[derive(Clone, Copy)] #[repr(u8)] pub enum Foo { - A, B, C, D, + A, + B, + C, + D, } // CHECK-LABEL: @issue_73258( diff --git a/tests/codegen/issues/issue-73338-effecient-cmp.rs b/tests/codegen/issues/issue-73338-effecient-cmp.rs index a64eb56f903..71641a5457b 100644 --- a/tests/codegen/issues/issue-73338-effecient-cmp.rs +++ b/tests/codegen/issues/issue-73338-effecient-cmp.rs @@ -4,7 +4,7 @@ //@ compile-flags: -Copt-level=3 -#![crate_type="lib"] +#![crate_type = "lib"] #[repr(u32)] #[derive(Copy, Clone, Eq, PartialEq, PartialOrd)] @@ -15,25 +15,25 @@ pub enum Foo { } #[no_mangle] -pub fn compare_less(a: Foo, b: Foo)->bool{ +pub fn compare_less(a: Foo, b: Foo) -> bool { // CHECK-NOT: br {{.*}} a < b } #[no_mangle] -pub fn compare_le(a: Foo, b: Foo)->bool{ +pub fn compare_le(a: Foo, b: Foo) -> bool { // CHECK-NOT: br {{.*}} a <= b } #[no_mangle] -pub fn compare_ge(a: Foo, b: Foo)->bool{ +pub fn compare_ge(a: Foo, b: Foo) -> bool { // CHECK-NOT: br {{.*}} a >= b } #[no_mangle] -pub fn compare_greater(a: Foo, b: Foo)->bool{ +pub fn compare_greater(a: Foo, b: Foo) -> bool { // CHECK-NOT: br {{.*}} a > b } diff --git a/tests/codegen/issues/issue-73396-bounds-check-after-position.rs b/tests/codegen/issues/issue-73396-bounds-check-after-position.rs index ef4538ac84e..9b3b1318ced 100644 --- a/tests/codegen/issues/issue-73396-bounds-check-after-position.rs +++ b/tests/codegen/issues/issue-73396-bounds-check-after-position.rs @@ -12,11 +12,7 @@ pub fn position_slice_to_no_bounds_check(s: &[u8]) -> &[u8] { // CHECK-NOT: slice_end_index_len_fail // CHECK-NOT: panic_bounds_check // CHECK-NOT: unreachable - if let Some(idx) = s.iter().position(|b| *b == b'\\') { - &s[..idx] - } else { - s - } + if let Some(idx) = s.iter().position(|b| *b == b'\\') { &s[..idx] } else { s } } // CHECK-LABEL: @position_slice_from_no_bounds_check @@ -27,11 +23,7 @@ pub fn position_slice_from_no_bounds_check(s: &[u8]) -> &[u8] { // CHECK-NOT: slice_end_index_len_fail // CHECK-NOT: panic_bounds_check // CHECK-NOT: unreachable - if let Some(idx) = s.iter().position(|b| *b == b'\\') { - &s[idx..] - } else { - s - } + if let Some(idx) = s.iter().position(|b| *b == b'\\') { &s[idx..] } else { s } } // CHECK-LABEL: @position_index_no_bounds_check @@ -42,11 +34,7 @@ pub fn position_index_no_bounds_check(s: &[u8]) -> u8 { // CHECK-NOT: slice_end_index_len_fail // CHECK-NOT: panic_bounds_check // CHECK-NOT: unreachable - if let Some(idx) = s.iter().position(|b| *b == b'\\') { - s[idx] - } else { - 42 - } + if let Some(idx) = s.iter().position(|b| *b == b'\\') { s[idx] } else { 42 } } // CHECK-LABEL: @rposition_slice_to_no_bounds_check #[no_mangle] @@ -56,11 +44,7 @@ pub fn rposition_slice_to_no_bounds_check(s: &[u8]) -> &[u8] { // CHECK-NOT: slice_end_index_len_fail // CHECK-NOT: panic_bounds_check // CHECK-NOT: unreachable - if let Some(idx) = s.iter().rposition(|b| *b == b'\\') { - &s[..idx] - } else { - s - } + if let Some(idx) = s.iter().rposition(|b| *b == b'\\') { &s[..idx] } else { s } } // CHECK-LABEL: @rposition_slice_from_no_bounds_check @@ -71,11 +55,7 @@ pub fn rposition_slice_from_no_bounds_check(s: &[u8]) -> &[u8] { // CHECK-NOT: slice_end_index_len_fail // CHECK-NOT: panic_bounds_check // CHECK-NOT: unreachable - if let Some(idx) = s.iter().rposition(|b| *b == b'\\') { - &s[idx..] - } else { - s - } + if let Some(idx) = s.iter().rposition(|b| *b == b'\\') { &s[idx..] } else { s } } // CHECK-LABEL: @rposition_index_no_bounds_check @@ -86,9 +66,5 @@ pub fn rposition_index_no_bounds_check(s: &[u8]) -> u8 { // CHECK-NOT: slice_end_index_len_fail // CHECK-NOT: panic_bounds_check // CHECK-NOT: unreachable - if let Some(idx) = s.iter().rposition(|b| *b == b'\\') { - s[idx] - } else { - 42 - } + if let Some(idx) = s.iter().rposition(|b| *b == b'\\') { s[idx] } else { 42 } } diff --git a/tests/codegen/issues/issue-75546.rs b/tests/codegen/issues/issue-75546.rs index 992ef97d624..1132c8ab509 100644 --- a/tests/codegen/issues/issue-75546.rs +++ b/tests/codegen/issues/issue-75546.rs @@ -9,7 +9,9 @@ pub fn issue_75546() { let mut i = 1u32; while i < u32::MAX { // CHECK-NOT: panic - if i == 0 { panic!(); } + if i == 0 { + panic!(); + } i += 1; } } diff --git a/tests/codegen/issues/issue-77812.rs b/tests/codegen/issues/issue-77812.rs index b9ce0a4f7db..bf84ac21b16 100644 --- a/tests/codegen/issues/issue-77812.rs +++ b/tests/codegen/issues/issue-77812.rs @@ -10,7 +10,7 @@ pub enum Variant { Two, } -extern { +extern "C" { fn exf1(); fn exf2(); } diff --git a/tests/codegen/issues/issue-84268.rs b/tests/codegen/issues/issue-84268.rs index 1e3950609b3..5e852133ed3 100644 --- a/tests/codegen/issues/issue-84268.rs +++ b/tests/codegen/issues/issue-84268.rs @@ -17,7 +17,5 @@ pub fn is_infinite(v: V) -> M { // CHECK: fabs // CHECK: cmp oeq - unsafe { - simd_eq(simd_fabs(v), V([f32::INFINITY; 4])) - } + unsafe { simd_eq(simd_fabs(v), V([f32::INFINITY; 4])) } } diff --git a/tests/codegen/issues/issue-96497-slice-size-nowrap.rs b/tests/codegen/issues/issue-96497-slice-size-nowrap.rs index c2b262b3334..f922462cc27 100644 --- a/tests/codegen/issues/issue-96497-slice-size-nowrap.rs +++ b/tests/codegen/issues/issue-96497-slice-size-nowrap.rs @@ -4,7 +4,7 @@ //@ compile-flags: -O -#![crate_type="lib"] +#![crate_type = "lib"] // CHECK-LABEL: @simple_size_of_nowrap #[no_mangle] diff --git a/tests/codegen/issues/issue-99960.rs b/tests/codegen/issues/issue-99960.rs index 07549506175..9029121d35f 100644 --- a/tests/codegen/issues/issue-99960.rs +++ b/tests/codegen/issues/issue-99960.rs @@ -6,9 +6,5 @@ pub fn test(dividend: i64, divisor: i64) -> Option { // CHECK-LABEL: @test( // CHECK-NOT: panic - if dividend > i64::min_value() && divisor != 0 { - Some(dividend / divisor) - } else { - None - } + if dividend > i64::min_value() && divisor != 0 { Some(dividend / divisor) } else { None } } diff --git a/tests/codegen/lib-optimizations/iter-sum.rs b/tests/codegen/lib-optimizations/iter-sum.rs index b563a6debb5..ea8c916bfc1 100644 --- a/tests/codegen/lib-optimizations/iter-sum.rs +++ b/tests/codegen/lib-optimizations/iter-sum.rs @@ -2,7 +2,6 @@ //@ only-x86_64 (vectorization varies between architectures) #![crate_type = "lib"] - // Ensure that slice + take + sum gets vectorized. // Currently this relies on the slice::Iter::try_fold implementation // CHECK-LABEL: @slice_take_sum diff --git a/tests/codegen/lifetime_start_end.rs b/tests/codegen/lifetime_start_end.rs index 38e87845158..99d37c25dca 100644 --- a/tests/codegen/lifetime_start_end.rs +++ b/tests/codegen/lifetime_start_end.rs @@ -8,27 +8,27 @@ pub fn test() { let a = 0u8; &a; // keep variable in an alloca -// CHECK: call void @llvm.lifetime.start{{.*}}(i{{[0-9 ]+}}, ptr %a) + // CHECK: call void @llvm.lifetime.start{{.*}}(i{{[0-9 ]+}}, ptr %a) { let b = &Some(a); &b; // keep variable in an alloca -// CHECK: call void @llvm.lifetime.start{{.*}}(i{{[0-9 ]+}}, {{.*}}) + // CHECK: call void @llvm.lifetime.start{{.*}}(i{{[0-9 ]+}}, {{.*}}) -// CHECK: call void @llvm.lifetime.start{{.*}}(i{{[0-9 ]+}}, {{.*}}) + // CHECK: call void @llvm.lifetime.start{{.*}}(i{{[0-9 ]+}}, {{.*}}) -// CHECK: call void @llvm.lifetime.end{{.*}}(i{{[0-9 ]+}}, {{.*}}) + // CHECK: call void @llvm.lifetime.end{{.*}}(i{{[0-9 ]+}}, {{.*}}) -// CHECK: call void @llvm.lifetime.end{{.*}}(i{{[0-9 ]+}}, {{.*}}) + // CHECK: call void @llvm.lifetime.end{{.*}}(i{{[0-9 ]+}}, {{.*}}) } let c = 1u8; &c; // keep variable in an alloca -// CHECK: call void @llvm.lifetime.start{{.*}}(i{{[0-9 ]+}}, ptr %c) + // CHECK: call void @llvm.lifetime.start{{.*}}(i{{[0-9 ]+}}, ptr %c) -// CHECK: call void @llvm.lifetime.end{{.*}}(i{{[0-9 ]+}}, ptr %c) + // CHECK: call void @llvm.lifetime.end{{.*}}(i{{[0-9 ]+}}, ptr %c) -// CHECK: call void @llvm.lifetime.end{{.*}}(i{{[0-9 ]+}}, ptr %a) + // CHECK: call void @llvm.lifetime.end{{.*}}(i{{[0-9 ]+}}, ptr %a) } diff --git a/tests/codegen/link-dead-code.rs b/tests/codegen/link-dead-code.rs index 7769622233f..93e1d84d9c7 100644 --- a/tests/codegen/link-dead-code.rs +++ b/tests/codegen/link-dead-code.rs @@ -8,15 +8,21 @@ // CHECK-LABEL: ; link_dead_code::const_fn // CHECK-NEXT: ; Function Attrs: // CHECK-NEXT: define hidden -const fn const_fn() -> i32 { 1 } +const fn const_fn() -> i32 { + 1 +} // CHECK-LABEL: ; link_dead_code::inline_fn // CHECK-NEXT: ; Function Attrs: // CHECK-NEXT: define hidden #[inline] -fn inline_fn() -> i32 { 2 } +fn inline_fn() -> i32 { + 2 +} // CHECK-LABEL: ; link_dead_code::private_fn // CHECK-NEXT: ; Function Attrs: // CHECK-NEXT: define hidden -fn private_fn() -> i32 { 3 } +fn private_fn() -> i32 { + 3 +} diff --git a/tests/codegen/link_section.rs b/tests/codegen/link_section.rs index 281d3fb99d4..196f5edb7d6 100644 --- a/tests/codegen/link_section.rs +++ b/tests/codegen/link_section.rs @@ -16,7 +16,7 @@ pub enum E { A(u32), - B(f32) + B(f32), } // CHECK: @VAR2 = {{(dso_local )?}}constant {{.*}}, section ".test_two" diff --git a/tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs b/tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs index d978f2d2525..cba1a980caa 100644 --- a/tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs +++ b/tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs @@ -6,9 +6,12 @@ #![no_std] #![no_core] -#[lang="sized"] trait Sized { } -#[lang="freeze"] trait Freeze { } -#[lang="copy"] trait Copy { } +#[lang = "sized"] +trait Sized {} +#[lang = "freeze"] +trait Freeze {} +#[lang = "copy"] +trait Copy {} // CHECK: define void @f_fpr_tracking(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, i8 noundef zeroext %i) #[no_mangle] diff --git a/tests/codegen/lto-removes-invokes.rs b/tests/codegen/lto-removes-invokes.rs index f0102c25d5b..3217c239bf7 100644 --- a/tests/codegen/lto-removes-invokes.rs +++ b/tests/codegen/lto-removes-invokes.rs @@ -10,8 +10,8 @@ fn main() { fn foo() { let _a = Box::new(3); bar(); -// CHECK-LABEL: define dso_local void @foo -// CHECK: call void @bar + // CHECK-LABEL: define dso_local void @foo + // CHECK: call void @bar } #[inline(never)] diff --git a/tests/codegen/macos/i686-macosx-deployment-target.rs b/tests/codegen/macos/i686-macosx-deployment-target.rs index b854476de41..389434da1f6 100644 --- a/tests/codegen/macos/i686-macosx-deployment-target.rs +++ b/tests/codegen/macos/i686-macosx-deployment-target.rs @@ -8,12 +8,12 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang="sized"] -trait Sized { } -#[lang="freeze"] -trait Freeze { } -#[lang="copy"] -trait Copy { } +#[lang = "sized"] +trait Sized {} +#[lang = "freeze"] +trait Freeze {} +#[lang = "copy"] +trait Copy {} #[repr(C)] pub struct Bool { diff --git a/tests/codegen/macos/i686-no-macosx-deployment-target.rs b/tests/codegen/macos/i686-no-macosx-deployment-target.rs index a49a3467e7a..4c6b7656e59 100644 --- a/tests/codegen/macos/i686-no-macosx-deployment-target.rs +++ b/tests/codegen/macos/i686-no-macosx-deployment-target.rs @@ -8,12 +8,12 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang="sized"] -trait Sized { } -#[lang="freeze"] -trait Freeze { } -#[lang="copy"] -trait Copy { } +#[lang = "sized"] +trait Sized {} +#[lang = "freeze"] +trait Freeze {} +#[lang = "copy"] +trait Copy {} #[repr(C)] pub struct Bool { diff --git a/tests/codegen/macos/x86_64-macosx-deployment-target.rs b/tests/codegen/macos/x86_64-macosx-deployment-target.rs index eac989c2954..a40deca24bb 100644 --- a/tests/codegen/macos/x86_64-macosx-deployment-target.rs +++ b/tests/codegen/macos/x86_64-macosx-deployment-target.rs @@ -8,12 +8,12 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang="sized"] -trait Sized { } -#[lang="freeze"] -trait Freeze { } -#[lang="copy"] -trait Copy { } +#[lang = "sized"] +trait Sized {} +#[lang = "freeze"] +trait Freeze {} +#[lang = "copy"] +trait Copy {} #[repr(C)] pub struct Bool { diff --git a/tests/codegen/macos/x86_64-no-macosx-deployment-target.rs b/tests/codegen/macos/x86_64-no-macosx-deployment-target.rs index ed294cf4e3d..26d519ef1a6 100644 --- a/tests/codegen/macos/x86_64-no-macosx-deployment-target.rs +++ b/tests/codegen/macos/x86_64-no-macosx-deployment-target.rs @@ -8,12 +8,12 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang="sized"] -trait Sized { } -#[lang="freeze"] -trait Freeze { } -#[lang="copy"] -trait Copy { } +#[lang = "sized"] +trait Sized {} +#[lang = "freeze"] +trait Freeze {} +#[lang = "copy"] +trait Copy {} #[repr(C)] pub struct Bool { diff --git a/tests/codegen/match-optimized.rs b/tests/codegen/match-optimized.rs index 5cecafb9f29..d6893be0b7b 100644 --- a/tests/codegen/match-optimized.rs +++ b/tests/codegen/match-optimized.rs @@ -11,23 +11,23 @@ pub enum E { // CHECK-LABEL: @exhaustive_match #[no_mangle] pub fn exhaustive_match(e: E) -> u8 { -// CHECK: switch{{.*}}, label %[[OTHERWISE:[a-zA-Z0-9_]+]] [ -// CHECK-NEXT: i[[TY:[0-9]+]] [[DISCR:[0-9]+]], label %[[A:[a-zA-Z0-9_]+]] -// CHECK-NEXT: i[[TY:[0-9]+]] [[DISCR:[0-9]+]], label %[[B:[a-zA-Z0-9_]+]] -// CHECK-NEXT: i[[TY:[0-9]+]] [[DISCR:[0-9]+]], label %[[C:[a-zA-Z0-9_]+]] -// CHECK-NEXT: ] -// CHECK: [[OTHERWISE]]: -// CHECK-NEXT: unreachable -// -// CHECK: [[A]]: -// CHECK-NEXT: store i8 0, ptr %_0, align 1 -// CHECK-NEXT: br label %[[EXIT:[a-zA-Z0-9_]+]] -// CHECK: [[B]]: -// CHECK-NEXT: store i8 1, ptr %_0, align 1 -// CHECK-NEXT: br label %[[EXIT]] -// CHECK: [[C]]: -// CHECK-NEXT: store i8 3, ptr %_0, align 1 -// CHECK-NEXT: br label %[[EXIT]] + // CHECK: switch{{.*}}, label %[[OTHERWISE:[a-zA-Z0-9_]+]] [ + // CHECK-NEXT: i[[TY:[0-9]+]] [[DISCR:[0-9]+]], label %[[A:[a-zA-Z0-9_]+]] + // CHECK-NEXT: i[[TY:[0-9]+]] [[DISCR:[0-9]+]], label %[[B:[a-zA-Z0-9_]+]] + // CHECK-NEXT: i[[TY:[0-9]+]] [[DISCR:[0-9]+]], label %[[C:[a-zA-Z0-9_]+]] + // CHECK-NEXT: ] + // CHECK: [[OTHERWISE]]: + // CHECK-NEXT: unreachable + // + // CHECK: [[A]]: + // CHECK-NEXT: store i8 0, ptr %_0, align 1 + // CHECK-NEXT: br label %[[EXIT:[a-zA-Z0-9_]+]] + // CHECK: [[B]]: + // CHECK-NEXT: store i8 1, ptr %_0, align 1 + // CHECK-NEXT: br label %[[EXIT]] + // CHECK: [[C]]: + // CHECK-NEXT: store i8 3, ptr %_0, align 1 + // CHECK-NEXT: br label %[[EXIT]] match e { E::A => 0, E::B => 1, diff --git a/tests/codegen/match-optimizes-away.rs b/tests/codegen/match-optimizes-away.rs index 55ece89cec2..82ab5718b37 100644 --- a/tests/codegen/match-optimizes-away.rs +++ b/tests/codegen/match-optimizes-away.rs @@ -1,11 +1,20 @@ // //@ compile-flags: -O -#![crate_type="lib"] +#![crate_type = "lib"] -pub enum Three { A, B, C } +pub enum Three { + A, + B, + C, +} #[repr(u16)] -pub enum Four { A, B, C, D } +pub enum Four { + A, + B, + C, + D, +} #[no_mangle] pub fn three_valued(x: Three) -> Three { diff --git a/tests/codegen/mir_zst_stores.rs b/tests/codegen/mir_zst_stores.rs index 667273c2f0f..ff1d429cffd 100644 --- a/tests/codegen/mir_zst_stores.rs +++ b/tests/codegen/mir_zst_stores.rs @@ -4,7 +4,9 @@ use std::marker::PhantomData; #[derive(Copy, Clone)] -struct Zst { phantom: PhantomData } +struct Zst { + phantom: PhantomData, +} // CHECK-LABEL: @mir // CHECK-NOT: store{{.*}}undef diff --git a/tests/codegen/naked-fn/naked-functions.rs b/tests/codegen/naked-fn/naked-functions.rs index 3c426825537..307745a921c 100644 --- a/tests/codegen/naked-fn/naked-functions.rs +++ b/tests/codegen/naked-fn/naked-functions.rs @@ -14,8 +14,7 @@ // CHECK-NEXT: {{.+}}: // CHECK-NEXT: call void asm // CHECK-NEXT: unreachable - asm!("ret", - options(noreturn)); + asm!("ret", options(noreturn)); } // CHECK: Function Attrs: naked @@ -26,7 +25,5 @@ // CHECK-NEXT: {{.+}}: // CHECK-NEXT: call void asm // CHECK-NEXT: unreachable - asm!("lea rax, [rdi + rsi]", - "ret", - options(noreturn)); + asm!("lea rax, [rdi + rsi]", "ret", options(noreturn)); } diff --git a/tests/codegen/no-assumes-on-casts.rs b/tests/codegen/no-assumes-on-casts.rs index b9c264daa2d..9c00dc2c015 100644 --- a/tests/codegen/no-assumes-on-casts.rs +++ b/tests/codegen/no-assumes-on-casts.rs @@ -6,14 +6,14 @@ #[no_mangle] pub fn fna(a: i16) -> i32 { a as i32 -// CHECK-NOT: assume -// CHECK: sext + // CHECK-NOT: assume + // CHECK: sext } // CHECK-LABEL: fnb #[no_mangle] pub fn fnb(a: u16) -> u32 { a as u32 -// CHECK-NOT: assume -// CHECK: zext + // CHECK-NOT: assume + // CHECK: zext } diff --git a/tests/codegen/noalias-freeze.rs b/tests/codegen/noalias-freeze.rs index 8086f3afbbc..32c84014026 100644 --- a/tests/codegen/noalias-freeze.rs +++ b/tests/codegen/noalias-freeze.rs @@ -8,7 +8,9 @@ #![crate_type = "lib"] -fn project(x: &(T,)) -> &T { &x.0 } +fn project(x: &(T,)) -> &T { + &x.0 +} fn dummy() {} diff --git a/tests/codegen/noalias-unpin.rs b/tests/codegen/noalias-unpin.rs index 546b1edb7b6..630a62020c1 100644 --- a/tests/codegen/noalias-unpin.rs +++ b/tests/codegen/noalias-unpin.rs @@ -4,7 +4,7 @@ pub struct SelfRef { self_ref: *mut SelfRef, - _pin: std::marker::PhantomPinned + _pin: std::marker::PhantomPinned, } // CHECK-LABEL: @test_self_ref( diff --git a/tests/codegen/non-terminate/infinite-recursion.rs b/tests/codegen/non-terminate/infinite-recursion.rs index 804704c0292..19123639896 100644 --- a/tests/codegen/non-terminate/infinite-recursion.rs +++ b/tests/codegen/non-terminate/infinite-recursion.rs @@ -1,7 +1,6 @@ //@ compile-flags: -C opt-level=3 #![crate_type = "lib"] - #![allow(unconditional_recursion)] // CHECK-LABEL: @infinite_recursion diff --git a/tests/codegen/noreturnflag.rs b/tests/codegen/noreturnflag.rs index a8f08628986..d9bb30b2703 100644 --- a/tests/codegen/noreturnflag.rs +++ b/tests/codegen/noreturnflag.rs @@ -4,7 +4,7 @@ #[no_mangle] pub fn foo() -> ! { -// CHECK: @foo() unnamed_addr #0 + // CHECK: @foo() unnamed_addr #0 loop {} } @@ -12,7 +12,7 @@ pub enum EmptyEnum {} #[no_mangle] pub fn bar() -> EmptyEnum { -// CHECK: @bar() unnamed_addr #0 + // CHECK: @bar() unnamed_addr #0 loop {} } diff --git a/tests/codegen/nounwind.rs b/tests/codegen/nounwind.rs index 2b237ef0120..464bc2535c2 100644 --- a/tests/codegen/nounwind.rs +++ b/tests/codegen/nounwind.rs @@ -10,7 +10,7 @@ #[no_mangle] pub fn foo() { nounwind::bar(); -// CHECK: @foo() unnamed_addr #0 -// CHECK: @bar() unnamed_addr #0 -// CHECK: attributes #0 = { {{.*}}nounwind{{.*}} } + // CHECK: @foo() unnamed_addr #0 + // CHECK: @bar() unnamed_addr #0 + // CHECK: attributes #0 = { {{.*}}nounwind{{.*}} } } diff --git a/tests/codegen/optimize-attr-1.rs b/tests/codegen/optimize-attr-1.rs index c8e68779aae..3aee44791e0 100644 --- a/tests/codegen/optimize-attr-1.rs +++ b/tests/codegen/optimize-attr-1.rs @@ -4,7 +4,7 @@ //@[SPEED-OPT] compile-flags: -Copt-level=3 -Ccodegen-units=1 #![feature(optimize_attribute)] -#![crate_type="rlib"] +#![crate_type = "rlib"] // CHECK-LABEL: define{{.*}}i32 @nothing // CHECK-SAME: [[NOTHING_ATTRS:#[0-9]+]] diff --git a/tests/codegen/option-niche-eq.rs b/tests/codegen/option-niche-eq.rs index 25ea5dd595c..4d3a7ce3764 100644 --- a/tests/codegen/option-niche-eq.rs +++ b/tests/codegen/option-niche-eq.rs @@ -4,8 +4,8 @@ extern crate core; use core::cmp::Ordering; -use core::ptr::NonNull; use core::num::NonZero; +use core::ptr::NonNull; // CHECK-LABEL: @non_zero_eq #[no_mangle] diff --git a/tests/codegen/packed.rs b/tests/codegen/packed.rs index 5142df9c488..790d618b2ea 100644 --- a/tests/codegen/packed.rs +++ b/tests/codegen/packed.rs @@ -6,20 +6,20 @@ #[repr(packed)] pub struct Packed1 { dealign: u8, - data: u32 + data: u32, } #[repr(packed(2))] pub struct Packed2 { dealign: u8, - data: u32 + data: u32, } // CHECK-LABEL: @write_pkd1 #[no_mangle] pub fn write_pkd1(pkd: &mut Packed1) -> u32 { -// CHECK: %{{.*}} = load i32, ptr %{{.*}}, align 1 -// CHECK: store i32 42, ptr %{{.*}}, align 1 + // CHECK: %{{.*}} = load i32, ptr %{{.*}}, align 1 + // CHECK: store i32 42, ptr %{{.*}}, align 1 let result = pkd.data; pkd.data = 42; result @@ -28,8 +28,8 @@ pub fn write_pkd1(pkd: &mut Packed1) -> u32 { // CHECK-LABEL: @write_pkd2 #[no_mangle] pub fn write_pkd2(pkd: &mut Packed2) -> u32 { -// CHECK: %{{.*}} = load i32, ptr %{{.*}}, align 2 -// CHECK: store i32 42, ptr %{{.*}}, align 2 + // CHECK: %{{.*}} = load i32, ptr %{{.*}}, align 2 + // CHECK: store i32 42, ptr %{{.*}}, align 2 let result = pkd.data; pkd.data = 42; result @@ -39,21 +39,21 @@ pub fn write_pkd2(pkd: &mut Packed2) -> u32 { #[repr(packed)] pub struct BigPacked1 { dealign: u8, - data: Array + data: Array, } #[repr(packed(2))] pub struct BigPacked2 { dealign: u8, - data: Array + data: Array, } // CHECK-LABEL: @call_pkd1 #[no_mangle] pub fn call_pkd1(f: fn() -> Array) -> BigPacked1 { -// CHECK: [[ALLOCA:%[_a-z0-9]+]] = alloca [32 x i8] -// CHECK: call void %{{.*}}(ptr noalias nocapture noundef sret{{.*}} dereferenceable(32) [[ALLOCA]]) -// CHECK: call void @llvm.memcpy.{{.*}}(ptr align 1 %{{.*}}, ptr align 4 %{{.*}}, i{{[0-9]+}} 32, i1 false) + // CHECK: [[ALLOCA:%[_a-z0-9]+]] = alloca [32 x i8] + // CHECK: call void %{{.*}}(ptr noalias nocapture noundef sret{{.*}} dereferenceable(32) [[ALLOCA]]) + // CHECK: call void @llvm.memcpy.{{.*}}(ptr align 1 %{{.*}}, ptr align 4 %{{.*}}, i{{[0-9]+}} 32, i1 false) // check that calls whose destination is a field of a packed struct // go through an alloca rather than calling the function with an // unaligned destination. @@ -63,9 +63,9 @@ pub fn call_pkd1(f: fn() -> Array) -> BigPacked1 { // CHECK-LABEL: @call_pkd2 #[no_mangle] pub fn call_pkd2(f: fn() -> Array) -> BigPacked2 { -// CHECK: [[ALLOCA:%[_a-z0-9]+]] = alloca [32 x i8] -// CHECK: call void %{{.*}}(ptr noalias nocapture noundef sret{{.*}} dereferenceable(32) [[ALLOCA]]) -// CHECK: call void @llvm.memcpy.{{.*}}(ptr align 2 %{{.*}}, ptr align 4 %{{.*}}, i{{[0-9]+}} 32, i1 false) + // CHECK: [[ALLOCA:%[_a-z0-9]+]] = alloca [32 x i8] + // CHECK: call void %{{.*}}(ptr noalias nocapture noundef sret{{.*}} dereferenceable(32) [[ALLOCA]]) + // CHECK: call void @llvm.memcpy.{{.*}}(ptr align 2 %{{.*}}, ptr align 4 %{{.*}}, i{{[0-9]+}} 32, i1 false) // check that calls whose destination is a field of a packed struct // go through an alloca rather than calling the function with an // unaligned destination. @@ -119,14 +119,14 @@ pub fn repeat_packed_array2(p: &mut BigPacked2) { // CHECK-LABEL: @pkd1_pair #[no_mangle] pub fn pkd1_pair(pair1: &mut Packed1Pair, pair2: &mut Packed1Pair) { -// CHECK: call void @llvm.memcpy.{{.*}}(ptr align 1 %{{.*}}, ptr align 1 %{{.*}}, i{{[0-9]+}} 5, i1 false) + // CHECK: call void @llvm.memcpy.{{.*}}(ptr align 1 %{{.*}}, ptr align 1 %{{.*}}, i{{[0-9]+}} 5, i1 false) *pair2 = *pair1; } // CHECK-LABEL: @pkd2_pair #[no_mangle] pub fn pkd2_pair(pair1: &mut Packed2Pair, pair2: &mut Packed2Pair) { -// CHECK: call void @llvm.memcpy.{{.*}}(ptr align 2 %{{.*}}, ptr align 2 %{{.*}}, i{{[0-9]+}} 6, i1 false) + // CHECK: call void @llvm.memcpy.{{.*}}(ptr align 2 %{{.*}}, ptr align 2 %{{.*}}, i{{[0-9]+}} 6, i1 false) *pair2 = *pair1; } @@ -141,13 +141,13 @@ pub fn pkd2_pair(pair1: &mut Packed2Pair, pair2: &mut Packed2Pair) { // CHECK-LABEL: @pkd1_nested_pair #[no_mangle] pub fn pkd1_nested_pair(pair1: &mut Packed1NestedPair, pair2: &mut Packed1NestedPair) { -// CHECK: call void @llvm.memcpy.{{.*}}(ptr align 1 %{{.*}}, ptr align 1 %{{.*}}, i{{[0-9]+}} 8, i1 false) + // CHECK: call void @llvm.memcpy.{{.*}}(ptr align 1 %{{.*}}, ptr align 1 %{{.*}}, i{{[0-9]+}} 8, i1 false) *pair2 = *pair1; } // CHECK-LABEL: @pkd2_nested_pair #[no_mangle] pub fn pkd2_nested_pair(pair1: &mut Packed2NestedPair, pair2: &mut Packed2NestedPair) { -// CHECK: call void @llvm.memcpy.{{.*}}(ptr align 2 %{{.*}}, ptr align 2 %{{.*}}, i{{[0-9]+}} 8, i1 false) + // CHECK: call void @llvm.memcpy.{{.*}}(ptr align 2 %{{.*}}, ptr align 2 %{{.*}}, i{{[0-9]+}} 8, i1 false) *pair2 = *pair1; } diff --git a/tests/codegen/panic-abort-windows.rs b/tests/codegen/panic-abort-windows.rs index 71caa1b3d2a..eb61e649f04 100644 --- a/tests/codegen/panic-abort-windows.rs +++ b/tests/codegen/panic-abort-windows.rs @@ -8,11 +8,9 @@ // CHECK: Function Attrs: nounwind uwtable // CHECK-NEXT: define void @normal_uwtable() #[no_mangle] -pub fn normal_uwtable() { -} +pub fn normal_uwtable() {} // CHECK: Function Attrs: nounwind uwtable // CHECK-NEXT: define void @extern_uwtable() #[no_mangle] -pub extern fn extern_uwtable() { -} +pub extern "C" fn extern_uwtable() {} diff --git a/tests/codegen/personality_lifetimes.rs b/tests/codegen/personality_lifetimes.rs index 0ef4aa424d8..828af05436b 100644 --- a/tests/codegen/personality_lifetimes.rs +++ b/tests/codegen/personality_lifetimes.rs @@ -3,19 +3,17 @@ //@ compile-flags: -O -C no-prepopulate-passes -#![crate_type="lib"] +#![crate_type = "lib"] struct S; impl Drop for S { #[inline(never)] - fn drop(&mut self) { - } + fn drop(&mut self) {} } #[inline(never)] -fn might_unwind() { -} +fn might_unwind() {} // CHECK-LABEL: @test #[no_mangle] diff --git a/tests/codegen/pgo-instrumentation.rs b/tests/codegen/pgo-instrumentation.rs index e2c348edf82..b1906c145c6 100644 --- a/tests/codegen/pgo-instrumentation.rs +++ b/tests/codegen/pgo-instrumentation.rs @@ -10,12 +10,10 @@ // CHECK-DAG: @__profd_{{.*}}pgo_instrumentation{{.*}}some_other_function{{.*}} = {{.*}}global // CHECK: @__llvm_profile_filename = {{.*}}"default_%m.profraw\00"{{.*}} -#![crate_type="lib"] +#![crate_type = "lib"] #[inline(never)] -fn some_function() { - -} +fn some_function() {} pub fn some_other_function() { some_function(); diff --git a/tests/codegen/pic-relocation-model.rs b/tests/codegen/pic-relocation-model.rs index 10ade847133..a1d1678a6bd 100644 --- a/tests/codegen/pic-relocation-model.rs +++ b/tests/codegen/pic-relocation-model.rs @@ -5,15 +5,15 @@ // CHECK: define i8 @call_foreign_fn() #[no_mangle] pub fn call_foreign_fn() -> u8 { - unsafe { - foreign_fn() - } + unsafe { foreign_fn() } } // (Allow but do not require `zeroext` here, because it is not worth effort to // spell out which targets have it and which ones do not; see rust#97800.) // CHECK: declare{{( zeroext)?}} i8 @foreign_fn() -extern "C" {fn foreign_fn() -> u8;} +extern "C" { + fn foreign_fn() -> u8; +} // CHECK: !{i32 {{[78]}}, !"PIC Level", i32 2} diff --git a/tests/codegen/pie-relocation-model.rs b/tests/codegen/pie-relocation-model.rs index 20bf8919ac1..b10af693452 100644 --- a/tests/codegen/pie-relocation-model.rs +++ b/tests/codegen/pie-relocation-model.rs @@ -8,15 +8,15 @@ // CHECK: define dso_local i8 @call_foreign_fn() #[no_mangle] pub fn call_foreign_fn() -> u8 { - unsafe { - foreign_fn() - } + unsafe { foreign_fn() } } // External functions are still marked as non-dso_local, since we don't know if the symbol // is defined in the binary or in the shared library. // CHECK: declare zeroext i8 @foreign_fn() -extern "C" {fn foreign_fn() -> u8;} +extern "C" { + fn foreign_fn() -> u8; +} // CHECK: !{i32 {{[78]}}, !"PIC Level", i32 2} // CHECK: !{i32 7, !"PIE Level", i32 2} diff --git a/tests/codegen/powerpc64le-struct-align-128.rs b/tests/codegen/powerpc64le-struct-align-128.rs index 0096c6d3138..3981cd12129 100644 --- a/tests/codegen/powerpc64le-struct-align-128.rs +++ b/tests/codegen/powerpc64le-struct-align-128.rs @@ -8,12 +8,12 @@ #![crate_type = "lib"] #![no_core] -#[lang="sized"] -trait Sized { } -#[lang="freeze"] -trait Freeze { } -#[lang="copy"] -trait Copy { } +#[lang = "sized"] +trait Sized {} +#[lang = "freeze"] +trait Freeze {} +#[lang = "copy"] +trait Copy {} #[repr(C)] pub struct Align8 { @@ -23,7 +23,7 @@ pub struct Align8 { #[repr(transparent)] pub struct Transparent8 { - a: Align8 + a: Align8, } #[repr(C)] @@ -45,7 +45,7 @@ pub struct Align16 { #[repr(transparent)] pub struct Transparent16 { - a: Align16 + a: Align16, } #[repr(C)] @@ -69,7 +69,7 @@ pub struct Align32 { #[repr(transparent)] pub struct Transparent32 { - a: Align32 + a: Align32, } #[repr(C)] @@ -83,9 +83,15 @@ pub struct Wrapped32 { } pub unsafe fn main( - a1: Align8, a2: Transparent8, a3: Wrapped8, - b1: Align16, b2: Transparent16, b3: Wrapped16, - c1: Align32, c2: Transparent32, c3: Wrapped32, + a1: Align8, + a2: Transparent8, + a3: Wrapped8, + b1: Align16, + b2: Transparent16, + b3: Wrapped16, + c1: Align32, + c2: Transparent32, + c3: Wrapped32, ) { test_8(a1, a2, a3); test_16(b1, b2, b3); diff --git a/tests/codegen/precondition-checks.rs b/tests/codegen/precondition-checks.rs index 19149445003..16812ca1720 100644 --- a/tests/codegen/precondition-checks.rs +++ b/tests/codegen/precondition-checks.rs @@ -21,7 +21,5 @@ #[no_mangle] pub unsafe fn nonnull_new(ptr: *mut u8) -> NonNull { // CHECK: ; call core::ptr::non_null::NonNull::new_unchecked - unsafe { - NonNull::new_unchecked(ptr) - } + unsafe { NonNull::new_unchecked(ptr) } } diff --git a/tests/codegen/refs.rs b/tests/codegen/refs.rs index 40ce04c07a1..97c36295085 100644 --- a/tests/codegen/refs.rs +++ b/tests/codegen/refs.rs @@ -5,17 +5,16 @@ // Hack to get the correct size for the length part in slices // CHECK: @helper([[USIZE:i[0-9]+]] %_1) #[no_mangle] -pub fn helper(_: usize) { -} +pub fn helper(_: usize) {} // CHECK-LABEL: @ref_dst #[no_mangle] pub fn ref_dst(s: &[u8]) { // We used to generate an extra alloca and memcpy to ref the dst, so check that we copy // directly to the alloca for "x" -// CHECK: store ptr %s.0, {{.*}} %x -// CHECK: [[X1:%[0-9]+]] = getelementptr inbounds i8, {{.*}} %x, {{i32 4|i64 8}} -// CHECK: store [[USIZE]] %s.1, {{.*}} [[X1]] + // CHECK: store ptr %s.0, {{.*}} %x + // CHECK: [[X1:%[0-9]+]] = getelementptr inbounds i8, {{.*}} %x, {{i32 4|i64 8}} + // CHECK: store [[USIZE]] %s.1, {{.*}} [[X1]] let x = &*s; &x; // keep variable in an alloca diff --git a/tests/codegen/repr/transparent-imm-array.rs b/tests/codegen/repr/transparent-imm-array.rs index 917a2c6ef52..1acd4742d35 100644 --- a/tests/codegen/repr/transparent-imm-array.rs +++ b/tests/codegen/repr/transparent-imm-array.rs @@ -26,15 +26,17 @@ #![no_std] #![no_core] -#[lang="sized"] trait Sized { } -#[lang="freeze"] trait Freeze { } -#[lang="copy"] trait Copy { } +#[lang = "sized"] +trait Sized {} +#[lang = "freeze"] +trait Freeze {} +#[lang = "copy"] +trait Copy {} impl Copy for [u32; 16] {} impl Copy for BigS {} impl Copy for BigU {} - #[repr(C)] pub struct BigS([u32; 16]); @@ -53,20 +55,27 @@ pub enum TeBigS { // CHECK: define void @test_BigS(ptr [[BIGS_RET_ATTRS1:.*]] sret([64 x i8]) [[BIGS_RET_ATTRS2:.*]], [16 x i32] #[no_mangle] -pub extern fn test_BigS(_: BigS) -> BigS { loop {} } +pub extern "C" fn test_BigS(_: BigS) -> BigS { + loop {} +} // CHECK: define void @test_TsBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], [16 x i32] #[no_mangle] -pub extern fn test_TsBigS(_: TsBigS) -> TsBigS { loop {} } +pub extern "C" fn test_TsBigS(_: TsBigS) -> TsBigS { + loop {} +} // CHECK: define void @test_TuBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], [16 x i32] #[no_mangle] -pub extern fn test_TuBigS(_: TuBigS) -> TuBigS { loop {} } +pub extern "C" fn test_TuBigS(_: TuBigS) -> TuBigS { + loop {} +} // CHECK: define void @test_TeBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], [16 x i32] #[no_mangle] -pub extern fn test_TeBigS(_: TeBigS) -> TeBigS { loop {} } - +pub extern "C" fn test_TeBigS(_: TeBigS) -> TeBigS { + loop {} +} #[repr(C)] pub union BigU { @@ -88,16 +97,24 @@ pub enum TeBigU { // CHECK: define void @test_BigU(ptr [[BIGU_RET_ATTRS1:.*]] sret([64 x i8]) [[BIGU_RET_ATTRS2:.*]], [16 x i32] #[no_mangle] -pub extern fn test_BigU(_: BigU) -> BigU { loop {} } +pub extern "C" fn test_BigU(_: BigU) -> BigU { + loop {} +} // CHECK: define void @test_TsBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2]], [16 x i32] #[no_mangle] -pub extern fn test_TsBigU(_: TsBigU) -> TsBigU { loop {} } +pub extern "C" fn test_TsBigU(_: TsBigU) -> TsBigU { + loop {} +} // CHECK: define void @test_TuBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2]], [16 x i32] #[no_mangle] -pub extern fn test_TuBigU(_: TuBigU) -> TuBigU { loop {} } +pub extern "C" fn test_TuBigU(_: TuBigU) -> TuBigU { + loop {} +} // CHECK: define void @test_TeBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2]], [16 x i32] #[no_mangle] -pub extern fn test_TeBigU(_: TeBigU) -> TeBigU { loop {} } +pub extern "C" fn test_TeBigU(_: TeBigU) -> TeBigU { + loop {} +} diff --git a/tests/codegen/repr/transparent-mips64.rs b/tests/codegen/repr/transparent-mips64.rs index ebed8d7989f..588d440b4d7 100644 --- a/tests/codegen/repr/transparent-mips64.rs +++ b/tests/codegen/repr/transparent-mips64.rs @@ -13,9 +13,12 @@ #![no_std] #![no_core] -#[lang="sized"] trait Sized { } -#[lang="freeze"] trait Freeze { } -#[lang="copy"] trait Copy { } +#[lang = "sized"] +trait Sized {} +#[lang = "freeze"] +trait Freeze {} +#[lang = "copy"] +trait Copy {} impl Copy for [u32; 16] {} impl Copy for BigS {} @@ -39,20 +42,27 @@ pub enum TeBigS { // CHECK: define void @test_BigS(ptr [[BIGS_RET_ATTRS1:.*]] sret([64 x i8]) [[BIGS_RET_ATTRS2:.*]], [8 x i64] #[no_mangle] -pub extern fn test_BigS(_: BigS) -> BigS { loop {} } +pub extern "C" fn test_BigS(_: BigS) -> BigS { + loop {} +} // CHECK: define void @test_TsBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], [8 x i64] #[no_mangle] -pub extern fn test_TsBigS(_: TsBigS) -> TsBigS { loop {} } +pub extern "C" fn test_TsBigS(_: TsBigS) -> TsBigS { + loop {} +} // CHECK: define void @test_TuBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], [8 x i64] #[no_mangle] -pub extern fn test_TuBigS(_: TuBigS) -> TuBigS { loop {} } +pub extern "C" fn test_TuBigS(_: TuBigS) -> TuBigS { + loop {} +} // CHECK: define void @test_TeBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], [8 x i64] #[no_mangle] -pub extern fn test_TeBigS(_: TeBigS) -> TeBigS { loop {} } - +pub extern "C" fn test_TeBigS(_: TeBigS) -> TeBigS { + loop {} +} #[repr(C)] pub union BigU { @@ -74,16 +84,24 @@ pub enum TeBigU { // CHECK: define void @test_BigU(ptr [[BIGU_RET_ATTRS1:.*]] sret([64 x i8]) [[BIGU_RET_ATTRS2:.*]], [8 x i64] #[no_mangle] -pub extern fn test_BigU(_: BigU) -> BigU { loop {} } +pub extern "C" fn test_BigU(_: BigU) -> BigU { + loop {} +} // CHECK: define void @test_TsBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2]], [8 x i64] #[no_mangle] -pub extern fn test_TsBigU(_: TsBigU) -> TsBigU { loop {} } +pub extern "C" fn test_TsBigU(_: TsBigU) -> TsBigU { + loop {} +} // CHECK: define void @test_TuBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2]], [8 x i64] #[no_mangle] -pub extern fn test_TuBigU(_: TuBigU) -> TuBigU { loop {} } +pub extern "C" fn test_TuBigU(_: TuBigU) -> TuBigU { + loop {} +} // CHECK: define void @test_TeBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2]], [8 x i64] #[no_mangle] -pub extern fn test_TeBigU(_: TeBigU) -> TeBigU { loop {} } +pub extern "C" fn test_TeBigU(_: TeBigU) -> TeBigU { + loop {} +} diff --git a/tests/codegen/repr/transparent-sparc64.rs b/tests/codegen/repr/transparent-sparc64.rs index 7005a07f554..8e4c8ce2ee9 100644 --- a/tests/codegen/repr/transparent-sparc64.rs +++ b/tests/codegen/repr/transparent-sparc64.rs @@ -8,15 +8,17 @@ #![no_std] #![no_core] -#[lang="sized"] trait Sized { } -#[lang="freeze"] trait Freeze { } -#[lang="copy"] trait Copy { } +#[lang = "sized"] +trait Sized {} +#[lang = "freeze"] +trait Freeze {} +#[lang = "copy"] +trait Copy {} impl Copy for [u32; 16] {} impl Copy for BigS {} impl Copy for BigU {} - #[repr(C)] pub struct BigS([u32; 16]); @@ -37,26 +39,33 @@ pub enum TeBigS { // CHECK-NOT: byval // CHECK-SAME: %{{[0-9a-z_]+}}) #[no_mangle] -pub extern "C" fn test_BigS(_: BigS) -> BigS { loop {} } +pub extern "C" fn test_BigS(_: BigS) -> BigS { + loop {} +} // CHECK: define{{.*}}void @test_TsBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], ptr // CHECK-NOT: byval // CHECK-SAME: %{{[0-9a-z_]+}}) #[no_mangle] -pub extern "C" fn test_TsBigS(_: TsBigS) -> TsBigS { loop {} } +pub extern "C" fn test_TsBigS(_: TsBigS) -> TsBigS { + loop {} +} // CHECK: define{{.*}}void @test_TuBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], ptr // CHECK-NOT: byval // CHECK-SAME: %{{[0-9a-z_]+}}) #[no_mangle] -pub extern "C" fn test_TuBigS(_: TuBigS) -> TuBigS { loop {} } +pub extern "C" fn test_TuBigS(_: TuBigS) -> TuBigS { + loop {} +} // CHECK: define{{.*}}void @test_TeBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], ptr // CHECK-NOT: byval // CHECK-SAME: %{{[0-9a-z_]+}}) #[no_mangle] -pub extern "C" fn test_TeBigS(_: TeBigS) -> TeBigS { loop {} } - +pub extern "C" fn test_TeBigS(_: TeBigS) -> TeBigS { + loop {} +} #[repr(C)] pub union BigU { @@ -80,22 +89,30 @@ pub enum TeBigU { // CHECK-NOT: byval // CHECK-SAME: %{{[0-9a-z_]+}}) #[no_mangle] -pub extern "C" fn test_BigU(_: BigU) -> BigU { loop {} } +pub extern "C" fn test_BigU(_: BigU) -> BigU { + loop {} +} // CHECK: define{{.*}}void @test_TsBigU(ptr [[BIGU_RET_ATTRS1:.*]] sret([64 x i8]) [[BIGU_RET_ATTRS2:.*]], ptr // CHECK-NOT: byval // CHECK-SAME: %{{[0-9a-z_]+}}) #[no_mangle] -pub extern "C" fn test_TsBigU(_: TsBigU) -> TsBigU { loop {} } +pub extern "C" fn test_TsBigU(_: TsBigU) -> TsBigU { + loop {} +} // CHECK: define{{.*}}void @test_TuBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2:.*]], ptr // CHECK-NOT: byval // CHECK-SAME: %{{[0-9a-z_]+}}) #[no_mangle] -pub extern "C" fn test_TuBigU(_: TuBigU) -> TuBigU { loop {} } +pub extern "C" fn test_TuBigU(_: TuBigU) -> TuBigU { + loop {} +} // CHECK: define{{.*}}void @test_TeBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2:.*]], ptr // CHECK-NOT: byval // CHECK-SAME: %{{[0-9a-z_]+}}) #[no_mangle] -pub extern "C" fn test_TeBigU(_: TeBigU) -> TeBigU { loop {} } +pub extern "C" fn test_TeBigU(_: TeBigU) -> TeBigU { + loop {} +} diff --git a/tests/codegen/repr/transparent-struct-ptr.rs b/tests/codegen/repr/transparent-struct-ptr.rs index 26f0120752f..9cffd6c7f73 100644 --- a/tests/codegen/repr/transparent-struct-ptr.rs +++ b/tests/codegen/repr/transparent-struct-ptr.rs @@ -22,15 +22,17 @@ #![no_std] #![no_core] -#[lang="sized"] trait Sized { } -#[lang="freeze"] trait Freeze { } -#[lang="copy"] trait Copy { } +#[lang = "sized"] +trait Sized {} +#[lang = "freeze"] +trait Freeze {} +#[lang = "copy"] +trait Copy {} impl Copy for [u32; 16] {} impl Copy for BigS {} impl Copy for BigU {} - #[repr(C)] pub struct BigS([u32; 16]); @@ -49,20 +51,27 @@ pub enum TeBigS { // CHECK: define{{.*}}void @test_BigS(ptr [[BIGS_RET_ATTRS1:.*]] sret([64 x i8]) [[BIGS_RET_ATTRS2:.*]], ptr [[BIGS_ARG_ATTRS1:.*]] byval([64 x i8]) [[BIGS_ARG_ATTRS2:.*]]) #[no_mangle] -pub extern "C" fn test_BigS(_: BigS) -> BigS { loop {} } +pub extern "C" fn test_BigS(_: BigS) -> BigS { + loop {} +} // CHECK: define{{.*}}void @test_TsBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], ptr [[BIGS_ARG_ATTRS1]] byval([64 x i8]) [[BIGS_ARG_ATTRS2:.*]]) #[no_mangle] -pub extern "C" fn test_TsBigS(_: TsBigS) -> TsBigS { loop {} } +pub extern "C" fn test_TsBigS(_: TsBigS) -> TsBigS { + loop {} +} // CHECK: define{{.*}}void @test_TuBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], ptr [[BIGS_ARG_ATTRS1]] byval([64 x i8]) [[BIGS_ARG_ATTRS2:.*]]) #[no_mangle] -pub extern "C" fn test_TuBigS(_: TuBigS) -> TuBigS { loop {} } +pub extern "C" fn test_TuBigS(_: TuBigS) -> TuBigS { + loop {} +} // CHECK: define{{.*}}void @test_TeBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], ptr [[BIGS_ARG_ATTRS1]] byval([64 x i8]) [[BIGS_ARG_ATTRS2]]) #[no_mangle] -pub extern "C" fn test_TeBigS(_: TeBigS) -> TeBigS { loop {} } - +pub extern "C" fn test_TeBigS(_: TeBigS) -> TeBigS { + loop {} +} #[repr(C)] pub union BigU { @@ -84,16 +93,24 @@ pub enum TeBigU { // CHECK: define{{.*}}void @test_BigU(ptr [[BIGU_RET_ATTRS1:.*]] sret([64 x i8]) [[BIGU_RET_ATTRS2:.*]], ptr [[BIGU_ARG_ATTRS1:.*]] byval([64 x i8]) [[BIGU_ARG_ATTRS2:.*]]) #[no_mangle] -pub extern "C" fn test_BigU(_: BigU) -> BigU { loop {} } +pub extern "C" fn test_BigU(_: BigU) -> BigU { + loop {} +} // CHECK: define{{.*}}void @test_TsBigU(ptr [[BIGU_RET_ATTRS1:.*]] sret([64 x i8]) [[BIGU_RET_ATTRS2:.*]], ptr [[BIGU_ARG_ATTRS1]] byval([64 x i8]) [[BIGU_ARG_ATTRS2]]) #[no_mangle] -pub extern "C" fn test_TsBigU(_: TsBigU) -> TsBigU { loop {} } +pub extern "C" fn test_TsBigU(_: TsBigU) -> TsBigU { + loop {} +} // CHECK: define{{.*}}void @test_TuBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2:.*]], ptr [[BIGU_ARG_ATTRS1]] byval([64 x i8]) [[BIGU_ARG_ATTRS2]]) #[no_mangle] -pub extern "C" fn test_TuBigU(_: TuBigU) -> TuBigU { loop {} } +pub extern "C" fn test_TuBigU(_: TuBigU) -> TuBigU { + loop {} +} // CHECK: define{{.*}}void @test_TeBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2:.*]], ptr [[BIGU_ARG_ATTRS1]] byval([64 x i8]) [[BIGU_ARG_ATTRS2]]) #[no_mangle] -pub extern "C" fn test_TeBigU(_: TeBigU) -> TeBigU { loop {} } +pub extern "C" fn test_TeBigU(_: TeBigU) -> TeBigU { + loop {} +} diff --git a/tests/codegen/repr/transparent-sysv64.rs b/tests/codegen/repr/transparent-sysv64.rs index 1c7bca7ee40..afb06dcc1bd 100644 --- a/tests/codegen/repr/transparent-sysv64.rs +++ b/tests/codegen/repr/transparent-sysv64.rs @@ -13,19 +13,28 @@ #![no_std] #![no_core] -#[lang="sized"] trait Sized { } -#[lang="freeze"] trait Freeze { } -#[lang="copy"] trait Copy { } +#[lang = "sized"] +trait Sized {} +#[lang = "freeze"] +trait Freeze {} +#[lang = "copy"] +trait Copy {} #[repr(C)] -pub struct Rgb8 { r: u8, g: u8, b: u8 } +pub struct Rgb8 { + r: u8, + g: u8, + b: u8, +} #[repr(transparent)] pub struct Rgb8Wrap(Rgb8); // CHECK: i24 @test_Rgb8Wrap(i24{{( %0)?}}) #[no_mangle] -pub extern "sysv64" fn test_Rgb8Wrap(_: Rgb8Wrap) -> Rgb8Wrap { loop {} } +pub extern "sysv64" fn test_Rgb8Wrap(_: Rgb8Wrap) -> Rgb8Wrap { + loop {} +} #[repr(C)] pub union FloatBits { @@ -38,4 +47,6 @@ pub union FloatBits { // CHECK: i32 @test_SmallUnion(i32{{( %0)?}}) #[no_mangle] -pub extern "sysv64" fn test_SmallUnion(_: SmallUnion) -> SmallUnion { loop {} } +pub extern "sysv64" fn test_SmallUnion(_: SmallUnion) -> SmallUnion { + loop {} +} diff --git a/tests/codegen/repr/transparent.rs b/tests/codegen/repr/transparent.rs index 17ec476035f..4b41332db45 100644 --- a/tests/codegen/repr/transparent.rs +++ b/tests/codegen/repr/transparent.rs @@ -8,7 +8,7 @@ // For RISCV: see codegen/riscv-abi // For LoongArch: see codegen/loongarch-abi -#![crate_type="lib"] +#![crate_type = "lib"] #![feature(repr_simd, transparent_unions)] use std::marker::PhantomData; @@ -24,83 +24,112 @@ // CHECK: define{{.*}}float @test_F32(float noundef %_1) #[no_mangle] -pub extern "C" fn test_F32(_: F32) -> F32 { loop {} } +pub extern "C" fn test_F32(_: F32) -> F32 { + loop {} +} #[repr(transparent)] pub struct Ptr(*mut u8); // CHECK: define{{.*}}ptr @test_Ptr(ptr noundef %_1) #[no_mangle] -pub extern "C" fn test_Ptr(_: Ptr) -> Ptr { loop {} } +pub extern "C" fn test_Ptr(_: Ptr) -> Ptr { + loop {} +} #[repr(transparent)] pub struct WithZst(u64, Zst1); // CHECK: define{{.*}}i64 @test_WithZst(i64 noundef %_1) #[no_mangle] -pub extern "C" fn test_WithZst(_: WithZst) -> WithZst { loop {} } +pub extern "C" fn test_WithZst(_: WithZst) -> WithZst { + loop {} +} #[repr(transparent)] pub struct WithZeroSizedArray(*const f32, [i8; 0]); // CHECK: define{{.*}}ptr @test_WithZeroSizedArray(ptr noundef %_1) #[no_mangle] -pub extern "C" fn test_WithZeroSizedArray(_: WithZeroSizedArray) -> WithZeroSizedArray { loop {} } +pub extern "C" fn test_WithZeroSizedArray(_: WithZeroSizedArray) -> WithZeroSizedArray { + loop {} +} #[repr(transparent)] pub struct Generic(T); // CHECK: define{{.*}}double @test_Generic(double noundef %_1) #[no_mangle] -pub extern "C" fn test_Generic(_: Generic) -> Generic { loop {} } +pub extern "C" fn test_Generic(_: Generic) -> Generic { + loop {} +} #[repr(transparent)] pub struct GenericPlusZst(T, Zst2); #[repr(u8)] -pub enum Bool { True, False, FileNotFound } +pub enum Bool { + True, + False, + FileNotFound, +} // CHECK: define{{( dso_local)?}} noundef{{( zeroext)?}} i8 @test_Gpz(i8 noundef{{( zeroext)?}} %_1) #[no_mangle] -pub extern "C" fn test_Gpz(_: GenericPlusZst) -> GenericPlusZst { loop {} } +pub extern "C" fn test_Gpz(_: GenericPlusZst) -> GenericPlusZst { + loop {} +} #[repr(transparent)] pub struct LifetimePhantom<'a, T: 'a>(*const T, PhantomData<&'a T>); // CHECK: define{{.*}}ptr @test_LifetimePhantom(ptr noundef %_1) #[no_mangle] -pub extern "C" fn test_LifetimePhantom(_: LifetimePhantom) -> LifetimePhantom { loop {} } +pub extern "C" fn test_LifetimePhantom(_: LifetimePhantom) -> LifetimePhantom { + loop {} +} // This works despite current alignment resrictions because PhantomData is always align(1) #[repr(transparent)] -pub struct UnitPhantom { val: T, unit: PhantomData } +pub struct UnitPhantom { + val: T, + unit: PhantomData, +} pub struct Px; // CHECK: define{{.*}}float @test_UnitPhantom(float noundef %_1) #[no_mangle] -pub extern "C" fn test_UnitPhantom(_: UnitPhantom) -> UnitPhantom { loop {} } +pub extern "C" fn test_UnitPhantom(_: UnitPhantom) -> UnitPhantom { + loop {} +} #[repr(transparent)] pub struct TwoZsts(Zst1, i8, Zst2); // CHECK: define{{( dso_local)?}} noundef{{( signext)?}} i8 @test_TwoZsts(i8 noundef{{( signext)?}} %_1) #[no_mangle] -pub extern "C" fn test_TwoZsts(_: TwoZsts) -> TwoZsts { loop {} } +pub extern "C" fn test_TwoZsts(_: TwoZsts) -> TwoZsts { + loop {} +} #[repr(transparent)] pub struct Nested1(Zst2, Generic); // CHECK: define{{.*}}double @test_Nested1(double noundef %_1) #[no_mangle] -pub extern "C" fn test_Nested1(_: Nested1) -> Nested1 { loop {} } +pub extern "C" fn test_Nested1(_: Nested1) -> Nested1 { + loop {} +} #[repr(transparent)] pub struct Nested2(Nested1, Zst1); // CHECK: define{{.*}}double @test_Nested2(double noundef %_1) #[no_mangle] -pub extern "C" fn test_Nested2(_: Nested2) -> Nested2 { loop {} } +pub extern "C" fn test_Nested2(_: Nested2) -> Nested2 { + loop {} +} #[repr(simd)] struct f32x4(f32, f32, f32, f32); @@ -110,35 +139,47 @@ pub extern "C" fn test_Nested2(_: Nested2) -> Nested2 { loop {} } // CHECK: define{{.*}}<4 x float> @test_Vector(<4 x float> %_1) #[no_mangle] -pub extern "C" fn test_Vector(_: Vector) -> Vector { loop {} } +pub extern "C" fn test_Vector(_: Vector) -> Vector { + loop {} +} -trait Mirror { type It: ?Sized; } -impl Mirror for T { type It = Self; } +trait Mirror { + type It: ?Sized; +} +impl Mirror for T { + type It = Self; +} #[repr(transparent)] pub struct StructWithProjection(::It); // CHECK: define{{.*}}float @test_Projection(float noundef %_1) #[no_mangle] -pub extern "C" fn test_Projection(_: StructWithProjection) -> StructWithProjection { loop {} } +pub extern "C" fn test_Projection(_: StructWithProjection) -> StructWithProjection { + loop {} +} #[repr(transparent)] pub enum EnumF32 { - Variant(F32) + Variant(F32), } // CHECK: define{{.*}}float @test_EnumF32(float noundef %_1) #[no_mangle] -pub extern "C" fn test_EnumF32(_: EnumF32) -> EnumF32 { loop {} } +pub extern "C" fn test_EnumF32(_: EnumF32) -> EnumF32 { + loop {} +} #[repr(transparent)] pub enum EnumF32WithZsts { - Variant(Zst1, F32, Zst2) + Variant(Zst1, F32, Zst2), } // CHECK: define{{.*}}float @test_EnumF32WithZsts(float noundef %_1) #[no_mangle] -pub extern "C" fn test_EnumF32WithZsts(_: EnumF32WithZsts) -> EnumF32WithZsts { loop {} } +pub extern "C" fn test_EnumF32WithZsts(_: EnumF32WithZsts) -> EnumF32WithZsts { + loop {} +} #[repr(transparent)] pub union UnionF32 { @@ -147,7 +188,9 @@ pub union UnionF32 { // CHECK: define{{.*}} float @test_UnionF32(float %_1) #[no_mangle] -pub extern "C" fn test_UnionF32(_: UnionF32) -> UnionF32 { loop {} } +pub extern "C" fn test_UnionF32(_: UnionF32) -> UnionF32 { + loop {} +} #[repr(transparent)] pub union UnionF32WithZsts { @@ -158,8 +201,9 @@ pub union UnionF32WithZsts { // CHECK: define{{.*}}float @test_UnionF32WithZsts(float %_1) #[no_mangle] -pub extern "C" fn test_UnionF32WithZsts(_: UnionF32WithZsts) -> UnionF32WithZsts { loop {} } - +pub extern "C" fn test_UnionF32WithZsts(_: UnionF32WithZsts) -> UnionF32WithZsts { + loop {} +} // All that remains to be tested are aggregates. They are tested in separate files called // transparent-*.rs with `only-*` or `ignore-*` directives, because the expected LLVM IR diff --git a/tests/codegen/riscv-abi/riscv64-lp64-lp64f-lp64d-abi.rs b/tests/codegen/riscv-abi/riscv64-lp64-lp64f-lp64d-abi.rs index 95c936ece73..977749ad578 100644 --- a/tests/codegen/riscv-abi/riscv64-lp64-lp64f-lp64d-abi.rs +++ b/tests/codegen/riscv-abi/riscv64-lp64-lp64f-lp64d-abi.rs @@ -83,8 +83,7 @@ pub struct Tiny { // CHECK: define void @f_agg_tiny(i64 %0) #[no_mangle] -pub extern "C" fn f_agg_tiny(mut e: Tiny) { -} +pub extern "C" fn f_agg_tiny(mut e: Tiny) {} // CHECK: define i64 @f_agg_tiny_ret() #[no_mangle] @@ -100,8 +99,7 @@ pub struct Small { // CHECK: define void @f_agg_small([2 x i64] %0) #[no_mangle] -pub extern "C" fn f_agg_small(mut x: Small) { -} +pub extern "C" fn f_agg_small(mut x: Small) {} // CHECK: define [2 x i64] @f_agg_small_ret() #[no_mangle] @@ -116,8 +114,7 @@ pub struct SmallAligned { // CHECK: define void @f_agg_small_aligned(i128 %0) #[no_mangle] -pub extern "C" fn f_agg_small_aligned(mut x: SmallAligned) { -} +pub extern "C" fn f_agg_small_aligned(mut x: SmallAligned) {} #[repr(C)] pub struct Large { @@ -129,8 +126,7 @@ pub struct Large { // CHECK: define void @f_agg_large(ptr {{.*}}%x) #[no_mangle] -pub extern "C" fn f_agg_large(mut x: Large) { -} +pub extern "C" fn f_agg_large(mut x: Large) {} // CHECK: define void @f_agg_large_ret(ptr {{.*}}sret{{.*}}, i32 noundef signext %i, i8 noundef signext %j) #[no_mangle] diff --git a/tests/codegen/sanitizer/address-sanitizer-globals-tracking.rs b/tests/codegen/sanitizer/address-sanitizer-globals-tracking.rs index 8ffa235c18f..f319306f93f 100644 --- a/tests/codegen/sanitizer/address-sanitizer-globals-tracking.rs +++ b/tests/codegen/sanitizer/address-sanitizer-globals-tracking.rs @@ -23,7 +23,7 @@ //@[ASAN] compile-flags: //@[ASAN-FAT-LTO] compile-flags: -Cprefer-dynamic=false -Clto=fat -#![crate_type="staticlib"] +#![crate_type = "staticlib"] // The test below mimics `CACHED_POW10` from `library/core/src/num/flt2dec/strategy/grisu.rs` which // (because of incorrect handling of `___asan_globals_registered` during LTO) was incorrectly diff --git a/tests/codegen/sanitizer/cfi/add-canonical-jump-tables-flag.rs b/tests/codegen/sanitizer/cfi/add-canonical-jump-tables-flag.rs index f122fbdc086..22577e2a3c4 100644 --- a/tests/codegen/sanitizer/cfi/add-canonical-jump-tables-flag.rs +++ b/tests/codegen/sanitizer/cfi/add-canonical-jump-tables-flag.rs @@ -3,9 +3,8 @@ //@ needs-sanitizer-cfi //@ compile-flags: -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi -#![crate_type="lib"] +#![crate_type = "lib"] -pub fn foo() { -} +pub fn foo() {} // CHECK: !{{[0-9]+}} = !{i32 4, !"CFI Canonical Jump Tables", i32 1} diff --git a/tests/codegen/sanitizer/cfi/add-enable-split-lto-unit-flag.rs b/tests/codegen/sanitizer/cfi/add-enable-split-lto-unit-flag.rs index 05eea13c6ee..283b8f26102 100644 --- a/tests/codegen/sanitizer/cfi/add-enable-split-lto-unit-flag.rs +++ b/tests/codegen/sanitizer/cfi/add-enable-split-lto-unit-flag.rs @@ -3,9 +3,8 @@ //@ needs-sanitizer-cfi //@ compile-flags: -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi -#![crate_type="lib"] +#![crate_type = "lib"] -pub fn foo() { -} +pub fn foo() {} // CHECK: !{{[0-9]+}} = !{i32 4, !"EnableSplitLTOUnit", i32 1} diff --git a/tests/codegen/sanitizer/cfi/emit-type-checks-attr-no-sanitize.rs b/tests/codegen/sanitizer/cfi/emit-type-checks-attr-no-sanitize.rs index 9f72de2ebcc..259967e8918 100644 --- a/tests/codegen/sanitizer/cfi/emit-type-checks-attr-no-sanitize.rs +++ b/tests/codegen/sanitizer/cfi/emit-type-checks-attr-no-sanitize.rs @@ -3,7 +3,7 @@ //@ needs-sanitizer-cfi //@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0 -#![crate_type="lib"] +#![crate_type = "lib"] #![feature(no_sanitize)] #[no_sanitize(cfi)] diff --git a/tests/codegen/sanitizer/cfi/emit-type-checks.rs b/tests/codegen/sanitizer/cfi/emit-type-checks.rs index 6ec6f0e5476..37edbefee56 100644 --- a/tests/codegen/sanitizer/cfi/emit-type-checks.rs +++ b/tests/codegen/sanitizer/cfi/emit-type-checks.rs @@ -3,7 +3,7 @@ //@ needs-sanitizer-cfi //@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0 -#![crate_type="lib"] +#![crate_type = "lib"] pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { // CHECK-LABEL: define{{.*}}foo{{.*}}!type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-attr-cfi-encoding.rs b/tests/codegen/sanitizer/cfi/emit-type-metadata-attr-cfi-encoding.rs index be4af9b7962..9bc2e42db0f 100644 --- a/tests/codegen/sanitizer/cfi/emit-type-metadata-attr-cfi-encoding.rs +++ b/tests/codegen/sanitizer/cfi/emit-type-metadata-attr-cfi-encoding.rs @@ -3,13 +3,13 @@ //@ needs-sanitizer-cfi //@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0 -#![crate_type="lib"] +#![crate_type = "lib"] #![feature(cfi_encoding, extern_types)] #[cfi_encoding = "3Foo"] pub struct Type1(i32); -extern { +extern "C" { #[cfi_encoding = "3Bar"] type Type2; } @@ -25,35 +25,35 @@ #[repr(transparent)] pub struct Type5(u32); -pub fn foo0(_: Type1) { } +pub fn foo0(_: Type1) {} // CHECK: define{{.*}}foo0{{.*}}!type ![[TYPE0:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo1(_: Type1, _: Type1) { } +pub fn foo1(_: Type1, _: Type1) {} // CHECK: define{{.*}}foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo2(_: Type1, _: Type1, _: Type1) { } +pub fn foo2(_: Type1, _: Type1, _: Type1) {} // CHECK: define{{.*}}foo2{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo3(_: *mut Type2) { } +pub fn foo3(_: *mut Type2) {} // CHECK: define{{.*}}foo3{{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo4(_: *mut Type2, _: *mut Type2) { } +pub fn foo4(_: *mut Type2, _: *mut Type2) {} // CHECK: define{{.*}}foo4{{.*}}!type ![[TYPE4:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo5(_: *mut Type2, _: *mut Type2, _: *mut Type2) { } +pub fn foo5(_: *mut Type2, _: *mut Type2, _: *mut Type2) {} // CHECK: define{{.*}}foo5{{.*}}!type ![[TYPE5:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo6(_: *mut Type3) { } +pub fn foo6(_: *mut Type3) {} // CHECK: define{{.*}}foo6{{.*}}!type ![[TYPE6:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo7(_: *mut Type3, _: *mut Type3) { } +pub fn foo7(_: *mut Type3, _: *mut Type3) {} // CHECK: define{{.*}}foo7{{.*}}!type ![[TYPE7:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo8(_: *mut Type3, _: *mut Type3, _: *mut Type3) { } +pub fn foo8(_: *mut Type3, _: *mut Type3, _: *mut Type3) {} // CHECK: define{{.*}}foo8{{.*}}!type ![[TYPE8:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo9(_: Type4) { } +pub fn foo9(_: Type4) {} // CHECK: define{{.*}}foo9{{.*}}!type ![[TYPE9:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo10(_: Type4, _: Type4) { } +pub fn foo10(_: Type4, _: Type4) {} // CHECK: define{{.*}}foo10{{.*}}!type ![[TYPE10:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo11(_: Type4, _: Type4, _: Type4) { } +pub fn foo11(_: Type4, _: Type4, _: Type4) {} // CHECK: define{{.*}}foo11{{.*}}!type ![[TYPE11:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo12(_: Type5) { } +pub fn foo12(_: Type5) {} // CHECK: define{{.*}}foo12{{.*}}!type ![[TYPE12:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo13(_: Type5, _: Type5) { } +pub fn foo13(_: Type5, _: Type5) {} // CHECK: define{{.*}}foo13{{.*}}!type ![[TYPE13:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo14(_: Type5, _: Type5, _: Type5) { } +pub fn foo14(_: Type5, _: Type5, _: Type5) {} // CHECK: define{{.*}}foo14{{.*}}!type ![[TYPE14:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} // CHECK: ![[TYPE0]] = !{i64 0, !"_ZTSFv3FooE"} diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-const-generics.rs b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-const-generics.rs index 6608caca8af..25dba97962a 100644 --- a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-const-generics.rs +++ b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-const-generics.rs @@ -4,25 +4,26 @@ //@ needs-sanitizer-cfi //@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0 -#![crate_type="lib"] +#![crate_type = "lib"] #![feature(type_alias_impl_trait)] extern crate core; pub type Type1 = impl Send; -pub fn foo() where +pub fn foo() +where Type1: 'static, { pub struct Foo([T; N]); let _: Type1 = Foo([0; 32]); } -pub fn foo1(_: Type1) { } +pub fn foo1(_: Type1) {} // CHECK: define{{.*}}4foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo2(_: Type1, _: Type1) { } +pub fn foo2(_: Type1, _: Type1) {} // CHECK: define{{.*}}4foo2{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo3(_: Type1, _: Type1, _: Type1) { } +pub fn foo3(_: Type1, _: Type1, _: Type1) {} // CHECK: define{{.*}}4foo3{{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} // CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo3FooIu3i32Lu5usize32EEE"} diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-drop-in-place.rs b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-drop-in-place.rs index 3ec1988edd6..2a7eca6fc19 100644 --- a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-drop-in-place.rs +++ b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-drop-in-place.rs @@ -3,7 +3,7 @@ //@ needs-sanitizer-cfi //@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -#![crate_type="lib"] +#![crate_type = "lib"] // CHECK-LABEL: define{{.*}}4core3ptr47drop_in_place$LT$dyn$u20$core..marker..Send$GT$ // CHECK-SAME: {{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-function-types.rs b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-function-types.rs index c5dadf70de9..7e60aafff68 100644 --- a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-function-types.rs +++ b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-function-types.rs @@ -4,29 +4,29 @@ //@ needs-sanitizer-cfi //@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -#![crate_type="lib"] +#![crate_type = "lib"] -pub fn foo1(_: fn(i32) -> i32) { } +pub fn foo1(_: fn(i32) -> i32) {} // CHECK: define{{.*}}4foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo2(_: fn(i32) -> i32, _: fn(i32) -> i32) { } +pub fn foo2(_: fn(i32) -> i32, _: fn(i32) -> i32) {} // CHECK: define{{.*}}4foo2{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo3(_: fn(i32) -> i32, _: fn(i32) -> i32, _: fn(i32) -> i32) { } +pub fn foo3(_: fn(i32) -> i32, _: fn(i32) -> i32, _: fn(i32) -> i32) {} // CHECK: define{{.*}}4foo3{{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo4(_: &dyn Fn(i32) -> i32) { } +pub fn foo4(_: &dyn Fn(i32) -> i32) {} // CHECK: define{{.*}}4foo4{{.*}}!type ![[TYPE4:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo5(_: &dyn Fn(i32) -> i32, _: &dyn Fn(i32) -> i32) { } +pub fn foo5(_: &dyn Fn(i32) -> i32, _: &dyn Fn(i32) -> i32) {} // CHECK: define{{.*}}4foo5{{.*}}!type ![[TYPE5:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo6(_: &dyn Fn(i32) -> i32, _: &dyn Fn(i32) -> i32, _: &dyn Fn(i32) -> i32) { } +pub fn foo6(_: &dyn Fn(i32) -> i32, _: &dyn Fn(i32) -> i32, _: &dyn Fn(i32) -> i32) {} // CHECK: define{{.*}}4foo6{{.*}}!type ![[TYPE6:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo7(_: &dyn FnMut(i32) -> i32) { } +pub fn foo7(_: &dyn FnMut(i32) -> i32) {} // CHECK: define{{.*}}4foo7{{.*}}!type ![[TYPE7:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo8(_: &dyn FnMut(i32) -> i32, _: &dyn FnMut(i32) -> i32) { } +pub fn foo8(_: &dyn FnMut(i32) -> i32, _: &dyn FnMut(i32) -> i32) {} // CHECK: define{{.*}}4foo8{{.*}}!type ![[TYPE8:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo9(_: &dyn FnMut(i32) -> i32, _: &dyn FnMut(i32) -> i32, _: &dyn FnMut(i32) -> i32) { } +pub fn foo9(_: &dyn FnMut(i32) -> i32, _: &dyn FnMut(i32) -> i32, _: &dyn FnMut(i32) -> i32) {} // CHECK: define{{.*}}4foo9{{.*}}!type ![[TYPE9:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo10(_: &dyn FnOnce(i32) -> i32) { } +pub fn foo10(_: &dyn FnOnce(i32) -> i32) {} // CHECK: define{{.*}}5foo10{{.*}}!type ![[TYPE10:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo11(_: &dyn FnOnce(i32) -> i32, _: &dyn FnOnce(i32) -> i32) { } +pub fn foo11(_: &dyn FnOnce(i32) -> i32, _: &dyn FnOnce(i32) -> i32) {} // CHECK: define{{.*}}5foo11{{.*}}!type ![[TYPE11:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo12(_: &dyn FnOnce(i32) -> i32, _: &dyn FnOnce(i32) -> i32, _: &dyn FnOnce(i32) -> i32) {} // CHECK: define{{.*}}5foo12{{.*}}!type ![[TYPE12:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-lifetimes.rs b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-lifetimes.rs index 4d08c0c3039..3ef119fd905 100644 --- a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-lifetimes.rs +++ b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-lifetimes.rs @@ -4,14 +4,15 @@ //@ needs-sanitizer-cfi //@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0 -#![crate_type="lib"] +#![crate_type = "lib"] #![feature(type_alias_impl_trait)] extern crate core; pub type Type1 = impl Send; -pub fn foo<'a>() where +pub fn foo<'a>() +where Type1: 'static, { pub struct Foo<'a>(&'a i32); @@ -19,9 +20,9 @@ pub fn foo<'a>() where let _: Type1 = Bar; } -pub fn foo1(_: Type1) { } +pub fn foo1(_: Type1) {} // CHECK: define{{.*}}4foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo2(_: Type1, _: Type1) { } +pub fn foo2(_: Type1, _: Type1) {} // CHECK: define{{.*}}4foo2{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo3(_: Type1, _: Type1, _: Type1) { } +pub fn foo3(_: Type1, _: Type1, _: Type1) {} // CHECK: define{{.*}}4foo3{{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-method-secondary-typeid.rs b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-method-secondary-typeid.rs index 671db563dde..9d611777ff0 100644 --- a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-method-secondary-typeid.rs +++ b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-method-secondary-typeid.rs @@ -4,7 +4,7 @@ //@ needs-sanitizer-cfi //@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -#![crate_type="lib"] +#![crate_type = "lib"] trait Trait1 { fn foo(&self); @@ -17,6 +17,5 @@ fn foo(&self) {} // CHECK: define{{.*}}3foo{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} } - // CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}6Trait1u6regionEEE"} // CHECK: ![[TYPE2]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}5Type1EE"} diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-pointer-types.rs b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-pointer-types.rs index 6ad6f3ac348..d37bb740f55 100644 --- a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-pointer-types.rs +++ b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-pointer-types.rs @@ -4,37 +4,37 @@ //@ needs-sanitizer-cfi //@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -#![crate_type="lib"] +#![crate_type = "lib"] -pub fn foo1(_: &mut i32) { } +pub fn foo1(_: &mut i32) {} // CHECK: define{{.*}}4foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo2(_: &mut i32, _: &i32) { } +pub fn foo2(_: &mut i32, _: &i32) {} // CHECK: define{{.*}}4foo2{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo3(_: &mut i32, _: &i32, _: &i32) { } +pub fn foo3(_: &mut i32, _: &i32, _: &i32) {} // CHECK: define{{.*}}4foo3{{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo4(_: &i32) { } +pub fn foo4(_: &i32) {} // CHECK: define{{.*}}4foo4{{.*}}!type ![[TYPE4:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo5(_: &i32, _: &mut i32) { } +pub fn foo5(_: &i32, _: &mut i32) {} // CHECK: define{{.*}}4foo5{{.*}}!type ![[TYPE5:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo6(_: &i32, _: &mut i32, _: &mut i32) { } +pub fn foo6(_: &i32, _: &mut i32, _: &mut i32) {} // CHECK: define{{.*}}4foo6{{.*}}!type ![[TYPE6:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo7(_: *mut i32) { } +pub fn foo7(_: *mut i32) {} // CHECK: define{{.*}}4foo7{{.*}}!type ![[TYPE7:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo8(_: *mut i32, _: *const i32) { } +pub fn foo8(_: *mut i32, _: *const i32) {} // CHECK: define{{.*}}4foo8{{.*}}!type ![[TYPE8:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo9(_: *mut i32, _: *const i32, _: *const i32) { } +pub fn foo9(_: *mut i32, _: *const i32, _: *const i32) {} // CHECK: define{{.*}}4foo9{{.*}}!type ![[TYPE9:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo10(_: *const i32) { } +pub fn foo10(_: *const i32) {} // CHECK: define{{.*}}5foo10{{.*}}!type ![[TYPE10:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo11(_: *const i32, _: *mut i32) { } +pub fn foo11(_: *const i32, _: *mut i32) {} // CHECK: define{{.*}}5foo11{{.*}}!type ![[TYPE11:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo12(_: *const i32, _: *mut i32, _: *mut i32) { } +pub fn foo12(_: *const i32, _: *mut i32, _: *mut i32) {} // CHECK: define{{.*}}5foo12{{.*}}!type ![[TYPE12:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo13(_: fn(i32) -> i32) { } +pub fn foo13(_: fn(i32) -> i32) {} // CHECK: define{{.*}}5foo13{{.*}}!type ![[TYPE13:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo14(_: fn(i32) -> i32, _: fn(i32) -> i32) { } +pub fn foo14(_: fn(i32) -> i32, _: fn(i32) -> i32) {} // CHECK: define{{.*}}5foo14{{.*}}!type ![[TYPE14:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo15(_: fn(i32) -> i32, _: fn(i32) -> i32, _: fn(i32) -> i32) { } +pub fn foo15(_: fn(i32) -> i32, _: fn(i32) -> i32, _: fn(i32) -> i32) {} // CHECK: define{{.*}}5foo15{{.*}}!type ![[TYPE15:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} // CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFvU3mutu3refIu3i32EE"} diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-primitive-types.rs b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-primitive-types.rs index 38f507856bd..7d9e4d05872 100644 --- a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-primitive-types.rs +++ b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-primitive-types.rs @@ -4,130 +4,130 @@ //@ needs-sanitizer-cfi //@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -#![crate_type="lib"] +#![crate_type = "lib"] extern crate core; use core::ffi::*; -pub fn foo1(_: ()) { } +pub fn foo1(_: ()) {} // CHECK: define{{.*}}4foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo2(_: (), _: c_void) { } +pub fn foo2(_: (), _: c_void) {} // CHECK: define{{.*}}4foo2{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo3(_: (), _: c_void, _: c_void) { } +pub fn foo3(_: (), _: c_void, _: c_void) {} // CHECK: define{{.*}}4foo3{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo4(_: *mut ()) { } +pub fn foo4(_: *mut ()) {} // CHECK: define{{.*}}4foo4{{.*}}!type ![[TYPE4:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo5(_: *mut (), _: *mut c_void) { } +pub fn foo5(_: *mut (), _: *mut c_void) {} // CHECK: define{{.*}}4foo5{{.*}}!type ![[TYPE5:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo6(_: *mut (), _: *mut c_void, _: *mut c_void) { } +pub fn foo6(_: *mut (), _: *mut c_void, _: *mut c_void) {} // CHECK: define{{.*}}4foo6{{.*}}!type ![[TYPE6:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo7(_: *const ()) { } +pub fn foo7(_: *const ()) {} // CHECK: define{{.*}}4foo7{{.*}}!type ![[TYPE7:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo8(_: *const (), _: *const c_void) { } +pub fn foo8(_: *const (), _: *const c_void) {} // CHECK: define{{.*}}4foo8{{.*}}!type ![[TYPE8:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo9(_: *const (), _: *const c_void, _: *const c_void) { } +pub fn foo9(_: *const (), _: *const c_void, _: *const c_void) {} // CHECK: define{{.*}}4foo9{{.*}}!type ![[TYPE9:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo10(_: bool) { } +pub fn foo10(_: bool) {} // CHECK: define{{.*}}5foo10{{.*}}!type ![[TYPE10:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo11(_: bool, _: bool) { } +pub fn foo11(_: bool, _: bool) {} // CHECK: define{{.*}}5foo11{{.*}}!type ![[TYPE11:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo12(_: bool, _: bool, _: bool) { } +pub fn foo12(_: bool, _: bool, _: bool) {} // CHECK: define{{.*}}5foo12{{.*}}!type ![[TYPE12:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo13(_: i8) { } +pub fn foo13(_: i8) {} // CHECK: define{{.*}}5foo13{{.*}}!type ![[TYPE13:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo14(_: i8, _: i8) { } +pub fn foo14(_: i8, _: i8) {} // CHECK: define{{.*}}5foo14{{.*}}!type ![[TYPE14:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo15(_: i8, _: i8, _: i8) { } +pub fn foo15(_: i8, _: i8, _: i8) {} // CHECK: define{{.*}}5foo15{{.*}}!type ![[TYPE15:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo16(_: i16) { } +pub fn foo16(_: i16) {} // CHECK: define{{.*}}5foo16{{.*}}!type ![[TYPE16:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo17(_: i16, _: i16) { } +pub fn foo17(_: i16, _: i16) {} // CHECK: define{{.*}}5foo17{{.*}}!type ![[TYPE17:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo18(_: i16, _: i16, _: i16) { } +pub fn foo18(_: i16, _: i16, _: i16) {} // CHECK: define{{.*}}5foo18{{.*}}!type ![[TYPE18:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo19(_: i32) { } +pub fn foo19(_: i32) {} // CHECK: define{{.*}}5foo19{{.*}}!type ![[TYPE19:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo20(_: i32, _: i32) { } +pub fn foo20(_: i32, _: i32) {} // CHECK: define{{.*}}5foo20{{.*}}!type ![[TYPE20:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo21(_: i32, _: i32, _: i32) { } +pub fn foo21(_: i32, _: i32, _: i32) {} // CHECK: define{{.*}}5foo21{{.*}}!type ![[TYPE21:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo22(_: i64) { } +pub fn foo22(_: i64) {} // CHECK: define{{.*}}5foo22{{.*}}!type ![[TYPE22:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo23(_: i64, _: i64) { } +pub fn foo23(_: i64, _: i64) {} // CHECK: define{{.*}}5foo23{{.*}}!type ![[TYPE23:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo24(_: i64, _: i64, _: i64) { } +pub fn foo24(_: i64, _: i64, _: i64) {} // CHECK: define{{.*}}5foo24{{.*}}!type ![[TYPE24:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo25(_: i128) { } +pub fn foo25(_: i128) {} // CHECK: define{{.*}}5foo25{{.*}}!type ![[TYPE25:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo26(_: i128, _: i128) { } +pub fn foo26(_: i128, _: i128) {} // CHECK: define{{.*}}5foo26{{.*}}!type ![[TYPE26:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo27(_: i128, _: i128, _: i128) { } +pub fn foo27(_: i128, _: i128, _: i128) {} // CHECK: define{{.*}}5foo27{{.*}}!type ![[TYPE27:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo28(_: isize) { } +pub fn foo28(_: isize) {} // CHECK: define{{.*}}5foo28{{.*}}!type ![[TYPE28:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo29(_: isize, _: isize) { } +pub fn foo29(_: isize, _: isize) {} // CHECK: define{{.*}}5foo29{{.*}}!type ![[TYPE29:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo30(_: isize, _: isize, _: isize) { } +pub fn foo30(_: isize, _: isize, _: isize) {} // CHECK: define{{.*}}5foo30{{.*}}!type ![[TYPE30:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo31(_: u8) { } +pub fn foo31(_: u8) {} // CHECK: define{{.*}}5foo31{{.*}}!type ![[TYPE31:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo32(_: u8, _: u8) { } +pub fn foo32(_: u8, _: u8) {} // CHECK: define{{.*}}5foo32{{.*}}!type ![[TYPE32:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo33(_: u8, _: u8, _: u8) { } +pub fn foo33(_: u8, _: u8, _: u8) {} // CHECK: define{{.*}}5foo33{{.*}}!type ![[TYPE33:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo34(_: u16) { } +pub fn foo34(_: u16) {} // CHECK: define{{.*}}5foo34{{.*}}!type ![[TYPE34:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo35(_: u16, _: u16) { } +pub fn foo35(_: u16, _: u16) {} // CHECK: define{{.*}}5foo35{{.*}}!type ![[TYPE35:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo36(_: u16, _: u16, _: u16) { } +pub fn foo36(_: u16, _: u16, _: u16) {} // CHECK: define{{.*}}5foo36{{.*}}!type ![[TYPE36:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo37(_: u32) { } +pub fn foo37(_: u32) {} // CHECK: define{{.*}}5foo37{{.*}}!type ![[TYPE37:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo38(_: u32, _: u32) { } +pub fn foo38(_: u32, _: u32) {} // CHECK: define{{.*}}5foo38{{.*}}!type ![[TYPE38:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo39(_: u32, _: u32, _: u32) { } +pub fn foo39(_: u32, _: u32, _: u32) {} // CHECK: define{{.*}}5foo39{{.*}}!type ![[TYPE39:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo40(_: u64) { } +pub fn foo40(_: u64) {} // CHECK: define{{.*}}5foo40{{.*}}!type ![[TYPE40:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo41(_: u64, _: u64) { } +pub fn foo41(_: u64, _: u64) {} // CHECK: define{{.*}}5foo41{{.*}}!type ![[TYPE41:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo42(_: u64, _: u64, _: u64) { } +pub fn foo42(_: u64, _: u64, _: u64) {} // CHECK: define{{.*}}5foo42{{.*}}!type ![[TYPE42:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo43(_: u128) { } +pub fn foo43(_: u128) {} // CHECK: define{{.*}}5foo43{{.*}}!type ![[TYPE43:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo44(_: u128, _: u128) { } +pub fn foo44(_: u128, _: u128) {} // CHECK: define{{.*}}5foo44{{.*}}!type ![[TYPE44:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo45(_: u128, _: u128, _: u128) { } +pub fn foo45(_: u128, _: u128, _: u128) {} // CHECK: define{{.*}}5foo45{{.*}}!type ![[TYPE45:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo46(_: usize) { } +pub fn foo46(_: usize) {} // CHECK: define{{.*}}5foo46{{.*}}!type ![[TYPE46:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo47(_: usize, _: usize) { } +pub fn foo47(_: usize, _: usize) {} // CHECK: define{{.*}}5foo47{{.*}}!type ![[TYPE47:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo48(_: usize, _: usize, _: usize) { } +pub fn foo48(_: usize, _: usize, _: usize) {} // CHECK: define{{.*}}5foo48{{.*}}!type ![[TYPE48:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo49(_: f32) { } +pub fn foo49(_: f32) {} // CHECK: define{{.*}}5foo49{{.*}}!type ![[TYPE49:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo50(_: f32, _: f32) { } +pub fn foo50(_: f32, _: f32) {} // CHECK: define{{.*}}5foo50{{.*}}!type ![[TYPE50:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo51(_: f32, _: f32, _: f32) { } +pub fn foo51(_: f32, _: f32, _: f32) {} // CHECK: define{{.*}}5foo51{{.*}}!type ![[TYPE51:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo52(_: f64) { } +pub fn foo52(_: f64) {} // CHECK: define{{.*}}5foo52{{.*}}!type ![[TYPE52:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo53(_: f64, _: f64) { } +pub fn foo53(_: f64, _: f64) {} // CHECK: define{{.*}}5foo53{{.*}}!type ![[TYPE53:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo54(_: f64, _: f64, _: f64) { } +pub fn foo54(_: f64, _: f64, _: f64) {} // CHECK: define{{.*}}5foo54{{.*}}!type ![[TYPE54:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo55(_: char) { } +pub fn foo55(_: char) {} // CHECK: define{{.*}}5foo55{{.*}}!type ![[TYPE55:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo56(_: char, _: char) { } +pub fn foo56(_: char, _: char) {} // CHECK: define{{.*}}5foo56{{.*}}!type ![[TYPE56:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo57(_: char, _: char, _: char) { } +pub fn foo57(_: char, _: char, _: char) {} // CHECK: define{{.*}}5foo57{{.*}}!type ![[TYPE57:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo58(_: &str) { } +pub fn foo58(_: &str) {} // CHECK: define{{.*}}5foo58{{.*}}!type ![[TYPE58:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo59(_: &str, _: &str) { } +pub fn foo59(_: &str, _: &str) {} // CHECK: define{{.*}}5foo59{{.*}}!type ![[TYPE59:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo60(_: &str, _: &str, _: &str) { } +pub fn foo60(_: &str, _: &str, _: &str) {} // CHECK: define{{.*}}5foo60{{.*}}!type ![[TYPE60:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} // CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFvvE"} diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-repr-transparent-types.rs b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-repr-transparent-types.rs index 1332338b26a..0f97c70f3f9 100644 --- a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-repr-transparent-types.rs +++ b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-repr-transparent-types.rs @@ -4,7 +4,7 @@ //@ needs-sanitizer-cfi //@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -#![crate_type="lib"] +#![crate_type = "lib"] extern crate core; use core::ffi::*; @@ -40,32 +40,31 @@ pub struct Type2<'a> { #[repr(transparent)] pub struct Type4Helper(*mut T); -pub fn foo1(_: Type1) { } +pub fn foo1(_: Type1) {} // CHECK: define{{.*}}4foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo2(_: Type1, _: Type1) { } +pub fn foo2(_: Type1, _: Type1) {} // CHECK: define{{.*}}4foo2{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo3(_: Type1, _: Type1, _: Type1) { } +pub fn foo3(_: Type1, _: Type1, _: Type1) {} // CHECK: define{{.*}}4foo3{{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo4(_: Type2) { } +pub fn foo4(_: Type2) {} // CHECK: define{{.*}}4foo4{{.*}}!type ![[TYPE4:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo5(_: Type2, _: Type2) { } +pub fn foo5(_: Type2, _: Type2) {} // CHECK: define{{.*}}4foo5{{.*}}!type ![[TYPE5:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo6(_: Type2, _: Type2, _: Type2) { } +pub fn foo6(_: Type2, _: Type2, _: Type2) {} // CHECK: define{{.*}}4foo6{{.*}}!type ![[TYPE6:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo7(_: Type3) { } +pub fn foo7(_: Type3) {} // CHECK: define{{.*}}4foo7{{.*}}!type ![[TYPE7:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo8(_: Type3, _: Type3) { } +pub fn foo8(_: Type3, _: Type3) {} // CHECK: define{{.*}}4foo8{{.*}}!type ![[TYPE8:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo9(_: Type3, _: Type3, _: Type3) { } +pub fn foo9(_: Type3, _: Type3, _: Type3) {} // CHECK: define{{.*}}4foo9{{.*}}!type ![[TYPE9:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo10(_: Type4) { } +pub fn foo10(_: Type4) {} // CHECK: define{{.*}}5foo10{{.*}}!type ![[TYPE10:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo11(_: Type4, _: Type4) { } +pub fn foo11(_: Type4, _: Type4) {} // CHECK: define{{.*}}5foo11{{.*}}!type ![[TYPE11:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo12(_: Type4, _: Type4, _: Type4) { } +pub fn foo12(_: Type4, _: Type4, _: Type4) {} // CHECK: define{{.*}}5foo12{{.*}}!type ![[TYPE12:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} - // CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}3FooE"} // CHECK: ![[TYPE2]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}3FooS_E"} // CHECK: ![[TYPE3]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}3FooS_S_E"} diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-sequence-types.rs b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-sequence-types.rs index dd2e05dd2ec..bdee3f47a83 100644 --- a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-sequence-types.rs +++ b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-sequence-types.rs @@ -4,25 +4,25 @@ //@ needs-sanitizer-cfi //@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -#![crate_type="lib"] +#![crate_type = "lib"] -pub fn foo1(_: (i32, i32)) { } +pub fn foo1(_: (i32, i32)) {} // CHECK: define{{.*}}4foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo2(_: (i32, i32), _: (i32, i32)) { } +pub fn foo2(_: (i32, i32), _: (i32, i32)) {} // CHECK: define{{.*}}4foo2{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo3(_: (i32, i32), _: (i32, i32), _: (i32, i32)) { } +pub fn foo3(_: (i32, i32), _: (i32, i32), _: (i32, i32)) {} // CHECK: define{{.*}}4foo3{{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo4(_: [i32; 32]) { } +pub fn foo4(_: [i32; 32]) {} // CHECK: define{{.*}}4foo4{{.*}}!type ![[TYPE4:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo5(_: [i32; 32], _: [i32; 32]) { } +pub fn foo5(_: [i32; 32], _: [i32; 32]) {} // CHECK: define{{.*}}4foo5{{.*}}!type ![[TYPE5:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo6(_: [i32; 32], _: [i32; 32], _: [i32; 32]) { } +pub fn foo6(_: [i32; 32], _: [i32; 32], _: [i32; 32]) {} // CHECK: define{{.*}}4foo6{{.*}}!type ![[TYPE6:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo7(_: &[i32]) { } +pub fn foo7(_: &[i32]) {} // CHECK: define{{.*}}4foo7{{.*}}!type ![[TYPE7:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo8(_: &[i32], _: &[i32]) { } +pub fn foo8(_: &[i32], _: &[i32]) {} // CHECK: define{{.*}}4foo8{{.*}}!type ![[TYPE8:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo9(_: &[i32], _: &[i32], _: &[i32]) { } +pub fn foo9(_: &[i32], _: &[i32], _: &[i32]) {} // CHECK: define{{.*}}4foo9{{.*}}!type ![[TYPE9:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} // CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFvu5tupleIu3i32S_EE"} diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-trait-types.rs b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-trait-types.rs index 6d9fe7040f7..55e816178f8 100644 --- a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-trait-types.rs +++ b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-trait-types.rs @@ -4,7 +4,7 @@ //@ needs-sanitizer-cfi //@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -#![crate_type="lib"] +#![crate_type = "lib"] extern crate core; @@ -16,8 +16,7 @@ pub trait Trait1 { pub struct Type1; impl Trait1 for Type1 { - fn foo(&self) { - } + fn foo(&self) {} } pub trait Trait2 { @@ -27,8 +26,7 @@ pub trait Trait2 { pub struct Type2; impl Trait2 for Type2 { - fn bar(&self) { - } + fn bar(&self) {} } pub trait Trait3 { @@ -38,8 +36,7 @@ pub trait Trait3 { pub struct Type3; impl Trait3 for T { - fn baz(&self, _: &U) { - } + fn baz(&self, _: &U) {} } pub trait Trait4<'a, T> { @@ -64,71 +61,88 @@ pub trait Trait5 { pub struct Type5; impl Trait5 for T { - fn quux(&self, _: &[U; N]) { - } + fn quux(&self, _: &[U; N]) {} } -pub fn foo1(_: &dyn Send) { } +pub fn foo1(_: &dyn Send) {} // CHECK: define{{.*}}4foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo2(_: &dyn Send, _: &dyn Send) { } +pub fn foo2(_: &dyn Send, _: &dyn Send) {} // CHECK: define{{.*}}4foo2{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo3(_: &dyn Send, _: &dyn Send, _: &dyn Send) { } +pub fn foo3(_: &dyn Send, _: &dyn Send, _: &dyn Send) {} // CHECK: define{{.*}}4foo3{{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo4(_: &(dyn Send + Sync)) { } +pub fn foo4(_: &(dyn Send + Sync)) {} // CHECK: define{{.*}}4foo4{{.*}}!type ![[TYPE4:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo5(_: &(dyn Send + Sync), _: &(dyn Sync + Send)) { } +pub fn foo5(_: &(dyn Send + Sync), _: &(dyn Sync + Send)) {} // CHECK: define{{.*}}4foo5{{.*}}!type ![[TYPE5:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo6(_: &(dyn Send + Sync), _: &(dyn Sync + Send), _: &(dyn Sync + Send)) { } +pub fn foo6(_: &(dyn Send + Sync), _: &(dyn Sync + Send), _: &(dyn Sync + Send)) {} // CHECK: define{{.*}}4foo6{{.*}}!type ![[TYPE6:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo7(_: &(dyn Trait1 + Send)) { } +pub fn foo7(_: &(dyn Trait1 + Send)) {} // CHECK: define{{.*}}4foo7{{.*}}!type ![[TYPE7:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo8(_: &(dyn Trait1 + Send), _: &(dyn Trait1 + Send)) { } +pub fn foo8(_: &(dyn Trait1 + Send), _: &(dyn Trait1 + Send)) {} // CHECK: define{{.*}}4foo8{{.*}}!type ![[TYPE8:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo9(_: &(dyn Trait1 + Send), _: &(dyn Trait1 + Send), _: &(dyn Trait1 + Send)) { } +pub fn foo9(_: &(dyn Trait1 + Send), _: &(dyn Trait1 + Send), _: &(dyn Trait1 + Send)) {} // CHECK: define{{.*}}4foo9{{.*}}!type ![[TYPE9:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo10(_: &(dyn Trait1 + Send + Sync)) { } +pub fn foo10(_: &(dyn Trait1 + Send + Sync)) {} // CHECK: define{{.*}}5foo10{{.*}}!type ![[TYPE10:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo11(_: &(dyn Trait1 + Send + Sync), _: &(dyn Trait1 + Sync + Send)) { } +pub fn foo11(_: &(dyn Trait1 + Send + Sync), _: &(dyn Trait1 + Sync + Send)) {} // CHECK: define{{.*}}5foo11{{.*}}!type ![[TYPE11:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo12(_: &(dyn Trait1 + Send + Sync), - _: &(dyn Trait1 + Sync + Send), - _: &(dyn Trait1 + Sync + Send)) { } +pub fn foo12( + _: &(dyn Trait1 + Send + Sync), + _: &(dyn Trait1 + Sync + Send), + _: &(dyn Trait1 + Sync + Send), +) { +} // CHECK: define{{.*}}5foo12{{.*}}!type ![[TYPE12:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo13(_: &dyn Trait1) { } +pub fn foo13(_: &dyn Trait1) {} // CHECK: define{{.*}}5foo13{{.*}}!type ![[TYPE13:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo14(_: &dyn Trait1, _: &dyn Trait1) { } +pub fn foo14(_: &dyn Trait1, _: &dyn Trait1) {} // CHECK: define{{.*}}5foo14{{.*}}!type ![[TYPE14:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo15(_: &dyn Trait1, _: &dyn Trait1, _: &dyn Trait1) { } +pub fn foo15(_: &dyn Trait1, _: &dyn Trait1, _: &dyn Trait1) {} // CHECK: define{{.*}}5foo15{{.*}}!type ![[TYPE15:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo16(_: &dyn Trait2) { } -pub fn bar16() { let a = Type2; foo16(&a); } +pub fn foo16(_: &dyn Trait2) {} +pub fn bar16() { + let a = Type2; + foo16(&a); +} // CHECK: define{{.*}}5foo16{{.*}}!type ![[TYPE16:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo17(_: &dyn Trait2, _: &dyn Trait2) { } -pub fn bar17() { let a = Type2; foo17(&a, &a); } +pub fn foo17(_: &dyn Trait2, _: &dyn Trait2) {} +pub fn bar17() { + let a = Type2; + foo17(&a, &a); +} // CHECK: define{{.*}}5foo17{{.*}}!type ![[TYPE17:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo18(_: &dyn Trait2, _: &dyn Trait2, _: &dyn Trait2) { } -pub fn bar18() { let a = Type2; foo18(&a, &a, &a); } +pub fn foo18(_: &dyn Trait2, _: &dyn Trait2, _: &dyn Trait2) {} +pub fn bar18() { + let a = Type2; + foo18(&a, &a, &a); +} // CHECK: define{{.*}}5foo18{{.*}}!type ![[TYPE18:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo19(_: &dyn Trait3) { } +pub fn foo19(_: &dyn Trait3) {} // CHECK: define{{.*}}5foo19{{.*}}!type ![[TYPE19:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo20(_: &dyn Trait3, _: &dyn Trait3) { } +pub fn foo20(_: &dyn Trait3, _: &dyn Trait3) {} // CHECK: define{{.*}}5foo20{{.*}}!type ![[TYPE20:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo21(_: &dyn Trait3, _: &dyn Trait3, _: &dyn Trait3) { } +pub fn foo21(_: &dyn Trait3, _: &dyn Trait3, _: &dyn Trait3) {} // CHECK: define{{.*}}5foo21{{.*}}!type ![[TYPE21:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo22<'a>(_: &dyn Trait4<'a, Type4, Output = &'a i32>) { } +pub fn foo22<'a>(_: &dyn Trait4<'a, Type4, Output = &'a i32>) {} // CHECK: define{{.*}}5foo22{{.*}}!type ![[TYPE22:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo23<'a>(_: &dyn Trait4<'a, Type4, Output = &'a i32>, - _: &dyn Trait4<'a, Type4, Output = &'a i32>) { } +pub fn foo23<'a>( + _: &dyn Trait4<'a, Type4, Output = &'a i32>, + _: &dyn Trait4<'a, Type4, Output = &'a i32>, +) { +} // CHECK: define{{.*}}5foo23{{.*}}!type ![[TYPE23:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo24<'a>(_: &dyn Trait4<'a, Type4, Output = &'a i32>, - _: &dyn Trait4<'a, Type4, Output = &'a i32>, - _: &dyn Trait4<'a, Type4, Output = &'a i32>) { } +pub fn foo24<'a>( + _: &dyn Trait4<'a, Type4, Output = &'a i32>, + _: &dyn Trait4<'a, Type4, Output = &'a i32>, + _: &dyn Trait4<'a, Type4, Output = &'a i32>, +) { +} // CHECK: define{{.*}}5foo24{{.*}}!type ![[TYPE24:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo25(_: &dyn Trait5) { } +pub fn foo25(_: &dyn Trait5) {} // CHECK: define{{.*}}5foo25{{.*}}!type ![[TYPE25:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo26(_: &dyn Trait5, _: &dyn Trait5) { } +pub fn foo26(_: &dyn Trait5, _: &dyn Trait5) {} // CHECK: define{{.*}}5foo26{{.*}}!type ![[TYPE26:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo27(_: &dyn Trait5, _: &dyn Trait5, _: &dyn Trait5) { } +pub fn foo27(_: &dyn Trait5, _: &dyn Trait5, _: &dyn Trait5) {} // CHECK: define{{.*}}5foo27{{.*}}!type ![[TYPE27:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} // CHECK: ![[TYPE13]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}6Trait1u6regionEEE"} diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-user-defined-types.rs b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-user-defined-types.rs index 4eaf42bf87d..c1f3ca61afe 100644 --- a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-user-defined-types.rs +++ b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-user-defined-types.rs @@ -4,7 +4,7 @@ //@ needs-sanitizer-cfi //@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -#![crate_type="lib"] +#![crate_type = "lib"] #![feature(extern_types)] pub struct Struct1 { @@ -19,33 +19,33 @@ pub union Union1 { member1: std::mem::ManuallyDrop, } -extern { +extern "C" { pub type type1; } -pub fn foo1(_: &Struct1::) { } +pub fn foo1(_: &Struct1) {} // CHECK: define{{.*}}4foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo2(_: &Struct1::, _: &Struct1::) { } +pub fn foo2(_: &Struct1, _: &Struct1) {} // CHECK: define{{.*}}4foo2{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo3(_: &Struct1::, _: &Struct1::, _: &Struct1::) { } +pub fn foo3(_: &Struct1, _: &Struct1, _: &Struct1) {} // CHECK: define{{.*}}4foo3{{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo4(_: &Enum1::) { } +pub fn foo4(_: &Enum1) {} // CHECK: define{{.*}}4foo4{{.*}}!type ![[TYPE4:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo5(_: &Enum1::, _: &Enum1::) { } +pub fn foo5(_: &Enum1, _: &Enum1) {} // CHECK: define{{.*}}4foo5{{.*}}!type ![[TYPE5:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo6(_: &Enum1::, _: &Enum1::, _: &Enum1::) { } +pub fn foo6(_: &Enum1, _: &Enum1, _: &Enum1) {} // CHECK: define{{.*}}4foo6{{.*}}!type ![[TYPE6:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo7(_: &Union1::) { } +pub fn foo7(_: &Union1) {} // CHECK: define{{.*}}4foo7{{.*}}!type ![[TYPE7:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo8(_: &Union1::, _: &Union1::) { } +pub fn foo8(_: &Union1, _: &Union1) {} // CHECK: define{{.*}}4foo8{{.*}}!type ![[TYPE8:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo9(_: &Union1::, _: &Union1::, _: &Union1::) { } +pub fn foo9(_: &Union1, _: &Union1, _: &Union1) {} // CHECK: define{{.*}}4foo9{{.*}}!type ![[TYPE9:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo10(_: *mut type1) { } +pub fn foo10(_: *mut type1) {} // CHECK: define{{.*}}5foo10{{.*}}!type ![[TYPE10:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo11(_: *mut type1, _: *mut type1) { } +pub fn foo11(_: *mut type1, _: *mut type1) {} // CHECK: define{{.*}}5foo11{{.*}}!type ![[TYPE11:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo12(_: *mut type1, _: *mut type1, _: *mut type1) { } +pub fn foo12(_: *mut type1, _: *mut type1, _: *mut type1) {} // CHECK: define{{.*}}5foo12{{.*}}!type ![[TYPE12:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} // CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}7Struct1Iu3i32EEE"} diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-generalized.rs b/tests/codegen/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-generalized.rs index ccd7ee93ca1..32637b64b3e 100644 --- a/tests/codegen/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-generalized.rs +++ b/tests/codegen/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-generalized.rs @@ -3,7 +3,7 @@ //@ needs-sanitizer-cfi //@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-generalize-pointers -#![crate_type="lib"] +#![crate_type = "lib"] pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { // CHECK-LABEL: define{{.*}}foo diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized-generalized.rs b/tests/codegen/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized-generalized.rs index d4130034178..51121b0aef1 100644 --- a/tests/codegen/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized-generalized.rs +++ b/tests/codegen/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized-generalized.rs @@ -3,7 +3,7 @@ //@ needs-sanitizer-cfi //@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers -Zsanitizer-cfi-generalize-pointers -#![crate_type="lib"] +#![crate_type = "lib"] pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { // CHECK-LABEL: define{{.*}}foo diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized.rs b/tests/codegen/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized.rs index ac18379165d..1cfdd23006e 100644 --- a/tests/codegen/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized.rs +++ b/tests/codegen/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized.rs @@ -3,7 +3,7 @@ //@ needs-sanitizer-cfi //@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers -#![crate_type="lib"] +#![crate_type = "lib"] pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { // CHECK-LABEL: define{{.*}}foo diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi.rs b/tests/codegen/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi.rs index 526ba62c264..56ab1ce4b35 100644 --- a/tests/codegen/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi.rs +++ b/tests/codegen/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi.rs @@ -3,7 +3,7 @@ //@ needs-sanitizer-cfi //@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -#![crate_type="lib"] +#![crate_type = "lib"] pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { // CHECK-LABEL: define{{.*}}foo diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-trait-objects.rs b/tests/codegen/sanitizer/cfi/emit-type-metadata-trait-objects.rs index 318aad9291c..0e57ce322d1 100644 --- a/tests/codegen/sanitizer/cfi/emit-type-metadata-trait-objects.rs +++ b/tests/codegen/sanitizer/cfi/emit-type-metadata-trait-objects.rs @@ -3,7 +3,7 @@ //@ needs-sanitizer-cfi //@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Ctarget-feature=-crt-static -Zsanitizer=cfi -#![crate_type="lib"] +#![crate_type = "lib"] pub trait Trait1 { fn foo(&self); @@ -13,8 +13,7 @@ pub trait Trait1 { pub struct Type1; impl Trait1 for Type1 { - fn foo(&self) { - } + fn foo(&self) {} } pub trait Trait2 { @@ -24,8 +23,7 @@ pub trait Trait2 { pub struct Type2; impl Trait2 for Type2 { - fn bar(&self) { - } + fn bar(&self) {} } pub trait Trait3 { @@ -35,8 +33,7 @@ pub trait Trait3 { pub struct Type3; impl Trait3 for T { - fn baz(&self, _: &U) { - } + fn baz(&self, _: &U) {} } pub trait Trait4<'a, T> { @@ -61,8 +58,7 @@ pub trait Trait5 { pub struct Type5; impl Trait5 for T { - fn quux(&self, _: &[U; N]) { - } + fn quux(&self, _: &[U; N]) {} } pub fn foo1(a: &dyn Trait1) { diff --git a/tests/codegen/sanitizer/cfi/generalize-pointers.rs b/tests/codegen/sanitizer/cfi/generalize-pointers.rs index eaf3dad1909..57004da6f8e 100644 --- a/tests/codegen/sanitizer/cfi/generalize-pointers.rs +++ b/tests/codegen/sanitizer/cfi/generalize-pointers.rs @@ -3,33 +3,33 @@ //@ needs-sanitizer-cfi //@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-generalize-pointers -Copt-level=0 -#![crate_type="lib"] +#![crate_type = "lib"] extern crate core; -pub fn foo0(_: &mut i32) { } +pub fn foo0(_: &mut i32) {} // CHECK: define{{.*}}foo0{{.*}}!type ![[TYPE0:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo1(_: &mut i32, _: &mut i32) { } +pub fn foo1(_: &mut i32, _: &mut i32) {} // CHECK: define{{.*}}foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo2(_: &mut i32, _: &mut i32, _: &mut i32) { } +pub fn foo2(_: &mut i32, _: &mut i32, _: &mut i32) {} // CHECK: define{{.*}}foo2{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo3(_: &i32) { } +pub fn foo3(_: &i32) {} // CHECK: define{{.*}}foo3{{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo4(_: &i32, _: &i32) { } +pub fn foo4(_: &i32, _: &i32) {} // CHECK: define{{.*}}foo4{{.*}}!type ![[TYPE4:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo5(_: &i32, _: &i32, _: &i32) { } +pub fn foo5(_: &i32, _: &i32, _: &i32) {} // CHECK: define{{.*}}foo5{{.*}}!type ![[TYPE5:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo6(_: *mut i32) { } +pub fn foo6(_: *mut i32) {} // CHECK: define{{.*}}foo6{{.*}}!type ![[TYPE6:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo7(_: *mut i32, _: *mut i32) { } +pub fn foo7(_: *mut i32, _: *mut i32) {} // CHECK: define{{.*}}foo7{{.*}}!type ![[TYPE7:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo8(_: *mut i32, _: *mut i32, _: *mut i32) { } +pub fn foo8(_: *mut i32, _: *mut i32, _: *mut i32) {} // CHECK: define{{.*}}foo8{{.*}}!type ![[TYPE8:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo9(_: *const i32) { } +pub fn foo9(_: *const i32) {} // CHECK: define{{.*}}foo9{{.*}}!type ![[TYPE9:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo10(_: *const i32, _: *const i32) { } +pub fn foo10(_: *const i32, _: *const i32) {} // CHECK: define{{.*}}foo10{{.*}}!type ![[TYPE10:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} -pub fn foo11(_: *const i32, _: *const i32, _: *const i32) { } +pub fn foo11(_: *const i32, _: *const i32, _: *const i32) {} // CHECK: define{{.*}}foo11{{.*}}!type ![[TYPE11:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} // CHECK: ![[TYPE0]] = !{i64 0, !"_ZTSFvU3mutu3refIvEE.generalized"} diff --git a/tests/codegen/sanitizer/cfi/normalize-integers.rs b/tests/codegen/sanitizer/cfi/normalize-integers.rs index 801ed312be5..770ee4e64e0 100644 --- a/tests/codegen/sanitizer/cfi/normalize-integers.rs +++ b/tests/codegen/sanitizer/cfi/normalize-integers.rs @@ -3,33 +3,33 @@ //@ needs-sanitizer-cfi //@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers -Copt-level=0 -#![crate_type="lib"] +#![crate_type = "lib"] extern crate core; -pub fn foo0(_: bool) { } +pub fn foo0(_: bool) {} // CHECK: define{{.*}}foo0{{.*}}!type ![[TYPE0:[0-9]+]] !type !{{[0-9]+}} -pub fn foo1(_: bool, _: bool) { } +pub fn foo1(_: bool, _: bool) {} // CHECK: define{{.*}}foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} -pub fn foo2(_: bool, _: bool, _: bool) { } +pub fn foo2(_: bool, _: bool, _: bool) {} // CHECK: define{{.*}}foo2{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} -pub fn foo3(_: char) { } +pub fn foo3(_: char) {} // CHECK: define{{.*}}foo3{{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} -pub fn foo4(_: char, _: char) { } +pub fn foo4(_: char, _: char) {} // CHECK: define{{.*}}foo4{{.*}}!type ![[TYPE4:[0-9]+]] !type !{{[0-9]+}} -pub fn foo5(_: char, _: char, _: char) { } +pub fn foo5(_: char, _: char, _: char) {} // CHECK: define{{.*}}foo5{{.*}}!type ![[TYPE5:[0-9]+]] !type !{{[0-9]+}} -pub fn foo6(_: isize) { } +pub fn foo6(_: isize) {} // CHECK: define{{.*}}foo6{{.*}}!type ![[TYPE6:[0-9]+]] !type !{{[0-9]+}} -pub fn foo7(_: isize, _: isize) { } +pub fn foo7(_: isize, _: isize) {} // CHECK: define{{.*}}foo7{{.*}}!type ![[TYPE7:[0-9]+]] !type !{{[0-9]+}} -pub fn foo8(_: isize, _: isize, _: isize) { } +pub fn foo8(_: isize, _: isize, _: isize) {} // CHECK: define{{.*}}foo8{{.*}}!type ![[TYPE8:[0-9]+]] !type !{{[0-9]+}} -pub fn foo9(_: (), _: usize) { } +pub fn foo9(_: (), _: usize) {} // CHECK: define{{.*}}foo9{{.*}}!type ![[TYPE9:[0-9]+]] !type !{{[0-9]+}} -pub fn foo10(_: (), _: usize, _: usize) { } +pub fn foo10(_: (), _: usize, _: usize) {} // CHECK: define{{.*}}foo10{{.*}}!type ![[TYPE10:[0-9]+]] !type !{{[0-9]+}} -pub fn foo11(_: (), _: usize, _: usize, _: usize) { } +pub fn foo11(_: (), _: usize, _: usize, _: usize) {} // CHECK: define{{.*}}foo11{{.*}}!type ![[TYPE11:[0-9]+]] !type !{{[0-9]+}} // CHECK: ![[TYPE0]] = !{i64 0, !"_ZTSFvu2u8E.normalized"} diff --git a/tests/codegen/sanitizer/dataflow-instrument-functions.rs b/tests/codegen/sanitizer/dataflow-instrument-functions.rs index 69c3560882c..a2d0d63cc17 100644 --- a/tests/codegen/sanitizer/dataflow-instrument-functions.rs +++ b/tests/codegen/sanitizer/dataflow-instrument-functions.rs @@ -3,8 +3,7 @@ //@ needs-sanitizer-dataflow //@ compile-flags: -Copt-level=0 -Zsanitizer=dataflow -#![crate_type="lib"] +#![crate_type = "lib"] -pub fn foo() { -} +pub fn foo() {} // CHECK: define{{.*}}foo{{.*}}.dfsan diff --git a/tests/codegen/sanitizer/kcfi/add-kcfi-flag.rs b/tests/codegen/sanitizer/kcfi/add-kcfi-flag.rs index 7751d3baf79..013de74f8d6 100644 --- a/tests/codegen/sanitizer/kcfi/add-kcfi-flag.rs +++ b/tests/codegen/sanitizer/kcfi/add-kcfi-flag.rs @@ -8,15 +8,14 @@ //@ compile-flags: -Ctarget-feature=-crt-static -Zsanitizer=kcfi #![feature(no_core, lang_items)] -#![crate_type="lib"] +#![crate_type = "lib"] #![no_core] -#[lang="sized"] -trait Sized { } -#[lang="copy"] -trait Copy { } +#[lang = "sized"] +trait Sized {} +#[lang = "copy"] +trait Copy {} -pub fn foo() { -} +pub fn foo() {} // CHECK: !{{[0-9]+}} = !{i32 4, !"kcfi", i32 1} diff --git a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-attr-no-sanitize.rs b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-attr-no-sanitize.rs index 8055c63a2f8..ba2e397f6da 100644 --- a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-attr-no-sanitize.rs +++ b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-attr-no-sanitize.rs @@ -7,14 +7,14 @@ //@ [x86_64] needs-llvm-components: //@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Copt-level=0 -#![crate_type="lib"] +#![crate_type = "lib"] #![feature(no_core, no_sanitize, lang_items)] #![no_core] -#[lang="sized"] -trait Sized { } -#[lang="copy"] -trait Copy { } +#[lang = "sized"] +trait Sized {} +#[lang = "copy"] +trait Copy {} impl Copy for i32 {} diff --git a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-generalized.rs b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-generalized.rs index bd1dfc4c413..4e95bdf4d7c 100644 --- a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-generalized.rs +++ b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-generalized.rs @@ -7,14 +7,14 @@ //@ [x86_64] needs-llvm-components: //@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Zsanitizer-cfi-generalize-pointers -#![crate_type="lib"] +#![crate_type = "lib"] #![feature(no_core, lang_items)] #![no_core] -#[lang="sized"] -trait Sized { } -#[lang="copy"] -trait Copy { } +#[lang = "sized"] +trait Sized {} +#[lang = "copy"] +trait Copy {} impl Copy for i32 {} diff --git a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized-generalized.rs b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized-generalized.rs index b8275f44fac..31b43b50988 100644 --- a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized-generalized.rs +++ b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized-generalized.rs @@ -7,14 +7,14 @@ //@ [x86_64] needs-llvm-components: //@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Zsanitizer-cfi-normalize-integers -Zsanitizer-cfi-generalize-pointers -#![crate_type="lib"] +#![crate_type = "lib"] #![feature(no_core, lang_items)] #![no_core] -#[lang="sized"] -trait Sized { } -#[lang="copy"] -trait Copy { } +#[lang = "sized"] +trait Sized {} +#[lang = "copy"] +trait Copy {} impl Copy for i32 {} diff --git a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized.rs b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized.rs index cd1b0c5efb0..4755f6062aa 100644 --- a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized.rs +++ b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized.rs @@ -7,14 +7,14 @@ //@ [x86_64] needs-llvm-components: //@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Zsanitizer-cfi-normalize-integers -#![crate_type="lib"] +#![crate_type = "lib"] #![feature(no_core, lang_items)] #![no_core] -#[lang="sized"] -trait Sized { } -#[lang="copy"] -trait Copy { } +#[lang = "sized"] +trait Sized {} +#[lang = "copy"] +trait Copy {} impl Copy for i32 {} diff --git a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi.rs b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi.rs index 12690577da7..be9760bd9af 100644 --- a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi.rs +++ b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi.rs @@ -7,14 +7,14 @@ //@ [x86_64] needs-llvm-components: //@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Copt-level=0 -#![crate_type="lib"] +#![crate_type = "lib"] #![feature(no_core, lang_items)] #![no_core] -#[lang="sized"] -trait Sized { } -#[lang="copy"] -trait Copy { } +#[lang = "sized"] +trait Sized {} +#[lang = "copy"] +trait Copy {} impl Copy for i32 {} diff --git a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle.rs b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle.rs index f4b3e48638e..c9c94cdb329 100644 --- a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle.rs +++ b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle.rs @@ -7,14 +7,14 @@ //@ [x86_64] needs-llvm-components: //@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Copt-level=0 -#![crate_type="lib"] +#![crate_type = "lib"] #![feature(no_core, lang_items)] #![no_core] -#[lang="sized"] -trait Sized { } -#[lang="copy"] -trait Copy { } +#[lang = "sized"] +trait Sized {} +#[lang = "copy"] +trait Copy {} impl Copy for i32 {} diff --git a/tests/codegen/sanitizer/kcfi/emit-type-metadata-trait-objects.rs b/tests/codegen/sanitizer/kcfi/emit-type-metadata-trait-objects.rs index f9c7cca3989..fc4d570dc2e 100644 --- a/tests/codegen/sanitizer/kcfi/emit-type-metadata-trait-objects.rs +++ b/tests/codegen/sanitizer/kcfi/emit-type-metadata-trait-objects.rs @@ -7,30 +7,32 @@ //@ [x86_64] needs-llvm-components: //@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Copt-level=0 -#![crate_type="lib"] +#![crate_type = "lib"] #![feature(arbitrary_self_types, no_core, lang_items)] #![no_core] -#[lang="sized"] -trait Sized { } -#[lang="copy"] -trait Copy { } -#[lang="receiver"] -trait Receiver { } -#[lang="dispatch_from_dyn"] -trait DispatchFromDyn { } +#[lang = "sized"] +trait Sized {} +#[lang = "copy"] +trait Copy {} +#[lang = "receiver"] +trait Receiver {} +#[lang = "dispatch_from_dyn"] +trait DispatchFromDyn {} impl<'a, T: ?Sized + Unsize, U: ?Sized> DispatchFromDyn<&'a U> for &'a T {} #[lang = "unsize"] -trait Unsize { } +trait Unsize {} #[lang = "coerce_unsized"] -pub trait CoerceUnsized { } +pub trait CoerceUnsized {} impl<'a, 'b: 'a, T: ?Sized + Unsize, U: ?Sized> CoerceUnsized<&'a U> for &'b T {} -#[lang="freeze"] -trait Freeze { } -#[lang="drop_in_place"] -fn drop_in_place_fn() { } -#[lang="drop"] -trait Drop { fn drop(&mut self); } +#[lang = "freeze"] +trait Freeze {} +#[lang = "drop_in_place"] +fn drop_in_place_fn() {} +#[lang = "drop"] +trait Drop { + fn drop(&mut self); +} pub trait Trait1 { fn foo(&self); @@ -39,8 +41,7 @@ pub trait Trait1 { pub struct Type1; impl Trait1 for Type1 { - fn foo(&self) { - } + fn foo(&self) {} } pub trait Trait2 { @@ -50,8 +51,7 @@ pub trait Trait2 { pub struct Type2; impl Trait2 for Type2 { - fn bar(&self) { - } + fn bar(&self) {} } pub trait Trait3 { @@ -61,8 +61,7 @@ pub trait Trait3 { pub struct Type3; impl Trait3 for T { - fn baz(&self, _: &U) { - } + fn baz(&self, _: &U) {} } pub trait Trait4<'a, T> { @@ -88,8 +87,7 @@ pub trait Trait5 { impl Copy for Type5 {} impl Trait5 for T { - fn quux(&self, _: &[U; N]) { - } + fn quux(&self, _: &[U; N]) {} } pub fn foo1(a: &dyn Trait1) { diff --git a/tests/codegen/sanitizer/memory-track-origins.rs b/tests/codegen/sanitizer/memory-track-origins.rs index 956053ec42c..318c277e10c 100644 --- a/tests/codegen/sanitizer/memory-track-origins.rs +++ b/tests/codegen/sanitizer/memory-track-origins.rs @@ -11,7 +11,7 @@ //@[MSAN-1-LTO] compile-flags: -Zsanitizer-memory-track-origins=1 -C lto=fat //@[MSAN-2-LTO] compile-flags: -Zsanitizer-memory-track-origins -C lto=fat -#![crate_type="lib"] +#![crate_type = "lib"] // MSAN-0-NOT: @__msan_track_origins // MSAN-1: @__msan_track_origins = weak_odr {{.*}}constant i32 1 diff --git a/tests/codegen/sanitizer/no-sanitize-inlining.rs b/tests/codegen/sanitizer/no-sanitize-inlining.rs index d5e47884f85..4bd832d2ab1 100644 --- a/tests/codegen/sanitizer/no-sanitize-inlining.rs +++ b/tests/codegen/sanitizer/no-sanitize-inlining.rs @@ -8,7 +8,7 @@ //@[ASAN] compile-flags: -Zsanitizer=address //@[LSAN] compile-flags: -Zsanitizer=leak -#![crate_type="lib"] +#![crate_type = "lib"] #![feature(no_sanitize)] // ASAN-LABEL: define void @test diff --git a/tests/codegen/sanitizer/no-sanitize.rs b/tests/codegen/sanitizer/no-sanitize.rs index 2614416210f..47d3fd83f11 100644 --- a/tests/codegen/sanitizer/no-sanitize.rs +++ b/tests/codegen/sanitizer/no-sanitize.rs @@ -4,7 +4,7 @@ //@ needs-sanitizer-address //@ compile-flags: -Zsanitizer=address -Ctarget-feature=-crt-static -Copt-level=0 -#![crate_type="lib"] +#![crate_type = "lib"] #![feature(no_sanitize)] // CHECK-LABEL: ; no_sanitize::unsanitized diff --git a/tests/codegen/set-discriminant-invalid.rs b/tests/codegen/set-discriminant-invalid.rs index 593da8cf80d..0b7cb14880c 100644 --- a/tests/codegen/set-discriminant-invalid.rs +++ b/tests/codegen/set-discriminant-invalid.rs @@ -7,17 +7,12 @@ pub struct TokioError { b: bool, } pub enum Error { - Api { - source: ApiError, - }, + Api { source: ApiError }, Ethereum, - Tokio { - source: TokioError, - }, + Tokio { source: TokioError }, } struct Api; -impl IntoError for Api -{ +impl IntoError for Api { type Source = ApiError; // CHECK-LABEL: @into_error // CHECK: llvm.trap() @@ -27,14 +22,11 @@ impl IntoError for Api // CHECK-NEXT: ret #[no_mangle] fn into_error(self, error: Self::Source) -> Error { - Error::Api { - source: error, - } + Error::Api { source: error } } } -pub trait IntoError -{ +pub trait IntoError { /// The underlying error type Source; diff --git a/tests/codegen/simd/issue-120720-reduce-nan.rs b/tests/codegen/simd/issue-120720-reduce-nan.rs index 0372582bf7f..13af0bb076e 100644 --- a/tests/codegen/simd/issue-120720-reduce-nan.rs +++ b/tests/codegen/simd/issue-120720-reduce-nan.rs @@ -15,8 +15,7 @@ pub unsafe fn demo() -> bool { // CHECK: %0 = tail call reassoc double @llvm.vector.reduce.fadd.v8f64( // CHECK: %_0.i = fcmp uno double %0, 0.000000e+00 // CHECK: ret i1 %_0.i - let res = unsafe { - _mm512_reduce_add_pd(_mm512_set_pd(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, f64::NAN)) - }; + let res = + unsafe { _mm512_reduce_add_pd(_mm512_set_pd(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, f64::NAN)) }; res.is_nan() } diff --git a/tests/codegen/simd/swap-simd-types.rs b/tests/codegen/simd/swap-simd-types.rs index 32e75220d69..cd6e84286e1 100644 --- a/tests/codegen/simd/swap-simd-types.rs +++ b/tests/codegen/simd/swap-simd-types.rs @@ -13,18 +13,18 @@ // CHECK-LABEL: @swap_single_m256 #[no_mangle] pub fn swap_single_m256(x: &mut __m256, y: &mut __m256) { -// CHECK-NOT: alloca -// CHECK: load <8 x float>{{.+}}align 32 -// CHECK: store <8 x float>{{.+}}align 32 + // CHECK-NOT: alloca + // CHECK: load <8 x float>{{.+}}align 32 + // CHECK: store <8 x float>{{.+}}align 32 swap(x, y) } // CHECK-LABEL: @swap_m256_slice #[no_mangle] pub fn swap_m256_slice(x: &mut [__m256], y: &mut [__m256]) { -// CHECK-NOT: alloca -// CHECK: load <8 x float>{{.+}}align 32 -// CHECK: store <8 x float>{{.+}}align 32 + // CHECK-NOT: alloca + // CHECK: load <8 x float>{{.+}}align 32 + // CHECK: store <8 x float>{{.+}}align 32 if x.len() == y.len() { x.swap_with_slice(y); } @@ -33,8 +33,8 @@ pub fn swap_m256_slice(x: &mut [__m256], y: &mut [__m256]) { // CHECK-LABEL: @swap_bytes32 #[no_mangle] pub fn swap_bytes32(x: &mut [u8; 32], y: &mut [u8; 32]) { -// CHECK-NOT: alloca -// CHECK: load <32 x i8>{{.+}}align 1 -// CHECK: store <32 x i8>{{.+}}align 1 + // CHECK-NOT: alloca + // CHECK: load <32 x i8>{{.+}}align 1 + // CHECK: store <32 x i8>{{.+}}align 1 swap(x, y) } diff --git a/tests/codegen/slice-position-bounds-check.rs b/tests/codegen/slice-position-bounds-check.rs index 301895883ee..f83e2f2ec44 100644 --- a/tests/codegen/slice-position-bounds-check.rs +++ b/tests/codegen/slice-position-bounds-check.rs @@ -3,9 +3,7 @@ fn search(arr: &mut [T], a: &T) -> Result { match arr.iter().position(|x| x == a) { - Some(p) => { - Ok(p) - }, + Some(p) => Ok(p), None => Err(()), } } @@ -15,11 +13,7 @@ fn search(arr: &mut [T], a: &T) -> Result { pub fn position_no_bounds_check(y: &mut [u32], x: &u32, z: &u32) -> bool { // This contains "call assume" so we cannot just rule out all calls // CHECK-NOT: panic_bounds_check - if let Ok(p) = search(y, x) { - y[p] == *z - } else { - false - } + if let Ok(p) = search(y, x) { y[p] == *z } else { false } } // just to make sure that panicking really emits "panic_bounds_check" somewhere in the IR diff --git a/tests/codegen/slice-windows-no-bounds-check.rs b/tests/codegen/slice-windows-no-bounds-check.rs index 188011ebe7f..db3211c8def 100644 --- a/tests/codegen/slice-windows-no-bounds-check.rs +++ b/tests/codegen/slice-windows-no-bounds-check.rs @@ -12,10 +12,7 @@ pub fn naive_string_search(haystack: &str, needle: &str) -> Option { } // CHECK-NOT: panic // CHECK-NOT: fail - haystack - .as_bytes() - .windows(needle.len()) - .position(|sub| sub == needle.as_bytes()) + haystack.as_bytes().windows(needle.len()).position(|sub| sub == needle.as_bytes()) } // CHECK-LABEL: @next diff --git a/tests/codegen/some-abis-do-extend-params-to-32-bits.rs b/tests/codegen/some-abis-do-extend-params-to-32-bits.rs index a75a239e2ab..10970cacdcf 100644 --- a/tests/codegen/some-abis-do-extend-params-to-32-bits.rs +++ b/tests/codegen/some-abis-do-extend-params-to-32-bits.rs @@ -24,9 +24,12 @@ #![no_std] #![no_core] -#[lang="sized"] trait Sized { } -#[lang="freeze"] trait Freeze { } -#[lang="copy"] trait Copy { } +#[lang = "sized"] +trait Sized {} +#[lang = "freeze"] +trait Freeze {} +#[lang = "copy"] +trait Copy {} // The patterns in this file are written in the style of a table to make the // uniformities and distinctions more apparent. @@ -40,7 +43,8 @@ // aarch64-linux: void @c_arg_u8(i8 %_a) // arm: void @c_arg_u8(i8 zeroext %_a) // riscv: void @c_arg_u8(i8 zeroext %_a) -#[no_mangle] pub extern "C" fn c_arg_u8(_a: u8) { } +#[no_mangle] +pub extern "C" fn c_arg_u8(_a: u8) {} // x86_64: void @c_arg_u16(i16 zeroext %_a) // i686: void @c_arg_u16(i16 zeroext %_a) @@ -49,7 +53,8 @@ // aarch64-linux: void @c_arg_u16(i16 %_a) // arm: void @c_arg_u16(i16 zeroext %_a) // riscv: void @c_arg_u16(i16 zeroext %_a) -#[no_mangle] pub extern "C" fn c_arg_u16(_a: u16) { } +#[no_mangle] +pub extern "C" fn c_arg_u16(_a: u16) {} // x86_64: void @c_arg_u32(i32 %_a) // i686: void @c_arg_u32(i32 %_a) @@ -58,7 +63,8 @@ // aarch64-linux: void @c_arg_u32(i32 %_a) // arm: void @c_arg_u32(i32 %_a) // riscv: void @c_arg_u32(i32 signext %_a) -#[no_mangle] pub extern "C" fn c_arg_u32(_a: u32) { } +#[no_mangle] +pub extern "C" fn c_arg_u32(_a: u32) {} // x86_64: void @c_arg_u64(i64 %_a) // i686: void @c_arg_u64(i64 %_a) @@ -67,7 +73,8 @@ // aarch64-linux: void @c_arg_u64(i64 %_a) // arm: void @c_arg_u64(i64 %_a) // riscv: void @c_arg_u64(i64 %_a) -#[no_mangle] pub extern "C" fn c_arg_u64(_a: u64) { } +#[no_mangle] +pub extern "C" fn c_arg_u64(_a: u64) {} // x86_64: void @c_arg_i8(i8 signext %_a) // i686: void @c_arg_i8(i8 signext %_a) @@ -76,7 +83,8 @@ // aarch64-linux: void @c_arg_i8(i8 %_a) // arm: void @c_arg_i8(i8 signext %_a) // riscv: void @c_arg_i8(i8 signext %_a) -#[no_mangle] pub extern "C" fn c_arg_i8(_a: i8) { } +#[no_mangle] +pub extern "C" fn c_arg_i8(_a: i8) {} // x86_64: void @c_arg_i16(i16 signext %_a) // i686: void @c_arg_i16(i16 signext %_a) @@ -85,7 +93,8 @@ // aarch64-linux: void @c_arg_i16(i16 %_a) // arm: void @c_arg_i16(i16 signext %_a) // riscv: void @c_arg_i16(i16 signext %_a) -#[no_mangle] pub extern "C" fn c_arg_i16(_a: i16) { } +#[no_mangle] +pub extern "C" fn c_arg_i16(_a: i16) {} // x86_64: void @c_arg_i32(i32 %_a) // i686: void @c_arg_i32(i32 %_a) @@ -94,7 +103,8 @@ // aarch64-linux: void @c_arg_i32(i32 %_a) // arm: void @c_arg_i32(i32 %_a) // riscv: void @c_arg_i32(i32 signext %_a) -#[no_mangle] pub extern "C" fn c_arg_i32(_a: i32) { } +#[no_mangle] +pub extern "C" fn c_arg_i32(_a: i32) {} // x86_64: void @c_arg_i64(i64 %_a) // i686: void @c_arg_i64(i64 %_a) @@ -103,7 +113,8 @@ // aarch64-linux: void @c_arg_i64(i64 %_a) // arm: void @c_arg_i64(i64 %_a) // riscv: void @c_arg_i64(i64 %_a) -#[no_mangle] pub extern "C" fn c_arg_i64(_a: i64) { } +#[no_mangle] +pub extern "C" fn c_arg_i64(_a: i64) {} // x86_64: zeroext i8 @c_ret_u8() // i686: zeroext i8 @c_ret_u8() @@ -112,7 +123,10 @@ // aarch64-linux: i8 @c_ret_u8() // arm: zeroext i8 @c_ret_u8() // riscv: zeroext i8 @c_ret_u8() -#[no_mangle] pub extern "C" fn c_ret_u8() -> u8 { 0 } +#[no_mangle] +pub extern "C" fn c_ret_u8() -> u8 { + 0 +} // x86_64: zeroext i16 @c_ret_u16() // i686: zeroext i16 @c_ret_u16() @@ -121,7 +135,10 @@ // aarch64-linux: i16 @c_ret_u16() // arm: zeroext i16 @c_ret_u16() // riscv: zeroext i16 @c_ret_u16() -#[no_mangle] pub extern "C" fn c_ret_u16() -> u16 { 0 } +#[no_mangle] +pub extern "C" fn c_ret_u16() -> u16 { + 0 +} // x86_64: i32 @c_ret_u32() // i686: i32 @c_ret_u32() @@ -130,7 +147,10 @@ // aarch64-linux: i32 @c_ret_u32() // arm: i32 @c_ret_u32() // riscv: signext i32 @c_ret_u32() -#[no_mangle] pub extern "C" fn c_ret_u32() -> u32 { 0 } +#[no_mangle] +pub extern "C" fn c_ret_u32() -> u32 { + 0 +} // x86_64: i64 @c_ret_u64() // i686: i64 @c_ret_u64() @@ -139,7 +159,10 @@ // aarch64-linux: i64 @c_ret_u64() // arm: i64 @c_ret_u64() // riscv: i64 @c_ret_u64() -#[no_mangle] pub extern "C" fn c_ret_u64() -> u64 { 0 } +#[no_mangle] +pub extern "C" fn c_ret_u64() -> u64 { + 0 +} // x86_64: signext i8 @c_ret_i8() // i686: signext i8 @c_ret_i8() @@ -148,7 +171,10 @@ // aarch64-linux: i8 @c_ret_i8() // arm: signext i8 @c_ret_i8() // riscv: signext i8 @c_ret_i8() -#[no_mangle] pub extern "C" fn c_ret_i8() -> i8 { 0 } +#[no_mangle] +pub extern "C" fn c_ret_i8() -> i8 { + 0 +} // x86_64: signext i16 @c_ret_i16() // i686: signext i16 @c_ret_i16() @@ -157,7 +183,10 @@ // aarch64-linux: i16 @c_ret_i16() // arm: signext i16 @c_ret_i16() // riscv: signext i16 @c_ret_i16() -#[no_mangle] pub extern "C" fn c_ret_i16() -> i16 { 0 } +#[no_mangle] +pub extern "C" fn c_ret_i16() -> i16 { + 0 +} // x86_64: i32 @c_ret_i32() // i686: i32 @c_ret_i32() @@ -166,7 +195,10 @@ // aarch64-linux: i32 @c_ret_i32() // arm: i32 @c_ret_i32() // riscv: signext i32 @c_ret_i32() -#[no_mangle] pub extern "C" fn c_ret_i32() -> i32 { 0 } +#[no_mangle] +pub extern "C" fn c_ret_i32() -> i32 { + 0 +} // x86_64: i64 @c_ret_i64() // i686: i64 @c_ret_i64() @@ -175,7 +207,10 @@ // aarch64-linux: i64 @c_ret_i64() // arm: i64 @c_ret_i64() // riscv: i64 @c_ret_i64() -#[no_mangle] pub extern "C" fn c_ret_i64() -> i64 { 0 } +#[no_mangle] +pub extern "C" fn c_ret_i64() -> i64 { + 0 +} const C_SOURCE_FILE: &'static str = r##" #include diff --git a/tests/codegen/sparc-struct-abi.rs b/tests/codegen/sparc-struct-abi.rs index 0850e9e15ea..5d978166357 100644 --- a/tests/codegen/sparc-struct-abi.rs +++ b/tests/codegen/sparc-struct-abi.rs @@ -6,12 +6,12 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang="sized"] -trait Sized { } -#[lang="freeze"] -trait Freeze { } -#[lang="copy"] -trait Copy { } +#[lang = "sized"] +trait Sized {} +#[lang = "freeze"] +trait Freeze {} +#[lang = "copy"] +trait Copy {} #[repr(C)] pub struct Bool { @@ -26,7 +26,6 @@ pub extern "C" fn structbool() -> Bool { Bool { b: true } } - #[repr(C)] pub struct BoolFloat { b: bool, @@ -44,8 +43,7 @@ pub extern "C" fn structboolfloat() -> BoolFloat { // CHECK: define void @structboolfloat_input({ i32, float } inreg %0) // CHECK-NEXT: start: #[no_mangle] -pub extern "C" fn structboolfloat_input(a: BoolFloat) { } - +pub extern "C" fn structboolfloat_input(a: BoolFloat) {} #[repr(C)] pub struct ShortDouble { @@ -64,8 +62,7 @@ pub extern "C" fn structshortdouble() -> ShortDouble { // CHECK: define void @structshortdouble_input({ i64, double } %0) // CHECK-NEXT: start: #[no_mangle] -pub extern "C" fn structshortdouble_input(a: ShortDouble) { } - +pub extern "C" fn structshortdouble_input(a: ShortDouble) {} #[repr(C)] pub struct FloatLongFloat { diff --git a/tests/codegen/split-lto-unit.rs b/tests/codegen/split-lto-unit.rs index 6cea9a2d8d5..7858a0e7b79 100644 --- a/tests/codegen/split-lto-unit.rs +++ b/tests/codegen/split-lto-unit.rs @@ -3,9 +3,8 @@ //@ needs-sanitizer-cfi //@ compile-flags: -Clto -Ctarget-feature=-crt-static -Zsplit-lto-unit -#![crate_type="lib"] +#![crate_type = "lib"] -pub fn foo() { -} +pub fn foo() {} // CHECK: !{{[0-9]+}} = !{i32 4, !"EnableSplitLTOUnit", i32 1} diff --git a/tests/codegen/sroa-fragment-debuginfo.rs b/tests/codegen/sroa-fragment-debuginfo.rs index 670ddb56540..0413cf96894 100644 --- a/tests/codegen/sroa-fragment-debuginfo.rs +++ b/tests/codegen/sroa-fragment-debuginfo.rs @@ -13,13 +13,13 @@ pub struct ExtraSlice<'input> { #[no_mangle] pub fn extra(s: &[u8]) { -// CHECK: void @extra( -// CHECK: %slice.dbg.spill1 = alloca [4 x i8], -// CHECK: %slice.dbg.spill = alloca [16 x i8], -// CHECK: %s.dbg.spill = alloca [16 x i8], -// CHECK: dbg{{.}}declare({{(metadata )?}}ptr %s.dbg.spill, {{(metadata )?}}![[S_EXTRA:.*]], {{(metadata )?}}!DIExpression() -// CHECK: dbg{{.}}declare({{(metadata )?}}ptr %slice.dbg.spill, {{(metadata )?}}![[SLICE_EXTRA:.*]], {{(metadata )?}}!DIExpression(DW_OP_LLVM_fragment, 0, 128) -// CHECK: dbg{{.}}declare({{(metadata )?}}ptr %slice.dbg.spill1, {{(metadata )?}}![[SLICE_EXTRA]], {{(metadata )?}}!DIExpression(DW_OP_LLVM_fragment, 128, 32) + // CHECK: void @extra( + // CHECK: %slice.dbg.spill1 = alloca [4 x i8], + // CHECK: %slice.dbg.spill = alloca [16 x i8], + // CHECK: %s.dbg.spill = alloca [16 x i8], + // CHECK: dbg{{.}}declare({{(metadata )?}}ptr %s.dbg.spill, {{(metadata )?}}![[S_EXTRA:.*]], {{(metadata )?}}!DIExpression() + // CHECK: dbg{{.}}declare({{(metadata )?}}ptr %slice.dbg.spill, {{(metadata )?}}![[SLICE_EXTRA:.*]], {{(metadata )?}}!DIExpression(DW_OP_LLVM_fragment, 0, 128) + // CHECK: dbg{{.}}declare({{(metadata )?}}ptr %slice.dbg.spill1, {{(metadata )?}}![[SLICE_EXTRA]], {{(metadata )?}}!DIExpression(DW_OP_LLVM_fragment, 128, 32) let slice = ExtraSlice { slice: s, extra: s.len() as u32 }; } @@ -35,10 +35,10 @@ pub fn zst(s: &[u8]) { // The field `extra` is a ZST. The fragment for the field `slice` encompasses the whole // variable, so is not a fragment. In that case, the variable must have no fragment. -// CHECK: void @zst( -// CHECK-NOT: dbg{{.}}declare({{(metadata )?}}ptr %slice.dbg.spill, {{(metadata )?}}!{}, {{(metadata )?}}!DIExpression(DW_OP_LLVM_fragment, -// CHECK: dbg{{.}}declare({{(metadata )?}}ptr %{{.*}}, {{(metadata )?}}![[SLICE_ZST:.*]], {{(metadata )?}}!DIExpression() -// CHECK-NOT: dbg{{.}}declare({{(metadata )?}}ptr %{{.*}}, {{(metadata )?}}![[SLICE_ZST]], + // CHECK: void @zst( + // CHECK-NOT: dbg{{.}}declare({{(metadata )?}}ptr %slice.dbg.spill, {{(metadata )?}}!{}, {{(metadata )?}}!DIExpression(DW_OP_LLVM_fragment, + // CHECK: dbg{{.}}declare({{(metadata )?}}ptr %{{.*}}, {{(metadata )?}}![[SLICE_ZST:.*]], {{(metadata )?}}!DIExpression() + // CHECK-NOT: dbg{{.}}declare({{(metadata )?}}ptr %{{.*}}, {{(metadata )?}}![[SLICE_ZST]], let slice = ZstSlice { slice: s, extra: Zst }; } diff --git a/tests/codegen/stack-probes-inline.rs b/tests/codegen/stack-probes-inline.rs index 6bd6b0cb354..c5073b9cc22 100644 --- a/tests/codegen/stack-probes-inline.rs +++ b/tests/codegen/stack-probes-inline.rs @@ -27,6 +27,6 @@ trait Sized {} #[no_mangle] pub fn foo() { -// CHECK: @foo() unnamed_addr #0 -// CHECK: attributes #0 = { {{.*}}"probe-stack"="inline-asm"{{.*}} } + // CHECK: @foo() unnamed_addr #0 + // CHECK: attributes #0 = { {{.*}}"probe-stack"="inline-asm"{{.*}} } } diff --git a/tests/codegen/static-relocation-model-msvc.rs b/tests/codegen/static-relocation-model-msvc.rs index 5501827498c..8ed8331466c 100644 --- a/tests/codegen/static-relocation-model-msvc.rs +++ b/tests/codegen/static-relocation-model-msvc.rs @@ -20,7 +20,5 @@ #[no_mangle] pub fn access_extern() -> u8 { - unsafe { - extern_decl::extern_fn() + extern_decl::extern_static - } + unsafe { extern_decl::extern_fn() + extern_decl::extern_static } } diff --git a/tests/codegen/stores.rs b/tests/codegen/stores.rs index 86ec52fa101..aa3090db6d3 100644 --- a/tests/codegen/stores.rs +++ b/tests/codegen/stores.rs @@ -4,10 +4,10 @@ #![crate_type = "lib"] pub struct Bytes { - a: u8, - b: u8, - c: u8, - d: u8, + a: u8, + b: u8, + c: u8, + d: u8, } // CHECK-LABEL: small_array_alignment @@ -15,10 +15,10 @@ pub struct Bytes { // dependent alignment #[no_mangle] pub fn small_array_alignment(x: &mut [i8; 4], y: [i8; 4]) { -// CHECK: [[TMP:%.+]] = alloca [4 x i8], align 4 -// CHECK: %y = alloca [4 x i8], align 1 -// CHECK: store i32 %0, ptr [[TMP]] -// CHECK: call void @llvm.memcpy.{{.*}}(ptr align 1 {{.+}}, ptr align 4 {{.+}}, i{{[0-9]+}} 4, i1 false) + // CHECK: [[TMP:%.+]] = alloca [4 x i8], align 4 + // CHECK: %y = alloca [4 x i8], align 1 + // CHECK: store i32 %0, ptr [[TMP]] + // CHECK: call void @llvm.memcpy.{{.*}}(ptr align 1 {{.+}}, ptr align 4 {{.+}}, i{{[0-9]+}} 4, i1 false) *x = y; } @@ -27,9 +27,9 @@ pub struct Bytes { // dependent alignment #[no_mangle] pub fn small_struct_alignment(x: &mut Bytes, y: Bytes) { -// CHECK: [[TMP:%.+]] = alloca [4 x i8], align 4 -// CHECK: %y = alloca [4 x i8], align 1 -// CHECK: store i32 %0, ptr [[TMP]] -// CHECK: call void @llvm.memcpy.{{.*}}(ptr align 1 {{.+}}, ptr align 4 {{.+}}, i{{[0-9]+}} 4, i1 false) + // CHECK: [[TMP:%.+]] = alloca [4 x i8], align 4 + // CHECK: %y = alloca [4 x i8], align 1 + // CHECK: store i32 %0, ptr [[TMP]] + // CHECK: call void @llvm.memcpy.{{.*}}(ptr align 1 {{.+}}, ptr align 4 {{.+}}, i{{[0-9]+}} 4, i1 false) *x = y; } diff --git a/tests/codegen/swap-large-types.rs b/tests/codegen/swap-large-types.rs index b976f6fe207..761d48969da 100644 --- a/tests/codegen/swap-large-types.rs +++ b/tests/codegen/swap-large-types.rs @@ -4,7 +4,7 @@ #![crate_type = "lib"] use std::mem::swap; -use std::ptr::{read, copy_nonoverlapping, write}; +use std::ptr::{copy_nonoverlapping, read, write}; type KeccakBuffer = [[u64; 5]; 5]; @@ -15,7 +15,7 @@ // CHECK-LABEL: @swap_basic #[no_mangle] pub fn swap_basic(x: &mut KeccakBuffer, y: &mut KeccakBuffer) { -// CHECK: alloca [200 x i8] + // CHECK: alloca [200 x i8] // SAFETY: exclusive references are always valid to read/write, // are non-overlapping, and nothing here panics so it's drop-safe. @@ -32,9 +32,9 @@ pub fn swap_basic(x: &mut KeccakBuffer, y: &mut KeccakBuffer) { // CHECK-LABEL: @swap_std #[no_mangle] pub fn swap_std(x: &mut KeccakBuffer, y: &mut KeccakBuffer) { -// CHECK-NOT: alloca -// CHECK: load <{{[0-9]+}} x i64> -// CHECK: store <{{[0-9]+}} x i64> + // CHECK-NOT: alloca + // CHECK: load <{{[0-9]+}} x i64> + // CHECK: store <{{[0-9]+}} x i64> swap(x, y) } @@ -44,9 +44,9 @@ pub fn swap_std(x: &mut KeccakBuffer, y: &mut KeccakBuffer) { // CHECK-LABEL: @swap_slice #[no_mangle] pub fn swap_slice(x: &mut [KeccakBuffer], y: &mut [KeccakBuffer]) { -// CHECK-NOT: alloca -// CHECK: load <{{[0-9]+}} x i64> -// CHECK: store <{{[0-9]+}} x i64> + // CHECK-NOT: alloca + // CHECK: load <{{[0-9]+}} x i64> + // CHECK: store <{{[0-9]+}} x i64> if x.len() == y.len() { x.swap_with_slice(y); } @@ -59,9 +59,9 @@ pub fn swap_slice(x: &mut [KeccakBuffer], y: &mut [KeccakBuffer]) { // CHECK-LABEL: @swap_1kb_slices #[no_mangle] pub fn swap_1kb_slices(x: &mut [OneKilobyteBuffer], y: &mut [OneKilobyteBuffer]) { -// CHECK-NOT: alloca -// CHECK: load <{{[0-9]+}} x i8> -// CHECK: store <{{[0-9]+}} x i8> + // CHECK-NOT: alloca + // CHECK: load <{{[0-9]+}} x i8> + // CHECK: store <{{[0-9]+}} x i8> if x.len() == y.len() { x.swap_with_slice(y); } @@ -81,10 +81,10 @@ pub fn swap_1kb_slices(x: &mut [OneKilobyteBuffer], y: &mut [OneKilobyteBuffer]) // CHECK-LABEL: @swap_big_aligned #[no_mangle] pub fn swap_big_aligned(x: &mut BigButHighlyAligned, y: &mut BigButHighlyAligned) { -// CHECK-NOT: call void @llvm.memcpy -// CHECK: call void @llvm.memcpy.{{.+}}(ptr noundef nonnull align 64 dereferenceable(192) -// CHECK: call void @llvm.memcpy.{{.+}}(ptr noundef nonnull align 64 dereferenceable(192) -// CHECK: call void @llvm.memcpy.{{.+}}(ptr noundef nonnull align 64 dereferenceable(192) -// CHECK-NOT: call void @llvm.memcpy + // CHECK-NOT: call void @llvm.memcpy + // CHECK: call void @llvm.memcpy.{{.+}}(ptr noundef nonnull align 64 dereferenceable(192) + // CHECK: call void @llvm.memcpy.{{.+}}(ptr noundef nonnull align 64 dereferenceable(192) + // CHECK: call void @llvm.memcpy.{{.+}}(ptr noundef nonnull align 64 dereferenceable(192) + // CHECK-NOT: call void @llvm.memcpy swap(x, y) } diff --git a/tests/codegen/target-feature-overrides.rs b/tests/codegen/target-feature-overrides.rs index 61b1b3fd257..1e2c364dbbc 100644 --- a/tests/codegen/target-feature-overrides.rs +++ b/tests/codegen/target-feature-overrides.rs @@ -9,7 +9,6 @@ #![crate_type = "lib"] #![no_core] - #[lang = "sized"] trait Sized {} #[lang = "copy"] @@ -23,19 +22,19 @@ trait Copy {} #[target_feature(enable = "avx")] #[no_mangle] pub unsafe fn apple() -> u32 { -// CHECK-LABEL: @apple() -// CHECK-SAME: [[APPLEATTRS:#[0-9]+]] { -// CHECK: {{.*}}call{{.*}}@peach + // CHECK-LABEL: @apple() + // CHECK-SAME: [[APPLEATTRS:#[0-9]+]] { + // CHECK: {{.*}}call{{.*}}@peach peach() } // target features same as global #[no_mangle] pub unsafe fn banana() -> u32 { -// CHECK-LABEL: @banana() -// CHECK-SAME: [[BANANAATTRS:#[0-9]+]] { -// COMPAT: {{.*}}call{{.*}}@peach -// INCOMPAT: {{.*}}call{{.*}}@apple + // CHECK-LABEL: @banana() + // CHECK-SAME: [[BANANAATTRS:#[0-9]+]] { + // COMPAT: {{.*}}call{{.*}}@peach + // INCOMPAT: {{.*}}call{{.*}}@apple apple() // Compatible for inline in COMPAT revision and can't be inlined in INCOMPAT } diff --git a/tests/codegen/thin-lto.rs b/tests/codegen/thin-lto.rs index c75f9841a77..4339d20532e 100644 --- a/tests/codegen/thin-lto.rs +++ b/tests/codegen/thin-lto.rs @@ -3,5 +3,4 @@ // CHECK: main -pub fn main() { -} +pub fn main() {} diff --git a/tests/codegen/tied-features-strength.rs b/tests/codegen/tied-features-strength.rs index b97865295a2..7f0805bc1b4 100644 --- a/tests/codegen/tied-features-strength.rs +++ b/tests/codegen/tied-features-strength.rs @@ -19,7 +19,6 @@ //@ [ENABLE_NEON] compile-flags: -C target-feature=+neon -Copt-level=0 // ENABLE_NEON: attributes #0 = { {{.*}} "target-features"="{{((\+outline-atomics,?)|(\+v8a,?)?|(\+fp-armv8,?)|(\+neon,?))*}}" } - #![feature(no_core, lang_items)] #![no_core] diff --git a/tests/codegen/to_vec.rs b/tests/codegen/to_vec.rs index 651084d811c..4666f8d6f15 100644 --- a/tests/codegen/to_vec.rs +++ b/tests/codegen/to_vec.rs @@ -5,6 +5,6 @@ // CHECK-LABEL: @copy_to_vec #[no_mangle] fn copy_to_vec(s: &[u64]) -> Vec { - s.to_vec() - // CHECK: call void @llvm.memcpy + s.to_vec() + // CHECK: call void @llvm.memcpy } diff --git a/tests/codegen/transmute-optimized.rs b/tests/codegen/transmute-optimized.rs index 8e5bcb2340e..11bd0523788 100644 --- a/tests/codegen/transmute-optimized.rs +++ b/tests/codegen/transmute-optimized.rs @@ -5,7 +5,9 @@ // destination types for transmutes. #[repr(u32)] -pub enum AlwaysZero32 { X = 0 } +pub enum AlwaysZero32 { + X = 0, +} // CHECK-LABEL: i32 @issue_109958(i32 #[no_mangle] @@ -81,7 +83,11 @@ pub fn div_transmute_nonzero(a: u32, b: std::num::NonZero) -> u32 { } #[repr(i8)] -pub enum OneTwoThree { One = 1, Two = 2, Three = 3 } +pub enum OneTwoThree { + One = 1, + Two = 2, + Three = 3, +} // CHECK-LABEL: i8 @ordering_transmute_onetwothree(i8 #[no_mangle] diff --git a/tests/codegen/try_identity.rs b/tests/codegen/try_identity.rs index 87b7d0727d0..6a3a8a06e82 100644 --- a/tests/codegen/try_identity.rs +++ b/tests/codegen/try_identity.rs @@ -13,9 +13,9 @@ // optimization that picks up the `?` desugaring, as `SimplifyArmIdentity` does not. #[no_mangle] pub fn try_identity(x: R) -> R { -// CHECK: start: -// FIXME(JakobDegen): Broken by deaggregation change CHECK-NOT\: br {{.*}} -// CHECK ret void + // CHECK: start: + // FIXME(JakobDegen): Broken by deaggregation change CHECK-NOT\: br {{.*}} + // CHECK ret void let y = match into_result(x) { Err(e) => return from_error(From::from(e)), Ok(v) => v, diff --git a/tests/codegen/try_question_mark_nop.rs b/tests/codegen/try_question_mark_nop.rs index f6cdf955209..c23f41f5467 100644 --- a/tests/codegen/try_question_mark_nop.rs +++ b/tests/codegen/try_question_mark_nop.rs @@ -4,7 +4,7 @@ #![crate_type = "lib"] #![feature(try_blocks)] -use std::ops::ControlFlow::{self, Continue, Break}; +use std::ops::ControlFlow::{self, Break, Continue}; use std::ptr::NonNull; // CHECK-LABEL: @option_nop_match_32 @@ -27,9 +27,7 @@ pub fn option_nop_traits_32(x: Option) -> Option { // CHECK-NEXT: insertvalue { i32, i32 } // CHECK-NEXT: insertvalue { i32, i32 } // CHECK-NEXT: ret { i32, i32 } - try { - x? - } + try { x? } } // CHECK-LABEL: @result_nop_match_32 @@ -52,9 +50,7 @@ pub fn result_nop_traits_32(x: Result) -> Result { // CHECK-NEXT: insertvalue { i32, i32 } // CHECK-NEXT: insertvalue { i32, i32 } // CHECK-NEXT: ret { i32, i32 } - try { - x? - } + try { x? } } // CHECK-LABEL: @result_nop_match_64 @@ -77,9 +73,7 @@ pub fn result_nop_traits_64(x: Result) -> Result { // CHECK-NEXT: insertvalue { i64, i64 } // CHECK-NEXT: insertvalue { i64, i64 } // CHECK-NEXT: ret { i64, i64 } - try { - x? - } + try { x? } } // CHECK-LABEL: @result_nop_match_ptr @@ -102,9 +96,7 @@ pub fn result_nop_traits_ptr(x: Result>) -> Result) -> ControlFlow ScalarZstLast { loop {} } +pub fn test_ScalarZstLast(_: ScalarZstLast) -> ScalarZstLast { + loop {} +} type ScalarZstFirst = ((), u128); // CHECK: define {{(dso_local )?}}i128 @test_ScalarZstFirst(i128 %_1) #[no_mangle] -pub fn test_ScalarZstFirst(_: ScalarZstFirst) -> ScalarZstFirst { loop {} } +pub fn test_ScalarZstFirst(_: ScalarZstFirst) -> ScalarZstFirst { + loop {} +} type ScalarPairZstLast = (u8, u128, ()); // CHECK: define {{(dso_local )?}}{ i128, i8 } @test_ScalarPairZstLast(i128 %_1.0, i8 %_1.1) #[no_mangle] -pub fn test_ScalarPairZstLast(_: ScalarPairZstLast) -> ScalarPairZstLast { loop {} } +pub fn test_ScalarPairZstLast(_: ScalarPairZstLast) -> ScalarPairZstLast { + loop {} +} type ScalarPairZstFirst = ((), u8, u128); // CHECK: define {{(dso_local )?}}{ i8, i128 } @test_ScalarPairZstFirst(i8 %_1.0, i128 %_1.1) #[no_mangle] -pub fn test_ScalarPairZstFirst(_: ScalarPairZstFirst) -> ScalarPairZstFirst { loop {} } +pub fn test_ScalarPairZstFirst(_: ScalarPairZstFirst) -> ScalarPairZstFirst { + loop {} +} type ScalarPairLotsOfZsts = ((), u8, (), u128, ()); // CHECK: define {{(dso_local )?}}{ i128, i8 } @test_ScalarPairLotsOfZsts(i128 %_1.0, i8 %_1.1) #[no_mangle] -pub fn test_ScalarPairLotsOfZsts(_: ScalarPairLotsOfZsts) -> ScalarPairLotsOfZsts { loop {} } +pub fn test_ScalarPairLotsOfZsts(_: ScalarPairLotsOfZsts) -> ScalarPairLotsOfZsts { + loop {} +} type ScalarPairLottaNesting = (((), ((), u8, (), u128, ())), ()); // CHECK: define {{(dso_local )?}}{ i128, i8 } @test_ScalarPairLottaNesting(i128 %_1.0, i8 %_1.1) #[no_mangle] -pub fn test_ScalarPairLottaNesting(_: ScalarPairLottaNesting) -> ScalarPairLottaNesting { loop {} } +pub fn test_ScalarPairLottaNesting(_: ScalarPairLottaNesting) -> ScalarPairLottaNesting { + loop {} +} diff --git a/tests/codegen/union-abi.rs b/tests/codegen/union-abi.rs index b1b0daa13b6..9e02fa9ff35 100644 --- a/tests/codegen/union-abi.rs +++ b/tests/codegen/union-abi.rs @@ -4,7 +4,7 @@ // This test that using union forward the abi of the inner type, as // discussed in #54668 -#![crate_type="lib"] +#![crate_type = "lib"] #![feature(repr_simd)] #[derive(Copy, Clone)] @@ -15,62 +15,111 @@ pub enum Unhab {} pub struct i64x4(i64, i64, i64, i64); #[derive(Copy, Clone)] -pub union UnionI64x4{ a:(), b: i64x4 } +pub union UnionI64x4 { + a: (), + b: i64x4, +} // CHECK: define {{(dso_local )?}}void @test_UnionI64x4(ptr {{.*}} %_1) #[no_mangle] -pub fn test_UnionI64x4(_: UnionI64x4) { loop {} } +pub fn test_UnionI64x4(_: UnionI64x4) { + loop {} +} -pub union UnionI64x4_{ a: i64x4, b: (), c:i64x4, d: Unhab, e: ((),()), f: UnionI64x4 } +pub union UnionI64x4_ { + a: i64x4, + b: (), + c: i64x4, + d: Unhab, + e: ((), ()), + f: UnionI64x4, +} // CHECK: define {{(dso_local )?}}void @test_UnionI64x4_(ptr {{.*}} %_1) #[no_mangle] -pub fn test_UnionI64x4_(_: UnionI64x4_) { loop {} } +pub fn test_UnionI64x4_(_: UnionI64x4_) { + loop {} +} -pub union UnionI64x4I64{ a: i64x4, b: i64 } +pub union UnionI64x4I64 { + a: i64x4, + b: i64, +} // CHECK: define {{(dso_local )?}}void @test_UnionI64x4I64(ptr {{.*}} %_1) #[no_mangle] -pub fn test_UnionI64x4I64(_: UnionI64x4I64) { loop {} } +pub fn test_UnionI64x4I64(_: UnionI64x4I64) { + loop {} +} -pub union UnionI64x4Tuple{ a: i64x4, b: (i64, i64, i64, i64) } +pub union UnionI64x4Tuple { + a: i64x4, + b: (i64, i64, i64, i64), +} // CHECK: define {{(dso_local )?}}void @test_UnionI64x4Tuple(ptr {{.*}} %_1) #[no_mangle] -pub fn test_UnionI64x4Tuple(_: UnionI64x4Tuple) { loop {} } +pub fn test_UnionI64x4Tuple(_: UnionI64x4Tuple) { + loop {} +} - -pub union UnionF32{a:f32} +pub union UnionF32 { + a: f32, +} // CHECK: define {{(dso_local )?}}float @test_UnionF32(float %_1) #[no_mangle] -pub fn test_UnionF32(_: UnionF32) -> UnionF32 { loop {} } +pub fn test_UnionF32(_: UnionF32) -> UnionF32 { + loop {} +} -pub union UnionF32F32{a:f32, b:f32} +pub union UnionF32F32 { + a: f32, + b: f32, +} // CHECK: define {{(dso_local )?}}float @test_UnionF32F32(float %_1) #[no_mangle] -pub fn test_UnionF32F32(_: UnionF32F32) -> UnionF32F32 { loop {} } +pub fn test_UnionF32F32(_: UnionF32F32) -> UnionF32F32 { + loop {} +} -pub union UnionF32U32{a:f32, b:u32} +pub union UnionF32U32 { + a: f32, + b: u32, +} // CHECK: define {{(dso_local )?}}i32 @test_UnionF32U32(i32{{( %0)?}}) #[no_mangle] -pub fn test_UnionF32U32(_: UnionF32U32) -> UnionF32U32 { loop {} } +pub fn test_UnionF32U32(_: UnionF32U32) -> UnionF32U32 { + loop {} +} -pub union UnionU128{a:u128} +pub union UnionU128 { + a: u128, +} // CHECK: define {{(dso_local )?}}i128 @test_UnionU128(i128 %_1) #[no_mangle] -pub fn test_UnionU128(_: UnionU128) -> UnionU128 { loop {} } +pub fn test_UnionU128(_: UnionU128) -> UnionU128 { + loop {} +} #[repr(C)] -pub union CUnionU128{a:u128} +pub union CUnionU128 { + a: u128, +} // CHECK: define {{(dso_local )?}}void @test_CUnionU128(ptr {{.*}} %_1) #[no_mangle] -pub fn test_CUnionU128(_: CUnionU128) { loop {} } +pub fn test_CUnionU128(_: CUnionU128) { + loop {} +} -pub union UnionBool { b:bool } +pub union UnionBool { + b: bool, +} // CHECK: define {{(dso_local )?}}noundef zeroext i1 @test_UnionBool(i8 %b) #[no_mangle] -pub fn test_UnionBool(b: UnionBool) -> bool { unsafe { b.b } } +pub fn test_UnionBool(b: UnionBool) -> bool { + unsafe { b.b } +} // CHECK: %_0 = trunc i8 %b to i1 diff --git a/tests/codegen/unwind-abis/aapcs-unwind-abi.rs b/tests/codegen/unwind-abis/aapcs-unwind-abi.rs index 484af78105f..48c7ecf7824 100644 --- a/tests/codegen/unwind-abis/aapcs-unwind-abi.rs +++ b/tests/codegen/unwind-abis/aapcs-unwind-abi.rs @@ -2,8 +2,8 @@ //@ compile-flags: --target=armv7-unknown-linux-gnueabihf --crate-type=rlib -Cno-prepopulate-passes #![no_core] #![feature(no_core, lang_items, c_unwind)] -#[lang="sized"] -trait Sized { } +#[lang = "sized"] +trait Sized {} // Test that `nounwind` attributes are correctly applied to exported `aapcs` and // `aapcs-unwind` extern functions. `aapcs-unwind` functions MUST NOT have this attribute. We @@ -11,13 +11,11 @@ trait Sized { } // CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 { #[no_mangle] -pub extern "aapcs" fn rust_item_that_cannot_unwind() { -} +pub extern "aapcs" fn rust_item_that_cannot_unwind() {} // CHECK: @rust_item_that_can_unwind() unnamed_addr #1 { #[no_mangle] -pub extern "aapcs-unwind" fn rust_item_that_can_unwind() { -} +pub extern "aapcs-unwind" fn rust_item_that_can_unwind() {} // Now, make some assertions that the LLVM attributes for these functions are correct. First, make // sure that the first item is correctly marked with the `nounwind` attribute: diff --git a/tests/codegen/unwind-abis/c-unwind-abi.rs b/tests/codegen/unwind-abis/c-unwind-abi.rs index 140c18e6bb3..99763943a6a 100644 --- a/tests/codegen/unwind-abis/c-unwind-abi.rs +++ b/tests/codegen/unwind-abis/c-unwind-abi.rs @@ -10,13 +10,11 @@ // CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 { #[no_mangle] -pub extern "C" fn rust_item_that_cannot_unwind() { -} +pub extern "C" fn rust_item_that_cannot_unwind() {} // CHECK: @rust_item_that_can_unwind() unnamed_addr #1 { #[no_mangle] -pub extern "C-unwind" fn rust_item_that_can_unwind() { -} +pub extern "C-unwind" fn rust_item_that_can_unwind() {} // Now, make some assertions that the LLVM attributes for these functions are correct. First, make // sure that the first item is correctly marked with the `nounwind` attribute: diff --git a/tests/codegen/unwind-abis/cdecl-unwind-abi.rs b/tests/codegen/unwind-abis/cdecl-unwind-abi.rs index 5604b8d5765..78dbb55b35a 100644 --- a/tests/codegen/unwind-abis/cdecl-unwind-abi.rs +++ b/tests/codegen/unwind-abis/cdecl-unwind-abi.rs @@ -10,13 +10,11 @@ // CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 { #[no_mangle] -pub extern "cdecl" fn rust_item_that_cannot_unwind() { -} +pub extern "cdecl" fn rust_item_that_cannot_unwind() {} // CHECK: @rust_item_that_can_unwind() unnamed_addr #1 { #[no_mangle] -pub extern "cdecl-unwind" fn rust_item_that_can_unwind() { -} +pub extern "cdecl-unwind" fn rust_item_that_can_unwind() {} // Now, make some assertions that the LLVM attributes for these functions are correct. First, make // sure that the first item is correctly marked with the `nounwind` attribute: diff --git a/tests/codegen/unwind-abis/fastcall-unwind-abi.rs b/tests/codegen/unwind-abis/fastcall-unwind-abi.rs index 18e2cd22c8a..3cbeaf51d96 100644 --- a/tests/codegen/unwind-abis/fastcall-unwind-abi.rs +++ b/tests/codegen/unwind-abis/fastcall-unwind-abi.rs @@ -2,8 +2,8 @@ //@ compile-flags: --target=i686-pc-windows-msvc --crate-type=rlib -Cno-prepopulate-passes #![no_core] #![feature(no_core, lang_items, c_unwind)] -#[lang="sized"] -trait Sized { } +#[lang = "sized"] +trait Sized {} // Test that `nounwind` attributes are correctly applied to exported `fastcall` and // `fastcall-unwind` extern functions. `fastcall-unwind` functions MUST NOT have this attribute. We @@ -11,13 +11,11 @@ trait Sized { } // CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 { #[no_mangle] -pub extern "fastcall" fn rust_item_that_cannot_unwind() { -} +pub extern "fastcall" fn rust_item_that_cannot_unwind() {} // CHECK: @rust_item_that_can_unwind() unnamed_addr #1 { #[no_mangle] -pub extern "fastcall-unwind" fn rust_item_that_can_unwind() { -} +pub extern "fastcall-unwind" fn rust_item_that_can_unwind() {} // Now, make some assertions that the LLVM attributes for these functions are correct. First, make // sure that the first item is correctly marked with the `nounwind` attribute: diff --git a/tests/codegen/unwind-abis/stdcall-unwind-abi.rs b/tests/codegen/unwind-abis/stdcall-unwind-abi.rs index a5e600fe076..ffb235cd116 100644 --- a/tests/codegen/unwind-abis/stdcall-unwind-abi.rs +++ b/tests/codegen/unwind-abis/stdcall-unwind-abi.rs @@ -2,8 +2,8 @@ //@ compile-flags: --target=i686-pc-windows-msvc --crate-type=rlib -Cno-prepopulate-passes #![no_core] #![feature(no_core, lang_items, c_unwind)] -#[lang="sized"] -trait Sized { } +#[lang = "sized"] +trait Sized {} // Test that `nounwind` attributes are correctly applied to exported `stdcall` and `stdcall-unwind` // extern functions. `stdcall-unwind` functions MUST NOT have this attribute. We disable @@ -11,13 +11,11 @@ trait Sized { } // CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 { #[no_mangle] -pub extern "stdcall" fn rust_item_that_cannot_unwind() { -} +pub extern "stdcall" fn rust_item_that_cannot_unwind() {} // CHECK: @rust_item_that_can_unwind() unnamed_addr #1 { #[no_mangle] -pub extern "stdcall-unwind" fn rust_item_that_can_unwind() { -} +pub extern "stdcall-unwind" fn rust_item_that_can_unwind() {} // Now, make some assertions that the LLVM attributes for these functions are correct. First, make // sure that the first item is correctly marked with the `nounwind` attribute: diff --git a/tests/codegen/unwind-abis/system-unwind-abi.rs b/tests/codegen/unwind-abis/system-unwind-abi.rs index b001c1f951c..1dd0e9bbbec 100644 --- a/tests/codegen/unwind-abis/system-unwind-abi.rs +++ b/tests/codegen/unwind-abis/system-unwind-abi.rs @@ -10,13 +10,11 @@ // CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 { #[no_mangle] -pub extern "system" fn rust_item_that_cannot_unwind() { -} +pub extern "system" fn rust_item_that_cannot_unwind() {} // CHECK: @rust_item_that_can_unwind() unnamed_addr #1 { #[no_mangle] -pub extern "system-unwind" fn rust_item_that_can_unwind() { -} +pub extern "system-unwind" fn rust_item_that_can_unwind() {} // Now, make some assertions that the LLVM attributes for these functions are correct. First, make // sure that the first item is correctly marked with the `nounwind` attribute: diff --git a/tests/codegen/unwind-abis/sysv64-unwind-abi.rs b/tests/codegen/unwind-abis/sysv64-unwind-abi.rs index 49407f748bc..9824009dc55 100644 --- a/tests/codegen/unwind-abis/sysv64-unwind-abi.rs +++ b/tests/codegen/unwind-abis/sysv64-unwind-abi.rs @@ -2,8 +2,8 @@ //@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=rlib -Cno-prepopulate-passes #![no_core] #![feature(no_core, lang_items, c_unwind)] -#[lang="sized"] -trait Sized { } +#[lang = "sized"] +trait Sized {} // Test that `nounwind` attributes are correctly applied to exported `sysv64` and // `sysv64-unwind` extern functions. `sysv64-unwind` functions MUST NOT have this attribute. We @@ -11,13 +11,11 @@ trait Sized { } // CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 { #[no_mangle] -pub extern "sysv64" fn rust_item_that_cannot_unwind() { -} +pub extern "sysv64" fn rust_item_that_cannot_unwind() {} // CHECK: @rust_item_that_can_unwind() unnamed_addr #1 { #[no_mangle] -pub extern "sysv64-unwind" fn rust_item_that_can_unwind() { -} +pub extern "sysv64-unwind" fn rust_item_that_can_unwind() {} // Now, make some assertions that the LLVM attributes for these functions are correct. First, make // sure that the first item is correctly marked with the `nounwind` attribute: diff --git a/tests/codegen/unwind-abis/thiscall-unwind-abi.rs b/tests/codegen/unwind-abis/thiscall-unwind-abi.rs index d07e9b81d78..a96f4d5a350 100644 --- a/tests/codegen/unwind-abis/thiscall-unwind-abi.rs +++ b/tests/codegen/unwind-abis/thiscall-unwind-abi.rs @@ -2,8 +2,8 @@ //@ compile-flags: --target=i686-pc-windows-msvc --crate-type=rlib -Cno-prepopulate-passes #![no_core] #![feature(no_core, lang_items, c_unwind)] -#[lang="sized"] -trait Sized { } +#[lang = "sized"] +trait Sized {} // Test that `nounwind` attributes are correctly applied to exported `thiscall` and // `thiscall-unwind` extern functions. `thiscall-unwind` functions MUST NOT have this attribute. We @@ -11,13 +11,11 @@ trait Sized { } // CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 { #[no_mangle] -pub extern "thiscall" fn rust_item_that_cannot_unwind() { -} +pub extern "thiscall" fn rust_item_that_cannot_unwind() {} // CHECK: @rust_item_that_can_unwind() unnamed_addr #1 { #[no_mangle] -pub extern "thiscall-unwind" fn rust_item_that_can_unwind() { -} +pub extern "thiscall-unwind" fn rust_item_that_can_unwind() {} // Now, make some assertions that the LLVM attributes for these functions are correct. First, make // sure that the first item is correctly marked with the `nounwind` attribute: diff --git a/tests/codegen/unwind-abis/vectorcall-unwind-abi.rs b/tests/codegen/unwind-abis/vectorcall-unwind-abi.rs index a89794fbf6e..9929e3e3703 100644 --- a/tests/codegen/unwind-abis/vectorcall-unwind-abi.rs +++ b/tests/codegen/unwind-abis/vectorcall-unwind-abi.rs @@ -2,8 +2,8 @@ //@ compile-flags: --target=i686-pc-windows-msvc --crate-type=rlib -Cno-prepopulate-passes #![no_core] #![feature(no_core, lang_items, c_unwind, abi_vectorcall)] -#[lang="sized"] -trait Sized { } +#[lang = "sized"] +trait Sized {} // Test that `nounwind` attributes are correctly applied to exported `vectorcall` and // `vectorcall-unwind` extern functions. `vectorcall-unwind` functions MUST NOT have this attribute. @@ -11,13 +11,11 @@ trait Sized { } // CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 { #[no_mangle] -pub extern "vectorcall" fn rust_item_that_cannot_unwind() { -} +pub extern "vectorcall" fn rust_item_that_cannot_unwind() {} // CHECK: @rust_item_that_can_unwind() unnamed_addr #1 { #[no_mangle] -pub extern "vectorcall-unwind" fn rust_item_that_can_unwind() { -} +pub extern "vectorcall-unwind" fn rust_item_that_can_unwind() {} // Now, make some assertions that the LLVM attributes for these functions are correct. First, make // sure that the first item is correctly marked with the `nounwind` attribute: diff --git a/tests/codegen/unwind-abis/win64-unwind-abi.rs b/tests/codegen/unwind-abis/win64-unwind-abi.rs index aa466469c4d..a45a94f628d 100644 --- a/tests/codegen/unwind-abis/win64-unwind-abi.rs +++ b/tests/codegen/unwind-abis/win64-unwind-abi.rs @@ -2,8 +2,8 @@ //@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=rlib -Cno-prepopulate-passes #![no_core] #![feature(no_core, lang_items, c_unwind)] -#[lang="sized"] -trait Sized { } +#[lang = "sized"] +trait Sized {} // Test that `nounwind` attributes are correctly applied to exported `win64` and // `win64-unwind` extern functions. `win64-unwind` functions MUST NOT have this attribute. We @@ -11,13 +11,11 @@ trait Sized { } // CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 { #[no_mangle] -pub extern "win64" fn rust_item_that_cannot_unwind() { -} +pub extern "win64" fn rust_item_that_cannot_unwind() {} // CHECK: @rust_item_that_can_unwind() unnamed_addr #1 { #[no_mangle] -pub extern "win64-unwind" fn rust_item_that_can_unwind() { -} +pub extern "win64-unwind" fn rust_item_that_can_unwind() {} // Now, make some assertions that the LLVM attributes for these functions are correct. First, make // sure that the first item is correctly marked with the `nounwind` attribute: diff --git a/tests/codegen/vec-iter-collect-len.rs b/tests/codegen/vec-iter-collect-len.rs index e4242c57402..8c5d2f6f9a7 100644 --- a/tests/codegen/vec-iter-collect-len.rs +++ b/tests/codegen/vec-iter-collect-len.rs @@ -1,5 +1,5 @@ //@ compile-flags: -O -#![crate_type="lib"] +#![crate_type = "lib"] #[no_mangle] pub fn get_len() -> usize { diff --git a/tests/codegen/vtable-upcast.rs b/tests/codegen/vtable-upcast.rs index 41a4be26cb4..ae7b4bf7aee 100644 --- a/tests/codegen/vtable-upcast.rs +++ b/tests/codegen/vtable-upcast.rs @@ -8,15 +8,15 @@ pub trait Base { fn base(&self); } -pub trait A : Base { +pub trait A: Base { fn a(&self); } -pub trait B : Base { +pub trait B: Base { fn b(&self); } -pub trait Diamond : A + B { +pub trait Diamond: A + B { fn diamond(&self); } diff --git a/tests/codegen/wasm_exceptions.rs b/tests/codegen/wasm_exceptions.rs index a53722f834c..3910850e03a 100644 --- a/tests/codegen/wasm_exceptions.rs +++ b/tests/codegen/wasm_exceptions.rs @@ -5,7 +5,7 @@ #![feature(core_intrinsics)] #![feature(rustc_attrs)] -extern { +extern "C" { fn may_panic(); #[rustc_nounwind] @@ -16,7 +16,9 @@ impl Drop for LogOnDrop { fn drop(&mut self) { - unsafe { log_number(0); } + unsafe { + log_number(0); + } } } @@ -24,7 +26,9 @@ fn drop(&mut self) { #[no_mangle] pub fn test_cleanup() { let _log_on_drop = LogOnDrop; - unsafe { may_panic(); } + unsafe { + may_panic(); + } // CHECK-NOT: call // CHECK: invoke void @may_panic() @@ -35,12 +39,16 @@ pub fn test_cleanup() { #[no_mangle] pub fn test_rtry() { unsafe { - core::intrinsics::catch_unwind(|_| { - may_panic(); - }, core::ptr::null_mut(), |data, exception| { - log_number(data as usize); - log_number(exception as usize); - }); + core::intrinsics::catch_unwind( + |_| { + may_panic(); + }, + core::ptr::null_mut(), + |data, exception| { + log_number(data as usize); + log_number(exception as usize); + }, + ); } // CHECK-NOT: call diff --git a/tests/codegen/zip.rs b/tests/codegen/zip.rs index 5db0a93b78e..ea8caba61f3 100644 --- a/tests/codegen/zip.rs +++ b/tests/codegen/zip.rs @@ -5,7 +5,7 @@ // CHECK-LABEL: @zip_copy #[no_mangle] pub fn zip_copy(xs: &[u8], ys: &mut [u8]) { -// CHECK: memcpy + // CHECK: memcpy for (x, y) in xs.iter().zip(ys) { *y = *x; } @@ -14,7 +14,7 @@ pub fn zip_copy(xs: &[u8], ys: &mut [u8]) { // CHECK-LABEL: @zip_copy_mapped #[no_mangle] pub fn zip_copy_mapped(xs: &[u8], ys: &mut [u8]) { -// CHECK: memcpy + // CHECK: memcpy for (x, y) in xs.iter().map(|&x| x).zip(ys) { *y = x; } diff --git a/tests/codegen/zst-offset.rs b/tests/codegen/zst-offset.rs index b623d492d9d..14e97fd26dd 100644 --- a/tests/codegen/zst-offset.rs +++ b/tests/codegen/zst-offset.rs @@ -6,14 +6,13 @@ // Hack to get the correct size for the length part in slices // CHECK: @helper([[USIZE:i[0-9]+]] %_1) #[no_mangle] -pub fn helper(_: usize) { -} +pub fn helper(_: usize) {} // Check that we correctly generate a GEP for a ZST that is not included in Scalar layout // CHECK-LABEL: @scalar_layout #[no_mangle] pub fn scalar_layout(s: &(u64, ())) { -// CHECK: getelementptr inbounds i8, {{.+}}, [[USIZE]] 8 + // CHECK: getelementptr inbounds i8, {{.+}}, [[USIZE]] 8 let x = &s.1; witness(&x); // keep variable in an alloca } @@ -22,7 +21,7 @@ pub fn scalar_layout(s: &(u64, ())) { // CHECK-LABEL: @scalarpair_layout #[no_mangle] pub fn scalarpair_layout(s: &(u64, u32, ())) { -// CHECK: getelementptr inbounds i8, {{.+}}, [[USIZE]] 12 + // CHECK: getelementptr inbounds i8, {{.+}}, [[USIZE]] 12 let x = &s.2; witness(&x); // keep variable in an alloca } @@ -34,7 +33,7 @@ pub fn scalarpair_layout(s: &(u64, u32, ())) { // CHECK-LABEL: @vector_layout #[no_mangle] pub fn vector_layout(s: &(U64x4, ())) { -// CHECK: getelementptr inbounds i8, {{.+}}, [[USIZE]] 32 + // CHECK: getelementptr inbounds i8, {{.+}}, [[USIZE]] 32 let x = &s.1; witness(&x); // keep variable in an alloca }