| author | bors <bors@rust-lang.org> 2024-05-31 12:18:57 UTC |
| committer | bors <bors@rust-lang.org> 2024-05-31 12:18:57 UTC |
| log | 2a2c29aafa50bf6fe53d66b32070eba59f860ac3 |
| tree | 278b17527f858913de99475f1d9ecdc41d297f89 |
| parent | 99cb42c29641aee2cce6521e07960d4de93205c8 |
| parent | 0ea498aa9fc7ddf696d53fe961d30e63e4d38438 |
Format some tests
There are more directories under `tests/` still to do, but this is enough for one PR.
r? `@GuillaumeGomez`391 files changed, 2150 insertions(+), 2020 deletions(-)
rustfmt.toml+21-3| ... | ... | @@ -10,9 +10,27 @@ ignore = [ |
| 10 | 10 | "/build-*/", |
| 11 | 11 | "/vendor/", |
| 12 | 12 | |
| 13 | # Tests for now are not formatted, as they are sometimes pretty-printing constrained | |
| 14 | # (and generally rustfmt can move around comments in UI-testing incompatible ways). | |
| 15 | "/tests/", | |
| 13 | # Some tests are not formatted, for multiple reasons: | |
| 14 | # - some contain syntax errors that cause rustfmt to give an error | |
| 15 | # - some UI tests are broken by different formatting | |
| 16 | # - some require special comments in a particular position (e.g. `EMIT_MIR` comments) | |
| 17 | "/tests/codegen/simd-intrinsic/", # Many types like `u8x64` are better hand-formatted. | |
| 18 | "/tests/crashes/", # Many tests contain syntax errors. | |
| 19 | "/tests/debuginfo/", # Tests are somewhat sensitive to source code layout. | |
| 20 | "/tests/incremental/", # Tests are somewhat sensitive to source code layout. | |
| 21 | "/tests/mir-opt/", | |
| 22 | "/tests/pretty/", | |
| 23 | "/tests/run-make/translation/test.rs", # Contains syntax errors. | |
| 24 | "/tests/run-make-fulldeps/", | |
| 25 | "/tests/run-pass-valgrind/", | |
| 26 | "/tests/rustdoc/", | |
| 27 | "/tests/rustdoc-gui/", | |
| 28 | "/tests/rustdoc-js/", | |
| 29 | "/tests/rustdoc-json/", | |
| 30 | "/tests/rustdoc-js-std/", | |
| 31 | "/tests/rustdoc-ui/", | |
| 32 | "/tests/ui/", | |
| 33 | "/tests/ui-fulldeps/", | |
| 16 | 34 | |
| 17 | 35 | # Do not format submodules. |
| 18 | 36 | # FIXME: sync submodule list with tidy/bootstrap/etc |
tests/assembly/align_offset.rs+1-1| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | //@ assembly-output: emit-asm |
| 2 | 2 | //@ compile-flags: -Copt-level=1 |
| 3 | 3 | //@ only-x86_64 |
| 4 | #![crate_type="rlib"] | |
| 4 | #![crate_type = "rlib"] | |
| 5 | 5 | |
| 6 | 6 | // CHECK-LABEL: align_offset_byte_ptr |
| 7 | 7 | // CHECK: leaq 31 |
tests/assembly/asm/inline-asm-avx.rs+1-1| ... | ... | @@ -5,8 +5,8 @@ |
| 5 | 5 | |
| 6 | 6 | #![feature(portable_simd)] |
| 7 | 7 | |
| 8 | use std::simd::Simd; | |
| 9 | 8 | use std::arch::asm; |
| 9 | use std::simd::Simd; | |
| 10 | 10 | |
| 11 | 11 | #[target_feature(enable = "avx")] |
| 12 | 12 | #[no_mangle] |
tests/assembly/closure-inherit-target-feature.rs+6-7| ... | ... | @@ -18,7 +18,8 @@ pub unsafe fn sse41_blend_nofeature(x: __m128, y: __m128) -> __m128 { |
| 18 | 18 | // CHECK: {{call .*_mm_blend_ps.*}} |
| 19 | 19 | // CHECK-NOT: blendps |
| 20 | 20 | // CHECK: ret |
| 21 | #[inline(never)] |x, y| _mm_blend_ps(x, y, 0b0101) | |
| 21 | #[inline(never)] | |
| 22 | |x, y| _mm_blend_ps(x, y, 0b0101) | |
| 22 | 23 | }; |
| 23 | 24 | f(x, y) |
| 24 | 25 | } |
| ... | ... | @@ -33,9 +34,8 @@ pub fn sse41_blend_noinline(x: __m128, y: __m128) -> __m128 { |
| 33 | 34 | // CHECK: blendps |
| 34 | 35 | // CHECK-NOT: _mm_blend_ps |
| 35 | 36 | // CHECK: ret |
| 36 | #[inline(never)] |x, y| unsafe { | |
| 37 | _mm_blend_ps(x, y, 0b0101) | |
| 38 | } | |
| 37 | #[inline(never)] | |
| 38 | |x, y| unsafe { _mm_blend_ps(x, y, 0b0101) } | |
| 39 | 39 | }; |
| 40 | 40 | f(x, y) |
| 41 | 41 | } |
| ... | ... | @@ -52,9 +52,8 @@ pub fn sse41_blend_doinline(x: __m128, y: __m128) -> __m128 { |
| 52 | 52 | // CHECK-NOT: _mm_blend_ps |
| 53 | 53 | // CHECK: ret |
| 54 | 54 | let f = { |
| 55 | #[inline] |x, y| unsafe { | |
| 56 | _mm_blend_ps(x, y, 0b0101) | |
| 57 | } | |
| 55 | #[inline] | |
| 56 | |x, y| unsafe { _mm_blend_ps(x, y, 0b0101) } | |
| 58 | 57 | }; |
| 59 | 58 | f(x, y) |
| 60 | 59 | } |
tests/assembly/is_aligned.rs+2-5| ... | ... | @@ -4,8 +4,7 @@ |
| 4 | 4 | //@ revisions: opt-speed opt-size |
| 5 | 5 | //@ [opt-speed] compile-flags: -Copt-level=2 -Cdebug-assertions=no |
| 6 | 6 | //@ [opt-size] compile-flags: -Copt-level=s -Cdebug-assertions=no |
| 7 | #![crate_type="rlib"] | |
| 8 | ||
| 7 | #![crate_type = "rlib"] | |
| 9 | 8 | #![feature(core_intrinsics)] |
| 10 | 9 | #![feature(pointer_is_aligned_to)] |
| 11 | 10 | |
| ... | ... | @@ -16,9 +15,7 @@ |
| 16 | 15 | // CHECK: retq |
| 17 | 16 | #[no_mangle] |
| 18 | 17 | pub unsafe fn is_aligned_to_unchecked(ptr: *const u8, align: usize) -> bool { |
| 19 | unsafe { | |
| 20 | std::intrinsics::assume(align.is_power_of_two()) | |
| 21 | } | |
| 18 | unsafe { std::intrinsics::assume(align.is_power_of_two()) } | |
| 22 | 19 | ptr.is_aligned_to(align) |
| 23 | 20 | } |
| 24 | 21 |
tests/assembly/pic-relocation-model.rs+6-9| ... | ... | @@ -3,10 +3,9 @@ |
| 3 | 3 | //@ [x64] compile-flags: --target x86_64-unknown-linux-gnu -Crelocation-model=pic |
| 4 | 4 | //@ [x64] needs-llvm-components: x86 |
| 5 | 5 | |
| 6 | ||
| 7 | 6 | #![feature(no_core, lang_items)] |
| 8 | 7 | #![no_core] |
| 9 | #![crate_type="rlib"] | |
| 8 | #![crate_type = "rlib"] | |
| 10 | 9 | |
| 11 | 10 | #[lang = "sized"] |
| 12 | 11 | trait Sized {} |
| ... | ... | @@ -17,9 +16,7 @@ trait Copy {} |
| 17 | 16 | // CHECK: {{(jmpq|callq)}} *other_fn@GOTPCREL(%rip) |
| 18 | 17 | #[no_mangle] |
| 19 | 18 | pub fn call_other_fn() -> u8 { |
| 20 | unsafe { | |
| 21 | other_fn() | |
| 22 | } | |
| 19 | unsafe { other_fn() } | |
| 23 | 20 | } |
| 24 | 21 | |
| 25 | 22 | // CHECK-LABEL: other_fn: |
| ... | ... | @@ -27,9 +24,9 @@ pub fn call_other_fn() -> u8 { |
| 27 | 24 | #[no_mangle] |
| 28 | 25 | #[inline(never)] |
| 29 | 26 | pub fn other_fn() -> u8 { |
| 30 | unsafe { | |
| 31 | foreign_fn() | |
| 32 | } | |
| 27 | unsafe { foreign_fn() } | |
| 33 | 28 | } |
| 34 | 29 | |
| 35 | extern "C" {fn foreign_fn() -> u8;} | |
| 30 | extern "C" { | |
| 31 | fn foreign_fn() -> u8; | |
| 32 | } |
tests/assembly/pie-relocation-model.rs+6-9| ... | ... | @@ -3,10 +3,9 @@ |
| 3 | 3 | //@ [x64] compile-flags: --target x86_64-unknown-linux-gnu -Crelocation-model=pie |
| 4 | 4 | //@ [x64] needs-llvm-components: x86 |
| 5 | 5 | |
| 6 | ||
| 7 | 6 | #![feature(no_core, lang_items)] |
| 8 | 7 | #![no_core] |
| 9 | #![crate_type="rlib"] | |
| 8 | #![crate_type = "rlib"] | |
| 10 | 9 | |
| 11 | 10 | #[lang = "sized"] |
| 12 | 11 | trait Sized {} |
| ... | ... | @@ -18,9 +17,7 @@ trait Copy {} |
| 18 | 17 | // CHECK: {{(jmp|callq)}} other_fn |
| 19 | 18 | #[no_mangle] |
| 20 | 19 | pub fn call_other_fn() -> u8 { |
| 21 | unsafe { | |
| 22 | other_fn() | |
| 23 | } | |
| 20 | unsafe { other_fn() } | |
| 24 | 21 | } |
| 25 | 22 | |
| 26 | 23 | // CHECK-LABEL: other_fn: |
| ... | ... | @@ -30,9 +27,9 @@ pub fn call_other_fn() -> u8 { |
| 30 | 27 | #[no_mangle] |
| 31 | 28 | #[inline(never)] |
| 32 | 29 | pub fn other_fn() -> u8 { |
| 33 | unsafe { | |
| 34 | foreign_fn() | |
| 35 | } | |
| 30 | unsafe { foreign_fn() } | |
| 36 | 31 | } |
| 37 | 32 | |
| 38 | extern "C" {fn foreign_fn() -> u8;} | |
| 33 | extern "C" { | |
| 34 | fn foreign_fn() -> u8; | |
| 35 | } |
tests/assembly/stack-protector/stack-protector-heuristics-effect-windows-32bit.rs+1-10| ... | ... | @@ -10,12 +10,9 @@ |
| 10 | 10 | //@ compile-flags: -C opt-level=2 -Z merge-functions=disabled |
| 11 | 11 | |
| 12 | 12 | #![crate_type = "lib"] |
| 13 | ||
| 14 | 13 | #![allow(incomplete_features)] |
| 15 | ||
| 16 | 14 | #![feature(unsized_locals, unsized_fn_params)] |
| 17 | 15 | |
| 18 | ||
| 19 | 16 | // CHECK-LABEL: emptyfn: |
| 20 | 17 | #[no_mangle] |
| 21 | 18 | pub fn emptyfn() { |
| ... | ... | @@ -139,7 +136,6 @@ pub fn local_var_addr_used_indirectly(f: fn(bool)) { |
| 139 | 136 | // missing-NOT: __security_check_cookie |
| 140 | 137 | } |
| 141 | 138 | |
| 142 | ||
| 143 | 139 | // CHECK-LABEL: local_string_addr_taken |
| 144 | 140 | #[no_mangle] |
| 145 | 141 | pub fn local_string_addr_taken(f: fn(&String)) { |
| ... | ... | @@ -205,7 +201,7 @@ pub struct Gigastruct { |
| 205 | 201 | not: u64, |
| 206 | 202 | have: u64, |
| 207 | 203 | array: u64, |
| 208 | members: u64 | |
| 204 | members: u64, | |
| 209 | 205 | } |
| 210 | 206 | |
| 211 | 207 | // CHECK-LABEL: local_large_var_moved |
| ... | ... | @@ -259,7 +255,6 @@ pub fn local_large_var_cloned(f: fn(Gigastruct)) { |
| 259 | 255 | // EOF |
| 260 | 256 | // ``` |
| 261 | 257 | |
| 262 | ||
| 263 | 258 | // all: __security_check_cookie |
| 264 | 259 | // strong: __security_check_cookie |
| 265 | 260 | // basic: __security_check_cookie |
| ... | ... | @@ -267,7 +262,6 @@ pub fn local_large_var_cloned(f: fn(Gigastruct)) { |
| 267 | 262 | // missing-NOT: __security_check_cookie |
| 268 | 263 | } |
| 269 | 264 | |
| 270 | ||
| 271 | 265 | extern "C" { |
| 272 | 266 | // A call to an external `alloca` function is *not* recognized as an |
| 273 | 267 | // `alloca(3)` operation. This function is a compiler built-in, as the |
| ... | ... | @@ -320,7 +314,6 @@ pub fn alloca_large_compile_time_constant_arg(f: fn(*mut ())) { |
| 320 | 314 | // missing-NOT: __security_check_cookie |
| 321 | 315 | } |
| 322 | 316 | |
| 323 | ||
| 324 | 317 | // CHECK-LABEL: alloca_dynamic_arg |
| 325 | 318 | #[no_mangle] |
| 326 | 319 | pub fn alloca_dynamic_arg(f: fn(*mut ()), n: usize) { |
| ... | ... | @@ -340,7 +333,6 @@ pub fn alloca_dynamic_arg(f: fn(*mut ()), n: usize) { |
| 340 | 333 | // this is support for the "unsized locals" unstable feature: |
| 341 | 334 | // https://doc.rust-lang.org/unstable-book/language-features/unsized-locals.html. |
| 342 | 335 | |
| 343 | ||
| 344 | 336 | // CHECK-LABEL: unsized_fn_param |
| 345 | 337 | #[no_mangle] |
| 346 | 338 | pub fn unsized_fn_param(s: [u8], l: bool, f: fn([u8])) { |
| ... | ... | @@ -354,7 +346,6 @@ pub fn unsized_fn_param(s: [u8], l: bool, f: fn([u8])) { |
| 354 | 346 | // alloca, and is therefore not protected by the `strong` or `basic` |
| 355 | 347 | // heuristics. |
| 356 | 348 | |
| 357 | ||
| 358 | 349 | // We should have a __security_check_cookie call in `all` and `strong` modes but |
| 359 | 350 | // LLVM does not support generating stack protectors in functions with funclet |
| 360 | 351 | // based EH personalities. |
tests/assembly/stack-protector/stack-protector-heuristics-effect-windows-64bit.rs+1-10| ... | ... | @@ -10,12 +10,9 @@ |
| 10 | 10 | //@ compile-flags: -C opt-level=2 -Z merge-functions=disabled |
| 11 | 11 | |
| 12 | 12 | #![crate_type = "lib"] |
| 13 | ||
| 14 | 13 | #![allow(incomplete_features)] |
| 15 | ||
| 16 | 14 | #![feature(unsized_locals, unsized_fn_params)] |
| 17 | 15 | |
| 18 | ||
| 19 | 16 | // CHECK-LABEL: emptyfn: |
| 20 | 17 | #[no_mangle] |
| 21 | 18 | pub fn emptyfn() { |
| ... | ... | @@ -139,7 +136,6 @@ pub fn local_var_addr_used_indirectly(f: fn(bool)) { |
| 139 | 136 | // missing-NOT: __security_check_cookie |
| 140 | 137 | } |
| 141 | 138 | |
| 142 | ||
| 143 | 139 | // CHECK-LABEL: local_string_addr_taken |
| 144 | 140 | #[no_mangle] |
| 145 | 141 | pub fn local_string_addr_taken(f: fn(&String)) { |
| ... | ... | @@ -213,7 +209,7 @@ pub struct Gigastruct { |
| 213 | 209 | not: u64, |
| 214 | 210 | have: u64, |
| 215 | 211 | array: u64, |
| 216 | members: u64 | |
| 212 | members: u64, | |
| 217 | 213 | } |
| 218 | 214 | |
| 219 | 215 | // CHECK-LABEL: local_large_var_moved |
| ... | ... | @@ -267,7 +263,6 @@ pub fn local_large_var_cloned(f: fn(Gigastruct)) { |
| 267 | 263 | // EOF |
| 268 | 264 | // ``` |
| 269 | 265 | |
| 270 | ||
| 271 | 266 | // all: __security_check_cookie |
| 272 | 267 | // strong: __security_check_cookie |
| 273 | 268 | // basic: __security_check_cookie |
| ... | ... | @@ -275,7 +270,6 @@ pub fn local_large_var_cloned(f: fn(Gigastruct)) { |
| 275 | 270 | // missing-NOT: __security_check_cookie |
| 276 | 271 | } |
| 277 | 272 | |
| 278 | ||
| 279 | 273 | extern "C" { |
| 280 | 274 | // A call to an external `alloca` function is *not* recognized as an |
| 281 | 275 | // `alloca(3)` operation. This function is a compiler built-in, as the |
| ... | ... | @@ -328,7 +322,6 @@ pub fn alloca_large_compile_time_constant_arg(f: fn(*mut ())) { |
| 328 | 322 | // missing-NOT: __security_check_cookie |
| 329 | 323 | } |
| 330 | 324 | |
| 331 | ||
| 332 | 325 | // CHECK-LABEL: alloca_dynamic_arg |
| 333 | 326 | #[no_mangle] |
| 334 | 327 | pub fn alloca_dynamic_arg(f: fn(*mut ()), n: usize) { |
| ... | ... | @@ -348,7 +341,6 @@ pub fn alloca_dynamic_arg(f: fn(*mut ()), n: usize) { |
| 348 | 341 | // this is support for the "unsized locals" unstable feature: |
| 349 | 342 | // https://doc.rust-lang.org/unstable-book/language-features/unsized-locals.html. |
| 350 | 343 | |
| 351 | ||
| 352 | 344 | // CHECK-LABEL: unsized_fn_param |
| 353 | 345 | #[no_mangle] |
| 354 | 346 | pub fn unsized_fn_param(s: [u8], l: bool, f: fn([u8])) { |
| ... | ... | @@ -362,7 +354,6 @@ pub fn unsized_fn_param(s: [u8], l: bool, f: fn([u8])) { |
| 362 | 354 | // alloca, and is therefore not protected by the `strong` or `basic` |
| 363 | 355 | // heuristics. |
| 364 | 356 | |
| 365 | ||
| 366 | 357 | // We should have a __security_check_cookie call in `all` and `strong` modes but |
| 367 | 358 | // LLVM does not support generating stack protectors in functions with funclet |
| 368 | 359 | // based EH personalities. |
tests/assembly/stack-protector/stack-protector-heuristics-effect.rs+1-6| ... | ... | @@ -143,7 +143,6 @@ pub fn local_var_addr_used_indirectly(f: fn(bool)) { |
| 143 | 143 | // missing-NOT: __stack_chk_fail |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | ||
| 147 | 146 | // CHECK-LABEL: local_string_addr_taken |
| 148 | 147 | #[no_mangle] |
| 149 | 148 | pub fn local_string_addr_taken(f: fn(&String)) { |
| ... | ... | @@ -194,7 +193,7 @@ pub struct Gigastruct { |
| 194 | 193 | not: u64, |
| 195 | 194 | have: u64, |
| 196 | 195 | array: u64, |
| 197 | members: u64 | |
| 196 | members: u64, | |
| 198 | 197 | } |
| 199 | 198 | |
| 200 | 199 | // CHECK-LABEL: local_large_var_moved |
| ... | ... | @@ -255,7 +254,6 @@ pub fn local_large_var_cloned(f: fn(Gigastruct)) { |
| 255 | 254 | // missing-NOT: __stack_chk_fail |
| 256 | 255 | } |
| 257 | 256 | |
| 258 | ||
| 259 | 257 | extern "C" { |
| 260 | 258 | // A call to an external `alloca` function is *not* recognized as an |
| 261 | 259 | // `alloca(3)` operation. This function is a compiler built-in, as the |
| ... | ... | @@ -308,7 +306,6 @@ pub fn alloca_large_compile_time_constant_arg(f: fn(*mut ())) { |
| 308 | 306 | // missing-NOT: __stack_chk_fail |
| 309 | 307 | } |
| 310 | 308 | |
| 311 | ||
| 312 | 309 | // CHECK-LABEL: alloca_dynamic_arg |
| 313 | 310 | #[no_mangle] |
| 314 | 311 | pub fn alloca_dynamic_arg(f: fn(*mut ()), n: usize) { |
| ... | ... | @@ -328,7 +325,6 @@ pub fn alloca_dynamic_arg(f: fn(*mut ()), n: usize) { |
| 328 | 325 | // this is support for the "unsized locals" unstable feature: |
| 329 | 326 | // https://doc.rust-lang.org/unstable-book/language-features/unsized-locals.html. |
| 330 | 327 | |
| 331 | ||
| 332 | 328 | // CHECK-LABEL: unsized_fn_param |
| 333 | 329 | #[no_mangle] |
| 334 | 330 | pub fn unsized_fn_param(s: [u8], l: bool, f: fn([u8])) { |
| ... | ... | @@ -342,7 +338,6 @@ pub fn unsized_fn_param(s: [u8], l: bool, f: fn([u8])) { |
| 342 | 338 | // alloca, and is therefore not protected by the `strong` or `basic` |
| 343 | 339 | // heuristics. |
| 344 | 340 | |
| 345 | ||
| 346 | 341 | // all: __stack_chk_fail |
| 347 | 342 | // strong-NOT: __stack_chk_fail |
| 348 | 343 | // basic-NOT: __stack_chk_fail |
tests/assembly/static-relocation-model.rs+7-13| ... | ... | @@ -9,15 +9,15 @@ |
| 9 | 9 | |
| 10 | 10 | #![feature(no_core, lang_items)] |
| 11 | 11 | #![no_core] |
| 12 | #![crate_type="rlib"] | |
| 12 | #![crate_type = "rlib"] | |
| 13 | 13 | |
| 14 | #[lang="sized"] | |
| 14 | #[lang = "sized"] | |
| 15 | 15 | trait Sized {} |
| 16 | 16 | |
| 17 | #[lang="copy"] | |
| 17 | #[lang = "copy"] | |
| 18 | 18 | trait Copy {} |
| 19 | 19 | |
| 20 | #[lang="sync"] | |
| 20 | #[lang = "sync"] | |
| 21 | 21 | trait Sync {} |
| 22 | 22 | |
| 23 | 23 | #[lang = "drop_in_place"] |
| ... | ... | @@ -42,9 +42,7 @@ extern "C" { |
| 42 | 42 | // A64-NEXT: ldrb {{[a-z0-9]+}}, {{\[}}[[REG]], :lo12:chaenomeles] |
| 43 | 43 | #[no_mangle] |
| 44 | 44 | pub fn banana() -> u8 { |
| 45 | unsafe { | |
| 46 | *(chaenomeles as *mut u8) | |
| 47 | } | |
| 45 | unsafe { *(chaenomeles as *mut u8) } | |
| 48 | 46 | } |
| 49 | 47 | |
| 50 | 48 | // CHECK-LABEL: peach: |
| ... | ... | @@ -53,9 +51,7 @@ pub fn banana() -> u8 { |
| 53 | 51 | // A64-NEXT: ldrb {{[a-z0-9]+}}, {{\[}}[[REG2]], :lo12:banana] |
| 54 | 52 | #[no_mangle] |
| 55 | 53 | pub fn peach() -> u8 { |
| 56 | unsafe { | |
| 57 | *(banana as *mut u8) | |
| 58 | } | |
| 54 | unsafe { *(banana as *mut u8) } | |
| 59 | 55 | } |
| 60 | 56 | |
| 61 | 57 | // CHECK-LABEL: mango: |
| ... | ... | @@ -65,9 +61,7 @@ pub fn peach() -> u8 { |
| 65 | 61 | // A64-NEXT: ldr {{[a-z0-9]+}}, {{\[}}[[REG2]], :lo12:EXOCHORDA] |
| 66 | 62 | #[no_mangle] |
| 67 | 63 | pub fn mango() -> u8 { |
| 68 | unsafe { | |
| 69 | *EXOCHORDA | |
| 70 | } | |
| 64 | unsafe { *EXOCHORDA } | |
| 71 | 65 | } |
| 72 | 66 | |
| 73 | 67 | // CHECK-LABEL: orange: |
tests/assembly/thin-lto.rs+1-2| ... | ... | @@ -4,5 +4,4 @@ |
| 4 | 4 | |
| 5 | 5 | // CHECK: main |
| 6 | 6 | |
| 7 | pub fn main() { | |
| 8 | } | |
| 7 | pub fn main() {} |
tests/assembly/wasm_exceptions.rs+17-9| ... | ... | @@ -8,7 +8,7 @@ |
| 8 | 8 | #![feature(core_intrinsics)] |
| 9 | 9 | #![feature(rustc_attrs)] |
| 10 | 10 | |
| 11 | extern { | |
| 11 | extern "C" { | |
| 12 | 12 | fn may_panic(); |
| 13 | 13 | |
| 14 | 14 | #[rustc_nounwind] |
| ... | ... | @@ -19,7 +19,9 @@ struct LogOnDrop; |
| 19 | 19 | |
| 20 | 20 | impl Drop for LogOnDrop { |
| 21 | 21 | fn drop(&mut self) { |
| 22 | unsafe { log_number(0); } | |
| 22 | unsafe { | |
| 23 | log_number(0); | |
| 24 | } | |
| 23 | 25 | } |
| 24 | 26 | } |
| 25 | 27 | |
| ... | ... | @@ -27,7 +29,9 @@ impl Drop for LogOnDrop { |
| 27 | 29 | #[no_mangle] |
| 28 | 30 | pub fn test_cleanup() { |
| 29 | 31 | let _log_on_drop = LogOnDrop; |
| 30 | unsafe { may_panic(); } | |
| 32 | unsafe { | |
| 33 | may_panic(); | |
| 34 | } | |
| 31 | 35 | |
| 32 | 36 | // CHECK-NOT: call |
| 33 | 37 | // CHECK: try |
| ... | ... | @@ -41,12 +45,16 @@ pub fn test_cleanup() { |
| 41 | 45 | #[no_mangle] |
| 42 | 46 | pub fn test_rtry() { |
| 43 | 47 | unsafe { |
| 44 | core::intrinsics::catch_unwind(|_| { | |
| 45 | may_panic(); | |
| 46 | }, core::ptr::null_mut(), |data, exception| { | |
| 47 | log_number(data as usize); | |
| 48 | log_number(exception as usize); | |
| 49 | }); | |
| 48 | core::intrinsics::catch_unwind( | |
| 49 | |_| { | |
| 50 | may_panic(); | |
| 51 | }, | |
| 52 | core::ptr::null_mut(), | |
| 53 | |data, exception| { | |
| 54 | log_number(data as usize); | |
| 55 | log_number(exception as usize); | |
| 56 | }, | |
| 57 | ); | |
| 50 | 58 | } |
| 51 | 59 | |
| 52 | 60 | // CHECK-NOT: call |
tests/assembly/x86_64-fortanix-unknown-sgx-lvi-generic-load.rs+1-1| ... | ... | @@ -5,7 +5,7 @@ |
| 5 | 5 | //@ only-x86_64-fortanix-unknown-sgx |
| 6 | 6 | |
| 7 | 7 | #[no_mangle] |
| 8 | pub extern fn plus_one(r: &mut u64) { | |
| 8 | pub extern "C" fn plus_one(r: &mut u64) { | |
| 9 | 9 | *r = *r + 1; |
| 10 | 10 | } |
| 11 | 11 |
tests/assembly/x86_64-fortanix-unknown-sgx-lvi-generic-ret.rs+1-1| ... | ... | @@ -5,7 +5,7 @@ |
| 5 | 5 | //@ only-x86_64-fortanix-unknown-sgx |
| 6 | 6 | |
| 7 | 7 | #[no_mangle] |
| 8 | pub extern fn myret() {} | |
| 8 | pub extern "C" fn myret() {} | |
| 9 | 9 | // CHECK: myret: |
| 10 | 10 | // CHECK: popq [[REGISTER:%[a-z]+]] |
| 11 | 11 | // CHECK-NEXT: lfence |
tests/codegen-units/item-collection/auxiliary/cgu_export_trait_method.rs+28-10| ... | ... | @@ -2,25 +2,43 @@ |
| 2 | 2 | |
| 3 | 3 | #![crate_type = "lib"] |
| 4 | 4 | |
| 5 | pub trait Trait : Sized { | |
| 5 | pub trait Trait: Sized { | |
| 6 | 6 | fn without_self() -> u32; |
| 7 | fn without_self_default() -> u32 { 0 } | |
| 7 | fn without_self_default() -> u32 { | |
| 8 | 0 | |
| 9 | } | |
| 8 | 10 | |
| 9 | fn with_default_impl(self) -> Self { self } | |
| 10 | fn with_default_impl_generic<T>(self, x: T) -> (Self, T) { (self, x) } | |
| 11 | fn with_default_impl(self) -> Self { | |
| 12 | self | |
| 13 | } | |
| 14 | fn with_default_impl_generic<T>(self, x: T) -> (Self, T) { | |
| 15 | (self, x) | |
| 16 | } | |
| 11 | 17 | |
| 12 | 18 | fn without_default_impl(x: u32) -> (Self, u32); |
| 13 | 19 | fn without_default_impl_generic<T>(x: T) -> (Self, T); |
| 14 | 20 | } |
| 15 | 21 | |
| 16 | 22 | impl Trait for char { |
| 17 | fn without_self() -> u32 { 2 } | |
| 18 | fn without_default_impl(x: u32) -> (Self, u32) { ('c', x) } | |
| 19 | fn without_default_impl_generic<T>(x: T) -> (Self, T) { ('c', x) } | |
| 23 | fn without_self() -> u32 { | |
| 24 | 2 | |
| 25 | } | |
| 26 | fn without_default_impl(x: u32) -> (Self, u32) { | |
| 27 | ('c', x) | |
| 28 | } | |
| 29 | fn without_default_impl_generic<T>(x: T) -> (Self, T) { | |
| 30 | ('c', x) | |
| 31 | } | |
| 20 | 32 | } |
| 21 | 33 | |
| 22 | 34 | impl Trait for u32 { |
| 23 | fn without_self() -> u32 { 1 } | |
| 24 | fn without_default_impl(x: u32) -> (Self, u32) { (0, x) } | |
| 25 | fn without_default_impl_generic<T>(x: T) -> (Self, T) { (0, x) } | |
| 35 | fn without_self() -> u32 { | |
| 36 | 1 | |
| 37 | } | |
| 38 | fn without_default_impl(x: u32) -> (Self, u32) { | |
| 39 | (0, x) | |
| 40 | } | |
| 41 | fn without_default_impl_generic<T>(x: T) -> (Self, T) { | |
| 42 | (0, x) | |
| 43 | } | |
| 26 | 44 | } |
tests/codegen-units/item-collection/auxiliary/cgu_extern_closures.rs+3-6| ... | ... | @@ -2,22 +2,19 @@ |
| 2 | 2 | |
| 3 | 3 | #[inline] |
| 4 | 4 | pub fn inlined_fn(x: i32, y: i32) -> i32 { |
| 5 | ||
| 6 | let closure = |a, b| { a + b }; | |
| 5 | let closure = |a, b| a + b; | |
| 7 | 6 | |
| 8 | 7 | closure(x, y) |
| 9 | 8 | } |
| 10 | 9 | |
| 11 | 10 | pub fn inlined_fn_generic<T>(x: i32, y: i32, z: T) -> (i32, T) { |
| 12 | ||
| 13 | let closure = |a, b| { a + b }; | |
| 11 | let closure = |a, b| a + b; | |
| 14 | 12 | |
| 15 | 13 | (closure(x, y), z) |
| 16 | 14 | } |
| 17 | 15 | |
| 18 | 16 | pub fn non_inlined_fn(x: i32, y: i32) -> i32 { |
| 19 | ||
| 20 | let closure = |a, b| { a + b }; | |
| 17 | let closure = |a, b| a + b; | |
| 21 | 18 | |
| 22 | 19 | closure(x, y) |
| 23 | 20 | } |
tests/codegen-units/item-collection/cross-crate-closures.rs-1| ... | ... | @@ -14,7 +14,6 @@ extern crate cgu_extern_closures; |
| 14 | 14 | //~ MONO_ITEM fn cross_crate_closures::start[0] |
| 15 | 15 | #[start] |
| 16 | 16 | fn start(_: isize, _: *const *const u8) -> isize { |
| 17 | ||
| 18 | 17 | //~ MONO_ITEM fn cgu_extern_closures::inlined_fn[0] |
| 19 | 18 | //~ MONO_ITEM fn cgu_extern_closures::inlined_fn[0]::{{closure}}[0] |
| 20 | 19 | let _ = cgu_extern_closures::inlined_fn(1, 2); |
tests/codegen-units/item-collection/cross-crate-trait-method.rs-2| ... | ... | @@ -24,8 +24,6 @@ fn start(_: isize, _: *const *const u8) -> isize { |
| 24 | 24 | //~ MONO_ITEM fn <char as cgu_export_trait_method::Trait>::with_default_impl |
| 25 | 25 | let _ = Trait::with_default_impl('c'); |
| 26 | 26 | |
| 27 | ||
| 28 | ||
| 29 | 27 | //~ MONO_ITEM fn <u32 as cgu_export_trait_method::Trait>::with_default_impl_generic::<&str> |
| 30 | 28 | let _ = Trait::with_default_impl_generic(0u32, "abc"); |
| 31 | 29 | //~ MONO_ITEM fn <u32 as cgu_export_trait_method::Trait>::with_default_impl_generic::<bool> |
tests/codegen-units/item-collection/drop_in_place_intrinsic.rs-1| ... | ... | @@ -15,7 +15,6 @@ impl Drop for StructWithDtor { |
| 15 | 15 | //~ MONO_ITEM fn start |
| 16 | 16 | #[start] |
| 17 | 17 | fn start(_: isize, _: *const *const u8) -> isize { |
| 18 | ||
| 19 | 18 | //~ MONO_ITEM fn std::ptr::drop_in_place::<[StructWithDtor; 2]> - shim(Some([StructWithDtor; 2])) @@ drop_in_place_intrinsic-cgu.0[Internal] |
| 20 | 19 | let x = [StructWithDtor(0), StructWithDtor(1)]; |
| 21 | 20 |
tests/codegen-units/item-collection/function-as-argument.rs-1| ... | ... | @@ -16,7 +16,6 @@ fn take_fn_pointer<T1, T2>(f: fn(T1, T2), x: T1, y: T2) { |
| 16 | 16 | //~ MONO_ITEM fn start |
| 17 | 17 | #[start] |
| 18 | 18 | fn start(_: isize, _: *const *const u8) -> isize { |
| 19 | ||
| 20 | 19 | //~ MONO_ITEM fn take_fn_once::<u32, &str, fn(u32, &str) {function::<u32, &str>}> |
| 21 | 20 | //~ MONO_ITEM fn function::<u32, &str> |
| 22 | 21 | //~ MONO_ITEM fn <fn(u32, &str) {function::<u32, &str>} as std::ops::FnOnce<(u32, &str)>>::call_once - shim(fn(u32, &str) {function::<u32, &str>}) |
tests/codegen-units/item-collection/generic-drop-glue.rs+6-7| ... | ... | @@ -21,7 +21,7 @@ struct StructNoDrop<T1, T2> { |
| 21 | 21 | |
| 22 | 22 | enum EnumWithDrop<T1, T2> { |
| 23 | 23 | A(T1), |
| 24 | B(T2) | |
| 24 | B(T2), | |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | impl<T1, T2> Drop for EnumWithDrop<T1, T2> { |
| ... | ... | @@ -30,10 +30,9 @@ impl<T1, T2> Drop for EnumWithDrop<T1, T2> { |
| 30 | 30 | |
| 31 | 31 | enum EnumNoDrop<T1, T2> { |
| 32 | 32 | A(T1), |
| 33 | B(T2) | |
| 33 | B(T2), | |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | ||
| 37 | 36 | struct NonGenericNoDrop(#[allow(dead_code)] i32); |
| 38 | 37 | |
| 39 | 38 | struct NonGenericWithDrop(#[allow(dead_code)] i32); |
| ... | ... | @@ -67,24 +66,24 @@ fn start(_: isize, _: *const *const u8) -> isize { |
| 67 | 66 | //~ MONO_ITEM fn <EnumWithDrop<i32, i64> as std::ops::Drop>::drop |
| 68 | 67 | let _ = match EnumWithDrop::A::<i32, i64>(0) { |
| 69 | 68 | EnumWithDrop::A(x) => x, |
| 70 | EnumWithDrop::B(x) => x as i32 | |
| 69 | EnumWithDrop::B(x) => x as i32, | |
| 71 | 70 | }; |
| 72 | 71 | |
| 73 | 72 | //~ MONO_ITEM fn std::ptr::drop_in_place::<EnumWithDrop<f64, f32>> - shim(Some(EnumWithDrop<f64, f32>)) @@ generic_drop_glue-cgu.0[Internal] |
| 74 | 73 | //~ MONO_ITEM fn <EnumWithDrop<f64, f32> as std::ops::Drop>::drop |
| 75 | 74 | let _ = match EnumWithDrop::B::<f64, f32>(1.0) { |
| 76 | 75 | EnumWithDrop::A(x) => x, |
| 77 | EnumWithDrop::B(x) => x as f64 | |
| 76 | EnumWithDrop::B(x) => x as f64, | |
| 78 | 77 | }; |
| 79 | 78 | |
| 80 | 79 | let _ = match EnumNoDrop::A::<i32, i64>(0) { |
| 81 | 80 | EnumNoDrop::A(x) => x, |
| 82 | EnumNoDrop::B(x) => x as i32 | |
| 81 | EnumNoDrop::B(x) => x as i32, | |
| 83 | 82 | }; |
| 84 | 83 | |
| 85 | 84 | let _ = match EnumNoDrop::B::<f64, f32>(1.0) { |
| 86 | 85 | EnumNoDrop::A(x) => x, |
| 87 | EnumNoDrop::B(x) => x as f64 | |
| 86 | EnumNoDrop::B(x) => x as f64, | |
| 88 | 87 | }; |
| 89 | 88 | |
| 90 | 89 | 0 |
tests/codegen-units/item-collection/generic-impl.rs+5-8| ... | ... | @@ -8,15 +8,13 @@ struct Struct<T> { |
| 8 | 8 | f: fn(x: T) -> T, |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | fn id<T>(x: T) -> T { x } | |
| 11 | fn id<T>(x: T) -> T { | |
| 12 | x | |
| 13 | } | |
| 12 | 14 | |
| 13 | 15 | impl<T> Struct<T> { |
| 14 | ||
| 15 | 16 | fn new(x: T) -> Struct<T> { |
| 16 | Struct { | |
| 17 | x: x, | |
| 18 | f: id | |
| 19 | } | |
| 17 | Struct { x: x, f: id } | |
| 20 | 18 | } |
| 21 | 19 | |
| 22 | 20 | fn get<T2>(self, x: T2) -> (T, T2) { |
| ... | ... | @@ -25,11 +23,10 @@ impl<T> Struct<T> { |
| 25 | 23 | } |
| 26 | 24 | |
| 27 | 25 | pub struct LifeTimeOnly<'a> { |
| 28 | _a: &'a u32 | |
| 26 | _a: &'a u32, | |
| 29 | 27 | } |
| 30 | 28 | |
| 31 | 29 | impl<'a> LifeTimeOnly<'a> { |
| 32 | ||
| 33 | 30 | //~ MONO_ITEM fn LifeTimeOnly::<'_>::foo |
| 34 | 31 | pub fn foo(&self) {} |
| 35 | 32 | //~ MONO_ITEM fn LifeTimeOnly::<'_>::bar |
tests/codegen-units/item-collection/instantiation-through-vtable.rs+4-2| ... | ... | @@ -10,11 +10,13 @@ trait Trait { |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | struct Struct<T> { |
| 13 | _a: T | |
| 13 | _a: T, | |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | impl<T> Trait for Struct<T> { |
| 17 | fn foo(&self) -> u32 { 0 } | |
| 17 | fn foo(&self) -> u32 { | |
| 18 | 0 | |
| 19 | } | |
| 18 | 20 | fn bar(&self) {} |
| 19 | 21 | } |
| 20 | 22 |
tests/codegen-units/item-collection/non-generic-drop-glue.rs+6-6| ... | ... | @@ -7,7 +7,7 @@ |
| 7 | 7 | |
| 8 | 8 | //~ MONO_ITEM fn std::ptr::drop_in_place::<StructWithDrop> - shim(Some(StructWithDrop)) @@ non_generic_drop_glue-cgu.0[Internal] |
| 9 | 9 | struct StructWithDrop { |
| 10 | x: i32 | |
| 10 | x: i32, | |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | impl Drop for StructWithDrop { |
| ... | ... | @@ -16,12 +16,12 @@ impl Drop for StructWithDrop { |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | struct StructNoDrop { |
| 19 | x: i32 | |
| 19 | x: i32, | |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | //~ MONO_ITEM fn std::ptr::drop_in_place::<EnumWithDrop> - shim(Some(EnumWithDrop)) @@ non_generic_drop_glue-cgu.0[Internal] |
| 23 | 23 | enum EnumWithDrop { |
| 24 | A(i32) | |
| 24 | A(i32), | |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | impl Drop for EnumWithDrop { |
| ... | ... | @@ -30,7 +30,7 @@ impl Drop for EnumWithDrop { |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | enum EnumNoDrop { |
| 33 | A(i32) | |
| 33 | A(i32), | |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | //~ MONO_ITEM fn start |
| ... | ... | @@ -39,10 +39,10 @@ fn start(_: isize, _: *const *const u8) -> isize { |
| 39 | 39 | let _ = StructWithDrop { x: 0 }.x; |
| 40 | 40 | let _ = StructNoDrop { x: 0 }.x; |
| 41 | 41 | let _ = match EnumWithDrop::A(0) { |
| 42 | EnumWithDrop::A(x) => x | |
| 42 | EnumWithDrop::A(x) => x, | |
| 43 | 43 | }; |
| 44 | 44 | let _ = match EnumNoDrop::A(0) { |
| 45 | EnumNoDrop::A(x) => x | |
| 45 | EnumNoDrop::A(x) => x, | |
| 46 | 46 | }; |
| 47 | 47 | |
| 48 | 48 | 0 |
tests/codegen-units/item-collection/non-generic-functions.rs+3-1| ... | ... | @@ -25,7 +25,9 @@ fn bar() { |
| 25 | 25 | baz(); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | struct Struct { _x: i32 } | |
| 28 | struct Struct { | |
| 29 | _x: i32, | |
| 30 | } | |
| 29 | 31 | |
| 30 | 32 | impl Struct { |
| 31 | 33 | //~ MONO_ITEM fn Struct::foo |
tests/codegen-units/item-collection/overloaded-operators.rs+5-15| ... | ... | @@ -1,12 +1,12 @@ |
| 1 | 1 | //@ compile-flags:-Zprint-mono-items=eager |
| 2 | 2 | |
| 3 | 3 | #![deny(dead_code)] |
| 4 | #![crate_type="lib"] | |
| 4 | #![crate_type = "lib"] | |
| 5 | 5 | |
| 6 | use std::ops::{Index, IndexMut, Add, Deref}; | |
| 6 | use std::ops::{Add, Deref, Index, IndexMut}; | |
| 7 | 7 | |
| 8 | 8 | pub struct Indexable { |
| 9 | data: [u8; 3] | |
| 9 | data: [u8; 3], | |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | impl Index<usize> for Indexable { |
| ... | ... | @@ -14,32 +14,22 @@ impl Index<usize> for Indexable { |
| 14 | 14 | |
| 15 | 15 | //~ MONO_ITEM fn <Indexable as std::ops::Index<usize>>::index |
| 16 | 16 | fn index(&self, index: usize) -> &Self::Output { |
| 17 | if index >= 3 { | |
| 18 | &self.data[0] | |
| 19 | } else { | |
| 20 | &self.data[index] | |
| 21 | } | |
| 17 | if index >= 3 { &self.data[0] } else { &self.data[index] } | |
| 22 | 18 | } |
| 23 | 19 | } |
| 24 | 20 | |
| 25 | 21 | impl IndexMut<usize> for Indexable { |
| 26 | 22 | //~ MONO_ITEM fn <Indexable as std::ops::IndexMut<usize>>::index_mut |
| 27 | 23 | fn index_mut(&mut self, index: usize) -> &mut Self::Output { |
| 28 | if index >= 3 { | |
| 29 | &mut self.data[0] | |
| 30 | } else { | |
| 31 | &mut self.data[index] | |
| 32 | } | |
| 24 | if index >= 3 { &mut self.data[0] } else { &mut self.data[index] } | |
| 33 | 25 | } |
| 34 | 26 | } |
| 35 | 27 | |
| 36 | ||
| 37 | 28 | //~ MONO_ITEM fn <Equatable as std::cmp::PartialEq>::eq |
| 38 | 29 | //~ MONO_ITEM fn <Equatable as std::cmp::PartialEq>::ne |
| 39 | 30 | #[derive(PartialEq)] |
| 40 | 31 | pub struct Equatable(u32); |
| 41 | 32 | |
| 42 | ||
| 43 | 33 | impl Add<u32> for Equatable { |
| 44 | 34 | type Output = u32; |
| 45 | 35 |
tests/codegen-units/item-collection/static-init.rs+2-2| ... | ... | @@ -2,9 +2,9 @@ |
| 2 | 2 | |
| 3 | 3 | #![feature(start)] |
| 4 | 4 | |
| 5 | pub static FN : fn() = foo::<i32>; | |
| 5 | pub static FN: fn() = foo::<i32>; | |
| 6 | 6 | |
| 7 | pub fn foo<T>() { } | |
| 7 | pub fn foo<T>() {} | |
| 8 | 8 | |
| 9 | 9 | //~ MONO_ITEM fn foo::<T> |
| 10 | 10 | //~ MONO_ITEM static FN |
tests/codegen-units/item-collection/trait-implementations.rs+15-19| ... | ... | @@ -9,7 +9,6 @@ pub trait SomeTrait { |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | 11 | impl SomeTrait for i64 { |
| 12 | ||
| 13 | 12 | //~ MONO_ITEM fn <i64 as SomeTrait>::foo |
| 14 | 13 | fn foo(&self) {} |
| 15 | 14 | |
| ... | ... | @@ -17,7 +16,6 @@ impl SomeTrait for i64 { |
| 17 | 16 | } |
| 18 | 17 | |
| 19 | 18 | impl SomeTrait for i32 { |
| 20 | ||
| 21 | 19 | //~ MONO_ITEM fn <i32 as SomeTrait>::foo |
| 22 | 20 | fn foo(&self) {} |
| 23 | 21 | |
| ... | ... | @@ -31,7 +29,6 @@ pub trait SomeGenericTrait<T> { |
| 31 | 29 | |
| 32 | 30 | // Concrete impl of generic trait |
| 33 | 31 | impl SomeGenericTrait<u32> for f64 { |
| 34 | ||
| 35 | 32 | //~ MONO_ITEM fn <f64 as SomeGenericTrait<u32>>::foo |
| 36 | 33 | fn foo(&self, _: u32) {} |
| 37 | 34 | |
| ... | ... | @@ -40,7 +37,6 @@ impl SomeGenericTrait<u32> for f64 { |
| 40 | 37 | |
| 41 | 38 | // Generic impl of generic trait |
| 42 | 39 | impl<T> SomeGenericTrait<T> for f32 { |
| 43 | ||
| 44 | 40 | fn foo(&self, _: T) {} |
| 45 | 41 | fn bar<T2>(&self, _: T, _: T2) {} |
| 46 | 42 | } |
| ... | ... | @@ -48,26 +44,26 @@ impl<T> SomeGenericTrait<T> for f32 { |
| 48 | 44 | //~ MONO_ITEM fn start |
| 49 | 45 | #[start] |
| 50 | 46 | fn start(_: isize, _: *const *const u8) -> isize { |
| 51 | //~ MONO_ITEM fn <i32 as SomeTrait>::bar::<char> | |
| 52 | 0i32.bar('x'); | |
| 47 | //~ MONO_ITEM fn <i32 as SomeTrait>::bar::<char> | |
| 48 | 0i32.bar('x'); | |
| 53 | 49 | |
| 54 | //~ MONO_ITEM fn <f64 as SomeGenericTrait<u32>>::bar::<&str> | |
| 55 | 0f64.bar(0u32, "&str"); | |
| 50 | //~ MONO_ITEM fn <f64 as SomeGenericTrait<u32>>::bar::<&str> | |
| 51 | 0f64.bar(0u32, "&str"); | |
| 56 | 52 | |
| 57 | //~ MONO_ITEM fn <f64 as SomeGenericTrait<u32>>::bar::<()> | |
| 58 | 0f64.bar(0u32, ()); | |
| 53 | //~ MONO_ITEM fn <f64 as SomeGenericTrait<u32>>::bar::<()> | |
| 54 | 0f64.bar(0u32, ()); | |
| 59 | 55 | |
| 60 | //~ MONO_ITEM fn <f32 as SomeGenericTrait<char>>::foo | |
| 61 | 0f32.foo('x'); | |
| 56 | //~ MONO_ITEM fn <f32 as SomeGenericTrait<char>>::foo | |
| 57 | 0f32.foo('x'); | |
| 62 | 58 | |
| 63 | //~ MONO_ITEM fn <f32 as SomeGenericTrait<i64>>::foo | |
| 64 | 0f32.foo(-1i64); | |
| 59 | //~ MONO_ITEM fn <f32 as SomeGenericTrait<i64>>::foo | |
| 60 | 0f32.foo(-1i64); | |
| 65 | 61 | |
| 66 | //~ MONO_ITEM fn <f32 as SomeGenericTrait<u32>>::bar::<()> | |
| 67 | 0f32.bar(0u32, ()); | |
| 62 | //~ MONO_ITEM fn <f32 as SomeGenericTrait<u32>>::bar::<()> | |
| 63 | 0f32.bar(0u32, ()); | |
| 68 | 64 | |
| 69 | //~ MONO_ITEM fn <f32 as SomeGenericTrait<&str>>::bar::<&str> | |
| 70 | 0f32.bar("&str", "&str"); | |
| 65 | //~ MONO_ITEM fn <f32 as SomeGenericTrait<&str>>::bar::<&str> | |
| 66 | 0f32.bar("&str", "&str"); | |
| 71 | 67 | |
| 72 | 0 | |
| 68 | 0 | |
| 73 | 69 | } |
tests/codegen-units/item-collection/trait-method-as-argument.rs+8-5| ... | ... | @@ -3,16 +3,19 @@ |
| 3 | 3 | #![deny(dead_code)] |
| 4 | 4 | #![feature(start)] |
| 5 | 5 | |
| 6 | trait Trait : Sized { | |
| 7 | fn foo(self) -> Self { self } | |
| 6 | trait Trait: Sized { | |
| 7 | fn foo(self) -> Self { | |
| 8 | self | |
| 9 | } | |
| 8 | 10 | } |
| 9 | 11 | |
| 10 | 12 | impl Trait for u32 { |
| 11 | fn foo(self) -> u32 { self } | |
| 13 | fn foo(self) -> u32 { | |
| 14 | self | |
| 15 | } | |
| 12 | 16 | } |
| 13 | 17 | |
| 14 | impl Trait for char { | |
| 15 | } | |
| 18 | impl Trait for char {} | |
| 16 | 19 | |
| 17 | 20 | fn take_foo_once<T, F: FnOnce(T) -> T>(f: F, arg: T) -> T { |
| 18 | 21 | (f)(arg) |
tests/codegen-units/item-collection/trait-method-default-impl.rs+5-3| ... | ... | @@ -4,8 +4,10 @@ |
| 4 | 4 | #![feature(start)] |
| 5 | 5 | |
| 6 | 6 | trait SomeTrait { |
| 7 | fn foo(&self) { } | |
| 8 | fn bar<T>(&self, x: T) -> T { x } | |
| 7 | fn foo(&self) {} | |
| 8 | fn bar<T>(&self, x: T) -> T { | |
| 9 | x | |
| 10 | } | |
| 9 | 11 | } |
| 10 | 12 | |
| 11 | 13 | impl SomeTrait for i8 { |
| ... | ... | @@ -17,7 +19,7 @@ impl SomeTrait for i8 { |
| 17 | 19 | } |
| 18 | 20 | |
| 19 | 21 | trait SomeGenericTrait<T1> { |
| 20 | fn foo(&self) { } | |
| 22 | fn foo(&self) {} | |
| 21 | 23 | fn bar<T2>(&self, x: T1, y: T2) {} |
| 22 | 24 | } |
| 23 | 25 |
tests/codegen-units/item-collection/unsizing.rs+2-6| ... | ... | @@ -27,7 +27,7 @@ impl Trait for char { |
| 27 | 27 | struct Struct<T: ?Sized> { |
| 28 | 28 | _a: u32, |
| 29 | 29 | _b: i32, |
| 30 | _c: T | |
| 30 | _c: T, | |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | impl Trait for f64 { |
| ... | ... | @@ -60,11 +60,7 @@ fn start(_: isize, _: *const *const u8) -> isize { |
| 60 | 60 | let _char_unsized = char_sized as &Trait; |
| 61 | 61 | |
| 62 | 62 | // struct field |
| 63 | let struct_sized = &Struct { | |
| 64 | _a: 1, | |
| 65 | _b: 2, | |
| 66 | _c: 3.0f64 | |
| 67 | }; | |
| 63 | let struct_sized = &Struct { _a: 1, _b: 2, _c: 3.0f64 }; | |
| 68 | 64 | //~ MONO_ITEM fn std::ptr::drop_in_place::<f64> - shim(None) @@ unsizing-cgu.0[Internal] |
| 69 | 65 | //~ MONO_ITEM fn <f64 as Trait>::foo |
| 70 | 66 | let _struct_unsized = struct_sized as &Struct<Trait>; |
tests/codegen-units/item-collection/unused-traits-and-generics.rs+4-4| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | //@ compile-flags:-Zprint-mono-items=eager |
| 2 | 2 | |
| 3 | #![crate_type="lib"] | |
| 3 | #![crate_type = "lib"] | |
| 4 | 4 | #![deny(dead_code)] |
| 5 | 5 | |
| 6 | 6 | // This test asserts that no codegen items are generated for generic items that |
| ... | ... | @@ -16,7 +16,7 @@ pub fn foo<T: Copy>(x: T) -> (T, T) { |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | pub struct Struct<T> { |
| 19 | x: T | |
| 19 | x: T, | |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | impl<T> Struct<T> { |
| ... | ... | @@ -29,7 +29,7 @@ impl<T> Struct<T> { |
| 29 | 29 | |
| 30 | 30 | pub enum Enum<T> { |
| 31 | 31 | A(T), |
| 32 | B { x: T } | |
| 32 | B { x: T }, | |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | impl<T> Enum<T> { |
| ... | ... | @@ -56,7 +56,7 @@ impl<T> TupleStruct<T> { |
| 56 | 56 | pub type Pair<T> = (T, T); |
| 57 | 57 | |
| 58 | 58 | pub struct NonGeneric { |
| 59 | x: i32 | |
| 59 | x: i32, | |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | impl NonGeneric { |
tests/codegen-units/partitioning/auxiliary/shared_generics_aux.rs+1-1| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | //@ compile-flags:-Zshare-generics=yes -Copt-level=0 |
| 4 | 4 | //@ no-prefer-dynamic |
| 5 | 5 | |
| 6 | #![crate_type="rlib"] | |
| 6 | #![crate_type = "rlib"] | |
| 7 | 7 | |
| 8 | 8 | pub fn generic_fn<T>(x: T, y: T) -> (T, T) { |
| 9 | 9 | (x, y) |
tests/codegen-units/partitioning/extern-generic.rs+1-1| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | //@ compile-flags:-Zprint-mono-items=eager -Zshare-generics=y |
| 4 | 4 | |
| 5 | 5 | #![allow(dead_code)] |
| 6 | #![crate_type="lib"] | |
| 6 | #![crate_type = "lib"] | |
| 7 | 7 | |
| 8 | 8 | //@ aux-build:cgu_generic_function.rs |
| 9 | 9 | extern crate cgu_generic_function; |
tests/codegen-units/partitioning/inlining-from-extern-crate.rs+4-7| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | //@ compile-flags:-Zprint-mono-items=lazy |
| 4 | 4 | //@ compile-flags:-Zinline-in-all-cgus |
| 5 | 5 | |
| 6 | #![crate_type="lib"] | |
| 6 | #![crate_type = "lib"] | |
| 7 | 7 | |
| 8 | 8 | //@ aux-build:cgu_explicit_inlining.rs |
| 9 | 9 | extern crate cgu_explicit_inlining; |
| ... | ... | @@ -15,8 +15,7 @@ extern crate cgu_explicit_inlining; |
| 15 | 15 | //~ MONO_ITEM fn cgu_explicit_inlining::always_inlined @@ inlining_from_extern_crate[Internal] inlining_from_extern_crate-mod2[Internal] |
| 16 | 16 | |
| 17 | 17 | //~ MONO_ITEM fn user @@ inlining_from_extern_crate[External] |
| 18 | pub fn user() | |
| 19 | { | |
| 18 | pub fn user() { | |
| 20 | 19 | cgu_explicit_inlining::inlined(); |
| 21 | 20 | cgu_explicit_inlining::always_inlined(); |
| 22 | 21 | |
| ... | ... | @@ -28,8 +27,7 @@ pub mod mod1 { |
| 28 | 27 | use cgu_explicit_inlining; |
| 29 | 28 | |
| 30 | 29 | //~ MONO_ITEM fn mod1::user @@ inlining_from_extern_crate-mod1[External] |
| 31 | pub fn user() | |
| 32 | { | |
| 30 | pub fn user() { | |
| 33 | 31 | cgu_explicit_inlining::inlined(); |
| 34 | 32 | |
| 35 | 33 | // does not generate a monomorphization in this crate |
| ... | ... | @@ -41,8 +39,7 @@ pub mod mod2 { |
| 41 | 39 | use cgu_explicit_inlining; |
| 42 | 40 | |
| 43 | 41 | //~ MONO_ITEM fn mod2::user @@ inlining_from_extern_crate-mod2[External] |
| 44 | pub fn user() | |
| 45 | { | |
| 42 | pub fn user() { | |
| 46 | 43 | cgu_explicit_inlining::always_inlined(); |
| 47 | 44 | |
| 48 | 45 | // does not generate a monomorphization in this crate |
tests/codegen-units/partitioning/local-generic.rs+4-2| ... | ... | @@ -3,13 +3,15 @@ |
| 3 | 3 | //@ compile-flags:-Zprint-mono-items=eager |
| 4 | 4 | |
| 5 | 5 | #![allow(dead_code)] |
| 6 | #![crate_type="lib"] | |
| 6 | #![crate_type = "lib"] | |
| 7 | 7 | |
| 8 | 8 | //~ MONO_ITEM fn generic::<u32> @@ local_generic.volatile[External] |
| 9 | 9 | //~ MONO_ITEM fn generic::<u64> @@ local_generic.volatile[External] |
| 10 | 10 | //~ MONO_ITEM fn generic::<char> @@ local_generic.volatile[External] |
| 11 | 11 | //~ MONO_ITEM fn generic::<&str> @@ local_generic.volatile[External] |
| 12 | pub fn generic<T>(x: T) -> T { x } | |
| 12 | pub fn generic<T>(x: T) -> T { | |
| 13 | x | |
| 14 | } | |
| 13 | 15 | |
| 14 | 16 | //~ MONO_ITEM fn user @@ local_generic[Internal] |
| 15 | 17 | fn user() { |
tests/codegen-units/partitioning/local-inlining-but-not-all.rs+3-8| ... | ... | @@ -4,16 +4,13 @@ |
| 4 | 4 | //@ compile-flags:-Zinline-in-all-cgus=no |
| 5 | 5 | |
| 6 | 6 | #![allow(dead_code)] |
| 7 | #![crate_type="lib"] | |
| 7 | #![crate_type = "lib"] | |
| 8 | 8 | |
| 9 | 9 | mod inline { |
| 10 | 10 | |
| 11 | 11 | //~ MONO_ITEM fn inline::inlined_function @@ local_inlining_but_not_all-inline[External] |
| 12 | 12 | #[inline] |
| 13 | pub fn inlined_function() | |
| 14 | { | |
| 15 | ||
| 16 | } | |
| 13 | pub fn inlined_function() {} | |
| 17 | 14 | } |
| 18 | 15 | |
| 19 | 16 | pub mod user1 { |
| ... | ... | @@ -37,7 +34,5 @@ pub mod user2 { |
| 37 | 34 | pub mod non_user { |
| 38 | 35 | |
| 39 | 36 | //~ MONO_ITEM fn non_user::baz @@ local_inlining_but_not_all-non_user[External] |
| 40 | pub fn baz() { | |
| 41 | ||
| 42 | } | |
| 37 | pub fn baz() {} | |
| 43 | 38 | } |
tests/codegen-units/partitioning/local-inlining.rs+3-8| ... | ... | @@ -4,17 +4,14 @@ |
| 4 | 4 | //@ compile-flags:-Zinline-in-all-cgus |
| 5 | 5 | |
| 6 | 6 | #![allow(dead_code)] |
| 7 | #![crate_type="lib"] | |
| 7 | #![crate_type = "lib"] | |
| 8 | 8 | |
| 9 | 9 | mod inline { |
| 10 | 10 | |
| 11 | 11 | // Important: This function should show up in all codegen units where it is inlined |
| 12 | 12 | //~ MONO_ITEM fn inline::inlined_function @@ local_inlining-user1[Internal] local_inlining-user2[Internal] |
| 13 | 13 | #[inline(always)] |
| 14 | pub fn inlined_function() | |
| 15 | { | |
| 16 | ||
| 17 | } | |
| 14 | pub fn inlined_function() {} | |
| 18 | 15 | } |
| 19 | 16 | |
| 20 | 17 | pub mod user1 { |
| ... | ... | @@ -38,7 +35,5 @@ pub mod user2 { |
| 38 | 35 | pub mod non_user { |
| 39 | 36 | |
| 40 | 37 | //~ MONO_ITEM fn non_user::baz @@ local_inlining-non_user[External] |
| 41 | pub fn baz() { | |
| 42 | ||
| 43 | } | |
| 38 | pub fn baz() {} | |
| 44 | 39 | } |
tests/codegen-units/partitioning/local-transitive-inlining.rs+3-8| ... | ... | @@ -4,16 +4,13 @@ |
| 4 | 4 | //@ compile-flags:-Zinline-in-all-cgus |
| 5 | 5 | |
| 6 | 6 | #![allow(dead_code)] |
| 7 | #![crate_type="rlib"] | |
| 7 | #![crate_type = "rlib"] | |
| 8 | 8 | |
| 9 | 9 | mod inline { |
| 10 | 10 | |
| 11 | 11 | //~ MONO_ITEM fn inline::inlined_function @@ local_transitive_inlining-indirect_user[Internal] |
| 12 | 12 | #[inline(always)] |
| 13 | pub fn inlined_function() | |
| 14 | { | |
| 15 | ||
| 16 | } | |
| 13 | pub fn inlined_function() {} | |
| 17 | 14 | } |
| 18 | 15 | |
| 19 | 16 | mod direct_user { |
| ... | ... | @@ -38,7 +35,5 @@ pub mod indirect_user { |
| 38 | 35 | pub mod non_user { |
| 39 | 36 | |
| 40 | 37 | //~ MONO_ITEM fn non_user::baz @@ local_transitive_inlining-non_user[External] |
| 41 | pub fn baz() { | |
| 42 | ||
| 43 | } | |
| 38 | pub fn baz() {} | |
| 44 | 39 | } |
tests/codegen-units/partitioning/methods-are-with-self-type.rs+2-3| ... | ... | @@ -15,7 +15,7 @@ struct SomeType; |
| 15 | 15 | struct SomeGenericType<T1, T2>(T1, T2); |
| 16 | 16 | |
| 17 | 17 | mod mod1 { |
| 18 | use super::{SomeType, SomeGenericType}; | |
| 18 | use super::{SomeGenericType, SomeType}; | |
| 19 | 19 | |
| 20 | 20 | // Even though the impl is in `mod1`, the methods should end up in the |
| 21 | 21 | // parent module, since that is where their self-type is. |
| ... | ... | @@ -40,8 +40,7 @@ trait Trait { |
| 40 | 40 | |
| 41 | 41 | // We provide an implementation of `Trait` for all types. The corresponding |
| 42 | 42 | // monomorphizations should end up in whichever module the concrete `T` is. |
| 43 | impl<T> Trait for T | |
| 44 | { | |
| 43 | impl<T> Trait for T { | |
| 45 | 44 | fn foo(&self) {} |
| 46 | 45 | } |
| 47 | 46 |
tests/codegen-units/partitioning/regular-modules.rs+1-1| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | //@ compile-flags:-Zprint-mono-items=eager |
| 4 | 4 | |
| 5 | 5 | #![allow(dead_code)] |
| 6 | #![crate_type="lib"] | |
| 6 | #![crate_type = "lib"] | |
| 7 | 7 | |
| 8 | 8 | //~ MONO_ITEM fn foo @@ regular_modules[Internal] |
| 9 | 9 | fn foo() {} |
tests/codegen-units/partitioning/shared-generics.rs+1-2| ... | ... | @@ -4,14 +4,13 @@ |
| 4 | 4 | //@ incremental |
| 5 | 5 | //@ compile-flags:-Zprint-mono-items=eager -Zshare-generics=yes -Copt-level=0 |
| 6 | 6 | |
| 7 | #![crate_type="rlib"] | |
| 7 | #![crate_type = "rlib"] | |
| 8 | 8 | |
| 9 | 9 | //@ aux-build:shared_generics_aux.rs |
| 10 | 10 | extern crate shared_generics_aux; |
| 11 | 11 | |
| 12 | 12 | //~ MONO_ITEM fn foo |
| 13 | 13 | pub fn foo() { |
| 14 | ||
| 15 | 14 | //~ MONO_ITEM fn shared_generics_aux::generic_fn::<u16> @@ shared_generics_aux-in-shared_generics.volatile[External] |
| 16 | 15 | let _ = shared_generics_aux::generic_fn(0u16, 1u16); |
| 17 | 16 |
tests/codegen-units/partitioning/statics.rs+1-1| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | //@ incremental |
| 3 | 3 | //@ compile-flags:-Zprint-mono-items=lazy |
| 4 | 4 | |
| 5 | #![crate_type="rlib"] | |
| 5 | #![crate_type = "rlib"] | |
| 6 | 6 | |
| 7 | 7 | //~ MONO_ITEM static FOO @@ statics[Internal] |
| 8 | 8 | static FOO: u32 = 0; |
tests/codegen-units/partitioning/vtable-through-const.rs+15-7| ... | ... | @@ -28,20 +28,24 @@ mod mod1 { |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | impl<T> Trait1Gen<T> for NeedsDrop { |
| 31 | fn do_something(&self, x: T) -> T { x } | |
| 32 | fn do_something_else(&self, x: T) -> T { x } | |
| 31 | fn do_something(&self, x: T) -> T { | |
| 32 | x | |
| 33 | } | |
| 34 | fn do_something_else(&self, x: T) -> T { | |
| 35 | x | |
| 36 | } | |
| 33 | 37 | } |
| 34 | 38 | |
| 35 | 39 | //~ MONO_ITEM fn mod1::id::<i64> @@ vtable_through_const-mod1.volatile[Internal] |
| 36 | fn id<T>(x: T) -> T { x } | |
| 40 | fn id<T>(x: T) -> T { | |
| 41 | x | |
| 42 | } | |
| 37 | 43 | |
| 38 | 44 | // These are referenced, so they produce mono-items (see start()) |
| 39 | 45 | pub const TRAIT1_REF: &'static Trait1 = &NeedsDrop as &Trait1; |
| 40 | 46 | pub const TRAIT1_GEN_REF: &'static Trait1Gen<u8> = &NeedsDrop as &Trait1Gen<u8>; |
| 41 | 47 | pub const ID_CHAR: fn(char) -> char = id::<char>; |
| 42 | 48 | |
| 43 | ||
| 44 | ||
| 45 | 49 | pub trait Trait2 { |
| 46 | 50 | fn do_something(&self) {} |
| 47 | 51 | fn do_something_else(&self) {} |
| ... | ... | @@ -57,8 +61,12 @@ mod mod1 { |
| 57 | 61 | } |
| 58 | 62 | |
| 59 | 63 | impl<T> Trait2Gen<T> for NeedsDrop { |
| 60 | fn do_something(&self, x: T) -> T { x } | |
| 61 | fn do_something_else(&self, x: T) -> T { x } | |
| 64 | fn do_something(&self, x: T) -> T { | |
| 65 | x | |
| 66 | } | |
| 67 | fn do_something_else(&self, x: T) -> T { | |
| 68 | x | |
| 69 | } | |
| 62 | 70 | } |
| 63 | 71 | |
| 64 | 72 | // These are not referenced, so they do not produce mono-items |
tests/codegen-units/polymorphization/unused_type_parameters.rs+73-80| ... | ... | @@ -9,54 +9,51 @@ mod functions { |
| 9 | 9 | // Function doesn't have any type parameters to be unused. |
| 10 | 10 | pub fn no_parameters() {} |
| 11 | 11 | |
| 12 | //~ MONO_ITEM fn functions::no_parameters | |
| 12 | //~ MONO_ITEM fn functions::no_parameters | |
| 13 | 13 | |
| 14 | 14 | // Function has an unused type parameter. |
| 15 | pub fn unused<T>() { | |
| 16 | } | |
| 15 | pub fn unused<T>() {} | |
| 17 | 16 | |
| 18 | //~ MONO_ITEM fn functions::unused::<T> | |
| 17 | //~ MONO_ITEM fn functions::unused::<T> | |
| 19 | 18 | |
| 20 | 19 | // Function uses type parameter in value of a binding. |
| 21 | 20 | pub fn used_binding_value<T: Default>() { |
| 22 | 21 | let _: T = Default::default(); |
| 23 | 22 | } |
| 24 | 23 | |
| 25 | //~ MONO_ITEM fn functions::used_binding_value::<u32> | |
| 26 | //~ MONO_ITEM fn functions::used_binding_value::<u64> | |
| 24 | //~ MONO_ITEM fn functions::used_binding_value::<u32> | |
| 25 | //~ MONO_ITEM fn functions::used_binding_value::<u64> | |
| 27 | 26 | |
| 28 | 27 | // Function uses type parameter in type of a binding. |
| 29 | 28 | pub fn used_binding_type<T>() { |
| 30 | 29 | let _: Option<T> = None; |
| 31 | 30 | } |
| 32 | 31 | |
| 33 | //~ MONO_ITEM fn functions::used_binding_type::<u32> | |
| 34 | //~ MONO_ITEM fn functions::used_binding_type::<u64> | |
| 32 | //~ MONO_ITEM fn functions::used_binding_type::<u32> | |
| 33 | //~ MONO_ITEM fn functions::used_binding_type::<u64> | |
| 35 | 34 | |
| 36 | 35 | // Function uses type parameter in argument. |
| 37 | pub fn used_argument<T>(_: T) { | |
| 38 | } | |
| 36 | pub fn used_argument<T>(_: T) {} | |
| 39 | 37 | |
| 40 | //~ MONO_ITEM fn functions::used_argument::<u32> | |
| 41 | //~ MONO_ITEM fn functions::used_argument::<u64> | |
| 42 | // | |
| 38 | //~ MONO_ITEM fn functions::used_argument::<u32> | |
| 39 | //~ MONO_ITEM fn functions::used_argument::<u64> | |
| 40 | // | |
| 43 | 41 | // Function uses type parameter in substitutions to another function. |
| 44 | 42 | pub fn used_substs<T>() { |
| 45 | 43 | unused::<T>() |
| 46 | 44 | } |
| 47 | 45 | |
| 48 | //~ MONO_ITEM fn functions::used_substs::<u32> | |
| 49 | //~ MONO_ITEM fn functions::used_substs::<u64> | |
| 46 | //~ MONO_ITEM fn functions::used_substs::<u32> | |
| 47 | //~ MONO_ITEM fn functions::used_substs::<u64> | |
| 50 | 48 | } |
| 51 | 49 | |
| 52 | ||
| 53 | 50 | mod closures { |
| 54 | 51 | // Function doesn't have any type parameters to be unused. |
| 55 | 52 | pub fn no_parameters() { |
| 56 | 53 | let _ = || {}; |
| 57 | 54 | } |
| 58 | 55 | |
| 59 | //~ MONO_ITEM fn closures::no_parameters | |
| 56 | //~ MONO_ITEM fn closures::no_parameters | |
| 60 | 57 | |
| 61 | 58 | // Function has an unused type parameter in parent and closure. |
| 62 | 59 | pub fn unused<T>() -> u32 { |
| ... | ... | @@ -64,8 +61,8 @@ mod closures { |
| 64 | 61 | add_one(3) |
| 65 | 62 | } |
| 66 | 63 | |
| 67 | //~ MONO_ITEM fn closures::unused::<T>::{closure#0} | |
| 68 | //~ MONO_ITEM fn closures::unused::<T> | |
| 64 | //~ MONO_ITEM fn closures::unused::<T>::{closure#0} | |
| 65 | //~ MONO_ITEM fn closures::unused::<T> | |
| 69 | 66 | |
| 70 | 67 | // Function has an unused type parameter in closure, but not in parent. |
| 71 | 68 | pub fn used_parent<T: Default>() -> u32 { |
| ... | ... | @@ -74,9 +71,9 @@ mod closures { |
| 74 | 71 | add_one(3) |
| 75 | 72 | } |
| 76 | 73 | |
| 77 | //~ MONO_ITEM fn closures::used_parent::<T>::{closure#0} | |
| 78 | //~ MONO_ITEM fn closures::used_parent::<u32> | |
| 79 | //~ MONO_ITEM fn closures::used_parent::<u64> | |
| 74 | //~ MONO_ITEM fn closures::used_parent::<T>::{closure#0} | |
| 75 | //~ MONO_ITEM fn closures::used_parent::<u32> | |
| 76 | //~ MONO_ITEM fn closures::used_parent::<u64> | |
| 80 | 77 | |
| 81 | 78 | // Function uses type parameter in value of a binding in closure. |
| 82 | 79 | pub fn used_binding_value<T: Default>() -> T { |
| ... | ... | @@ -88,10 +85,10 @@ mod closures { |
| 88 | 85 | x() |
| 89 | 86 | } |
| 90 | 87 | |
| 91 | //~ MONO_ITEM fn closures::used_binding_value::<u32>::{closure#0} | |
| 92 | //~ MONO_ITEM fn closures::used_binding_value::<u64>::{closure#0} | |
| 93 | //~ MONO_ITEM fn closures::used_binding_value::<u32> | |
| 94 | //~ MONO_ITEM fn closures::used_binding_value::<u64> | |
| 88 | //~ MONO_ITEM fn closures::used_binding_value::<u32>::{closure#0} | |
| 89 | //~ MONO_ITEM fn closures::used_binding_value::<u64>::{closure#0} | |
| 90 | //~ MONO_ITEM fn closures::used_binding_value::<u32> | |
| 91 | //~ MONO_ITEM fn closures::used_binding_value::<u64> | |
| 95 | 92 | |
| 96 | 93 | // Function uses type parameter in type of a binding in closure. |
| 97 | 94 | pub fn used_binding_type<T>() -> Option<T> { |
| ... | ... | @@ -103,10 +100,10 @@ mod closures { |
| 103 | 100 | x() |
| 104 | 101 | } |
| 105 | 102 | |
| 106 | //~ MONO_ITEM fn closures::used_binding_type::<u32>::{closure#0} | |
| 107 | //~ MONO_ITEM fn closures::used_binding_type::<u64>::{closure#0} | |
| 108 | //~ MONO_ITEM fn closures::used_binding_type::<u32> | |
| 109 | //~ MONO_ITEM fn closures::used_binding_type::<u64> | |
| 103 | //~ MONO_ITEM fn closures::used_binding_type::<u32>::{closure#0} | |
| 104 | //~ MONO_ITEM fn closures::used_binding_type::<u64>::{closure#0} | |
| 105 | //~ MONO_ITEM fn closures::used_binding_type::<u32> | |
| 106 | //~ MONO_ITEM fn closures::used_binding_type::<u64> | |
| 110 | 107 | |
| 111 | 108 | // Function and closure uses type parameter in argument. |
| 112 | 109 | pub fn used_argument<T>(t: T) -> u32 { |
| ... | ... | @@ -114,10 +111,10 @@ mod closures { |
| 114 | 111 | x(t) |
| 115 | 112 | } |
| 116 | 113 | |
| 117 | //~ MONO_ITEM fn closures::used_argument::<u32>::{closure#0} | |
| 118 | //~ MONO_ITEM fn closures::used_argument::<u64>::{closure#0} | |
| 119 | //~ MONO_ITEM fn closures::used_argument::<u32> | |
| 120 | //~ MONO_ITEM fn closures::used_argument::<u64> | |
| 114 | //~ MONO_ITEM fn closures::used_argument::<u32>::{closure#0} | |
| 115 | //~ MONO_ITEM fn closures::used_argument::<u64>::{closure#0} | |
| 116 | //~ MONO_ITEM fn closures::used_argument::<u32> | |
| 117 | //~ MONO_ITEM fn closures::used_argument::<u64> | |
| 121 | 118 | |
| 122 | 119 | // Closure uses type parameter in argument. |
| 123 | 120 | pub fn used_argument_closure<T: Default>() -> u32 { |
| ... | ... | @@ -126,10 +123,10 @@ mod closures { |
| 126 | 123 | x(t) |
| 127 | 124 | } |
| 128 | 125 | |
| 129 | //~ MONO_ITEM fn closures::used_argument_closure::<u32>::{closure#0} | |
| 130 | //~ MONO_ITEM fn closures::used_argument_closure::<u64>::{closure#0} | |
| 131 | //~ MONO_ITEM fn closures::used_argument_closure::<u32> | |
| 132 | //~ MONO_ITEM fn closures::used_argument_closure::<u64> | |
| 126 | //~ MONO_ITEM fn closures::used_argument_closure::<u32>::{closure#0} | |
| 127 | //~ MONO_ITEM fn closures::used_argument_closure::<u64>::{closure#0} | |
| 128 | //~ MONO_ITEM fn closures::used_argument_closure::<u32> | |
| 129 | //~ MONO_ITEM fn closures::used_argument_closure::<u64> | |
| 133 | 130 | |
| 134 | 131 | // Closure uses type parameter as upvar. |
| 135 | 132 | pub fn used_upvar<T: Default>() -> T { |
| ... | ... | @@ -138,10 +135,10 @@ mod closures { |
| 138 | 135 | y() |
| 139 | 136 | } |
| 140 | 137 | |
| 141 | //~ MONO_ITEM fn closures::used_upvar::<u32>::{closure#0} | |
| 142 | //~ MONO_ITEM fn closures::used_upvar::<u64>::{closure#0} | |
| 143 | //~ MONO_ITEM fn closures::used_upvar::<u32> | |
| 144 | //~ MONO_ITEM fn closures::used_upvar::<u64> | |
| 138 | //~ MONO_ITEM fn closures::used_upvar::<u32>::{closure#0} | |
| 139 | //~ MONO_ITEM fn closures::used_upvar::<u64>::{closure#0} | |
| 140 | //~ MONO_ITEM fn closures::used_upvar::<u32> | |
| 141 | //~ MONO_ITEM fn closures::used_upvar::<u64> | |
| 145 | 142 | |
| 146 | 143 | // Closure uses type parameter in substitutions to another function. |
| 147 | 144 | pub fn used_substs<T>() { |
| ... | ... | @@ -149,10 +146,10 @@ mod closures { |
| 149 | 146 | x() |
| 150 | 147 | } |
| 151 | 148 | |
| 152 | //~ MONO_ITEM fn closures::used_substs::<u32>::{closure#0} | |
| 153 | //~ MONO_ITEM fn closures::used_substs::<u64>::{closure#0} | |
| 154 | //~ MONO_ITEM fn closures::used_substs::<u32> | |
| 155 | //~ MONO_ITEM fn closures::used_substs::<u64> | |
| 149 | //~ MONO_ITEM fn closures::used_substs::<u32>::{closure#0} | |
| 150 | //~ MONO_ITEM fn closures::used_substs::<u64>::{closure#0} | |
| 151 | //~ MONO_ITEM fn closures::used_substs::<u32> | |
| 152 | //~ MONO_ITEM fn closures::used_substs::<u64> | |
| 156 | 153 | } |
| 157 | 154 | |
| 158 | 155 | mod methods { |
| ... | ... | @@ -160,32 +157,30 @@ mod methods { |
| 160 | 157 | |
| 161 | 158 | impl<F: Default> Foo<F> { |
| 162 | 159 | // Function has an unused type parameter from impl. |
| 163 | pub fn unused_impl() { | |
| 164 | } | |
| 160 | pub fn unused_impl() {} | |
| 165 | 161 | |
| 166 | //~ MONO_ITEM fn methods::Foo::<F>::unused_impl | |
| 162 | //~ MONO_ITEM fn methods::Foo::<F>::unused_impl | |
| 167 | 163 | |
| 168 | 164 | // Function has an unused type parameter from impl and fn. |
| 169 | pub fn unused_both<G: Default>() { | |
| 170 | } | |
| 165 | pub fn unused_both<G: Default>() {} | |
| 171 | 166 | |
| 172 | //~ MONO_ITEM fn methods::Foo::<F>::unused_both::<G> | |
| 167 | //~ MONO_ITEM fn methods::Foo::<F>::unused_both::<G> | |
| 173 | 168 | |
| 174 | 169 | // Function uses type parameter from impl. |
| 175 | 170 | pub fn used_impl() { |
| 176 | 171 | let _: F = Default::default(); |
| 177 | 172 | } |
| 178 | 173 | |
| 179 | //~ MONO_ITEM fn methods::Foo::<u32>::used_impl | |
| 180 | //~ MONO_ITEM fn methods::Foo::<u64>::used_impl | |
| 174 | //~ MONO_ITEM fn methods::Foo::<u32>::used_impl | |
| 175 | //~ MONO_ITEM fn methods::Foo::<u64>::used_impl | |
| 181 | 176 | |
| 182 | 177 | // Function uses type parameter from impl. |
| 183 | 178 | pub fn used_fn<G: Default>() { |
| 184 | 179 | let _: G = Default::default(); |
| 185 | 180 | } |
| 186 | 181 | |
| 187 | //~ MONO_ITEM fn methods::Foo::<F>::used_fn::<u32> | |
| 188 | //~ MONO_ITEM fn methods::Foo::<F>::used_fn::<u64> | |
| 182 | //~ MONO_ITEM fn methods::Foo::<F>::used_fn::<u32> | |
| 183 | //~ MONO_ITEM fn methods::Foo::<F>::used_fn::<u64> | |
| 189 | 184 | |
| 190 | 185 | // Function uses type parameter from impl. |
| 191 | 186 | pub fn used_both<G: Default>() { |
| ... | ... | @@ -193,16 +188,16 @@ mod methods { |
| 193 | 188 | let _: G = Default::default(); |
| 194 | 189 | } |
| 195 | 190 | |
| 196 | //~ MONO_ITEM fn methods::Foo::<u32>::used_both::<u32> | |
| 197 | //~ MONO_ITEM fn methods::Foo::<u64>::used_both::<u64> | |
| 191 | //~ MONO_ITEM fn methods::Foo::<u32>::used_both::<u32> | |
| 192 | //~ MONO_ITEM fn methods::Foo::<u64>::used_both::<u64> | |
| 198 | 193 | |
| 199 | 194 | // Function uses type parameter in substitutions to another function. |
| 200 | 195 | pub fn used_substs() { |
| 201 | 196 | super::functions::unused::<F>() |
| 202 | 197 | } |
| 203 | 198 | |
| 204 | //~ MONO_ITEM fn methods::Foo::<u32>::used_substs | |
| 205 | //~ MONO_ITEM fn methods::Foo::<u64>::used_substs | |
| 199 | //~ MONO_ITEM fn methods::Foo::<u32>::used_substs | |
| 200 | //~ MONO_ITEM fn methods::Foo::<u64>::used_substs | |
| 206 | 201 | |
| 207 | 202 | // Function has an unused type parameter from impl and fn. |
| 208 | 203 | pub fn closure_unused_all<G: Default>() -> u32 { |
| ... | ... | @@ -210,8 +205,8 @@ mod methods { |
| 210 | 205 | add_one(3) |
| 211 | 206 | } |
| 212 | 207 | |
| 213 | //~ MONO_ITEM fn methods::Foo::<F>::closure_unused_all::<G>::{closure#0} | |
| 214 | //~ MONO_ITEM fn methods::Foo::<F>::closure_unused_all::<G> | |
| 208 | //~ MONO_ITEM fn methods::Foo::<F>::closure_unused_all::<G>::{closure#0} | |
| 209 | //~ MONO_ITEM fn methods::Foo::<F>::closure_unused_all::<G> | |
| 215 | 210 | |
| 216 | 211 | // Function uses type parameter from impl and fn in closure. |
| 217 | 212 | pub fn closure_used_both<G: Default>() -> u32 { |
| ... | ... | @@ -224,10 +219,10 @@ mod methods { |
| 224 | 219 | add_one(3) |
| 225 | 220 | } |
| 226 | 221 | |
| 227 | //~ MONO_ITEM fn methods::Foo::<u32>::closure_used_both::<u32>::{closure#0} | |
| 228 | //~ MONO_ITEM fn methods::Foo::<u64>::closure_used_both::<u64>::{closure#0} | |
| 229 | //~ MONO_ITEM fn methods::Foo::<u32>::closure_used_both::<u32> | |
| 230 | //~ MONO_ITEM fn methods::Foo::<u64>::closure_used_both::<u64> | |
| 222 | //~ MONO_ITEM fn methods::Foo::<u32>::closure_used_both::<u32>::{closure#0} | |
| 223 | //~ MONO_ITEM fn methods::Foo::<u64>::closure_used_both::<u64>::{closure#0} | |
| 224 | //~ MONO_ITEM fn methods::Foo::<u32>::closure_used_both::<u32> | |
| 225 | //~ MONO_ITEM fn methods::Foo::<u64>::closure_used_both::<u64> | |
| 231 | 226 | |
| 232 | 227 | // Function uses type parameter from fn in closure. |
| 233 | 228 | pub fn closure_used_fn<G: Default>() -> u32 { |
| ... | ... | @@ -239,10 +234,10 @@ mod methods { |
| 239 | 234 | add_one(3) |
| 240 | 235 | } |
| 241 | 236 | |
| 242 | //~ MONO_ITEM fn methods::Foo::<F>::closure_used_fn::<u32>::{closure#0} | |
| 243 | //~ MONO_ITEM fn methods::Foo::<F>::closure_used_fn::<u64>::{closure#0} | |
| 244 | //~ MONO_ITEM fn methods::Foo::<F>::closure_used_fn::<u32> | |
| 245 | //~ MONO_ITEM fn methods::Foo::<F>::closure_used_fn::<u64> | |
| 237 | //~ MONO_ITEM fn methods::Foo::<F>::closure_used_fn::<u32>::{closure#0} | |
| 238 | //~ MONO_ITEM fn methods::Foo::<F>::closure_used_fn::<u64>::{closure#0} | |
| 239 | //~ MONO_ITEM fn methods::Foo::<F>::closure_used_fn::<u32> | |
| 240 | //~ MONO_ITEM fn methods::Foo::<F>::closure_used_fn::<u64> | |
| 246 | 241 | |
| 247 | 242 | // Function uses type parameter from impl in closure. |
| 248 | 243 | pub fn closure_used_impl<G: Default>() -> u32 { |
| ... | ... | @@ -254,10 +249,10 @@ mod methods { |
| 254 | 249 | add_one(3) |
| 255 | 250 | } |
| 256 | 251 | |
| 257 | //~ MONO_ITEM fn methods::Foo::<u32>::closure_used_impl::<G>::{closure#0} | |
| 258 | //~ MONO_ITEM fn methods::Foo::<u64>::closure_used_impl::<G>::{closure#0} | |
| 259 | //~ MONO_ITEM fn methods::Foo::<u32>::closure_used_impl::<G> | |
| 260 | //~ MONO_ITEM fn methods::Foo::<u64>::closure_used_impl::<G> | |
| 252 | //~ MONO_ITEM fn methods::Foo::<u32>::closure_used_impl::<G>::{closure#0} | |
| 253 | //~ MONO_ITEM fn methods::Foo::<u64>::closure_used_impl::<G>::{closure#0} | |
| 254 | //~ MONO_ITEM fn methods::Foo::<u32>::closure_used_impl::<G> | |
| 255 | //~ MONO_ITEM fn methods::Foo::<u64>::closure_used_impl::<G> | |
| 261 | 256 | |
| 262 | 257 | // Closure uses type parameter in substitutions to another function. |
| 263 | 258 | pub fn closure_used_substs() { |
| ... | ... | @@ -265,15 +260,13 @@ mod methods { |
| 265 | 260 | x() |
| 266 | 261 | } |
| 267 | 262 | |
| 268 | //~ MONO_ITEM fn methods::Foo::<u32>::closure_used_substs::{closure#0} | |
| 269 | //~ MONO_ITEM fn methods::Foo::<u64>::closure_used_substs::{closure#0} | |
| 270 | //~ MONO_ITEM fn methods::Foo::<u32>::closure_used_substs | |
| 271 | //~ MONO_ITEM fn methods::Foo::<u64>::closure_used_substs | |
| 263 | //~ MONO_ITEM fn methods::Foo::<u32>::closure_used_substs::{closure#0} | |
| 264 | //~ MONO_ITEM fn methods::Foo::<u64>::closure_used_substs::{closure#0} | |
| 265 | //~ MONO_ITEM fn methods::Foo::<u32>::closure_used_substs | |
| 266 | //~ MONO_ITEM fn methods::Foo::<u64>::closure_used_substs | |
| 272 | 267 | } |
| 273 | 268 | } |
| 274 | 269 | |
| 275 | ||
| 276 | ||
| 277 | 270 | fn dispatch<T: Default>() { |
| 278 | 271 | functions::no_parameters(); |
| 279 | 272 | functions::unused::<T>(); |
tests/codegen/aarch64-struct-align-128.rs+24-26| ... | ... | @@ -12,14 +12,12 @@ |
| 12 | 12 | #![crate_type = "lib"] |
| 13 | 13 | #![no_core] |
| 14 | 14 | |
| 15 | #[lang="sized"] | |
| 16 | trait Sized { } | |
| 17 | #[lang="freeze"] | |
| 18 | trait Freeze { } | |
| 19 | #[lang="copy"] | |
| 20 | trait Copy { } | |
| 21 | ||
| 22 | ||
| 15 | #[lang = "sized"] | |
| 16 | trait Sized {} | |
| 17 | #[lang = "freeze"] | |
| 18 | trait Freeze {} | |
| 19 | #[lang = "copy"] | |
| 20 | trait Copy {} | |
| 23 | 21 | |
| 24 | 22 | // Passed as `[i64 x 2]`, since it's an aggregate with size <= 128 bits, align < 128 bits. |
| 25 | 23 | #[repr(C)] |
| ... | ... | @@ -31,7 +29,7 @@ pub struct Align8 { |
| 31 | 29 | // repr(transparent), so same as above. |
| 32 | 30 | #[repr(transparent)] |
| 33 | 31 | pub struct Transparent8 { |
| 34 | a: Align8 | |
| 32 | a: Align8, | |
| 35 | 33 | } |
| 36 | 34 | |
| 37 | 35 | // Passed as `[i64 x 2]`, since it's an aggregate with size <= 128 bits, align < 128 bits. |
| ... | ... | @@ -47,8 +45,6 @@ extern "C" { |
| 47 | 45 | fn test_8(a: Align8, b: Transparent8, c: Wrapped8); |
| 48 | 46 | } |
| 49 | 47 | |
| 50 | ||
| 51 | ||
| 52 | 48 | // Passed as `i128`, since it's an aggregate with size <= 128 bits, align = 128 bits. |
| 53 | 49 | // EXCEPT on Linux, where there's a special case to use its unadjusted alignment, |
| 54 | 50 | // making it the same as `Align8`, so it's be passed as `[i64 x 2]`. |
| ... | ... | @@ -62,7 +58,7 @@ pub struct Align16 { |
| 62 | 58 | // repr(transparent), so same as above. |
| 63 | 59 | #[repr(transparent)] |
| 64 | 60 | pub struct Transparent16 { |
| 65 | a: Align16 | |
| 61 | a: Align16, | |
| 66 | 62 | } |
| 67 | 63 | |
| 68 | 64 | // Passed as `i128`, since it's an aggregate with size <= 128 bits, align = 128 bits. |
| ... | ... | @@ -79,8 +75,6 @@ extern "C" { |
| 79 | 75 | fn test_16(a: Align16, b: Transparent16, c: Wrapped16); |
| 80 | 76 | } |
| 81 | 77 | |
| 82 | ||
| 83 | ||
| 84 | 78 | // Passed as `i128`, since it's an aggregate with size <= 128 bits, align = 128 bits. |
| 85 | 79 | #[repr(C)] |
| 86 | 80 | pub struct I128 { |
| ... | ... | @@ -90,13 +84,13 @@ pub struct I128 { |
| 90 | 84 | // repr(transparent), so same as above. |
| 91 | 85 | #[repr(transparent)] |
| 92 | 86 | pub struct TransparentI128 { |
| 93 | a: I128 | |
| 87 | a: I128, | |
| 94 | 88 | } |
| 95 | 89 | |
| 96 | 90 | // Passed as `i128`, since it's an aggregate with size <= 128 bits, align = 128 bits. |
| 97 | 91 | #[repr(C)] |
| 98 | 92 | pub struct WrappedI128 { |
| 99 | pub a: I128 | |
| 93 | pub a: I128, | |
| 100 | 94 | } |
| 101 | 95 | |
| 102 | 96 | extern "C" { |
| ... | ... | @@ -106,8 +100,6 @@ extern "C" { |
| 106 | 100 | fn test_i128(a: I128, b: TransparentI128, c: WrappedI128); |
| 107 | 101 | } |
| 108 | 102 | |
| 109 | ||
| 110 | ||
| 111 | 103 | // Passed as `[2 x i64]`, since it's an aggregate with size <= 128 bits, align < 128 bits. |
| 112 | 104 | // Note that the Linux special case does not apply, because packing is not considered "adjustment". |
| 113 | 105 | #[repr(C)] |
| ... | ... | @@ -119,13 +111,13 @@ pub struct Packed { |
| 119 | 111 | // repr(transparent), so same as above. |
| 120 | 112 | #[repr(transparent)] |
| 121 | 113 | pub struct TransparentPacked { |
| 122 | a: Packed | |
| 114 | a: Packed, | |
| 123 | 115 | } |
| 124 | 116 | |
| 125 | 117 | // Passed as `[2 x i64]`, since it's an aggregate with size <= 128 bits, align < 128 bits. |
| 126 | 118 | #[repr(C)] |
| 127 | 119 | pub struct WrappedPacked { |
| 128 | pub a: Packed | |
| 120 | pub a: Packed, | |
| 129 | 121 | } |
| 130 | 122 | |
| 131 | 123 | extern "C" { |
| ... | ... | @@ -135,13 +127,19 @@ extern "C" { |
| 135 | 127 | fn test_packed(a: Packed, b: TransparentPacked, c: WrappedPacked); |
| 136 | 128 | } |
| 137 | 129 | |
| 138 | ||
| 139 | ||
| 140 | 130 | pub unsafe fn main( |
| 141 | a1: Align8, a2: Transparent8, a3: Wrapped8, | |
| 142 | b1: Align16, b2: Transparent16, b3: Wrapped16, | |
| 143 | c1: I128, c2: TransparentI128, c3: WrappedI128, | |
| 144 | d1: Packed, d2: TransparentPacked, d3: WrappedPacked, | |
| 131 | a1: Align8, | |
| 132 | a2: Transparent8, | |
| 133 | a3: Wrapped8, | |
| 134 | b1: Align16, | |
| 135 | b2: Transparent16, | |
| 136 | b3: Wrapped16, | |
| 137 | c1: I128, | |
| 138 | c2: TransparentI128, | |
| 139 | c3: WrappedI128, | |
| 140 | d1: Packed, | |
| 141 | d2: TransparentPacked, | |
| 142 | d3: WrappedPacked, | |
| 145 | 143 | ) { |
| 146 | 144 | test_8(a1, a2, a3); |
| 147 | 145 | test_16(b1, b2, b3); |
tests/codegen/abi-efiapi.rs+6-6| ... | ... | @@ -17,12 +17,12 @@ |
| 17 | 17 | #![feature(no_core, lang_items)] |
| 18 | 18 | #![no_core] |
| 19 | 19 | |
| 20 | #[lang="sized"] | |
| 21 | trait Sized { } | |
| 22 | #[lang="freeze"] | |
| 23 | trait Freeze { } | |
| 24 | #[lang="copy"] | |
| 25 | trait Copy { } | |
| 20 | #[lang = "sized"] | |
| 21 | trait Sized {} | |
| 22 | #[lang = "freeze"] | |
| 23 | trait Freeze {} | |
| 24 | #[lang = "copy"] | |
| 25 | trait Copy {} | |
| 26 | 26 | |
| 27 | 27 | //x86_64: define win64cc void @has_efiapi |
| 28 | 28 | //i686: define void @has_efiapi |
tests/codegen/abi-main-signature-16bit-c-int.rs+1-3| ... | ... | @@ -6,8 +6,6 @@ |
| 6 | 6 | //@[avr] only-avr |
| 7 | 7 | //@[msp] only-msp430 |
| 8 | 8 | |
| 9 | ||
| 10 | fn main() { | |
| 11 | } | |
| 9 | fn main() {} | |
| 12 | 10 | |
| 13 | 11 | // CHECK: define i16 @main(i16, i8**) |
tests/codegen/abi-main-signature-32bit-c-int.rs+1-2| ... | ... | @@ -6,7 +6,6 @@ |
| 6 | 6 | //@ ignore-avr |
| 7 | 7 | //@ ignore-wasi wasi codegens the main symbol differently |
| 8 | 8 | |
| 9 | fn main() { | |
| 10 | } | |
| 9 | fn main() {} | |
| 11 | 10 | |
| 12 | 11 | // CHECK: define{{( hidden| noundef)*}} i32 @main(i32{{( %0)?}}, ptr{{( %1)?}}) |
tests/codegen/abi-repr-ext.rs+7-5| ... | ... | @@ -24,14 +24,17 @@ |
| 24 | 24 | #![no_std] |
| 25 | 25 | #![no_core] |
| 26 | 26 | |
| 27 | #[lang="sized"] trait Sized { } | |
| 28 | #[lang="freeze"] trait Freeze { } | |
| 29 | #[lang="copy"] trait Copy { } | |
| 27 | #[lang = "sized"] | |
| 28 | trait Sized {} | |
| 29 | #[lang = "freeze"] | |
| 30 | trait Freeze {} | |
| 31 | #[lang = "copy"] | |
| 32 | trait Copy {} | |
| 30 | 33 | |
| 31 | 34 | #[repr(i8)] |
| 32 | 35 | pub enum Type { |
| 33 | 36 | Type1 = 0, |
| 34 | Type2 = 1 | |
| 37 | Type2 = 1, | |
| 35 | 38 | } |
| 36 | 39 | |
| 37 | 40 | // To accommodate rust#97800, one might consider writing the below as: |
| ... | ... | @@ -50,7 +53,6 @@ pub enum Type { |
| 50 | 53 | // riscv-SAME: signext |
| 51 | 54 | // CHECK-SAME: i8 @test() |
| 52 | 55 | |
| 53 | ||
| 54 | 56 | #[no_mangle] |
| 55 | 57 | pub extern "C" fn test() -> Type { |
| 56 | 58 | Type::Type1 |
tests/codegen/abi-x86_64_sysv.rs+8-8| ... | ... | @@ -5,25 +5,25 @@ |
| 5 | 5 | #![crate_type = "lib"] |
| 6 | 6 | |
| 7 | 7 | pub struct S24 { |
| 8 | a: i8, | |
| 9 | b: i8, | |
| 10 | c: i8, | |
| 8 | a: i8, | |
| 9 | b: i8, | |
| 10 | c: i8, | |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | pub struct S48 { |
| 14 | a: i16, | |
| 15 | b: i16, | |
| 16 | c: i8, | |
| 14 | a: i16, | |
| 15 | b: i16, | |
| 16 | c: i8, | |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | // CHECK: i24 @struct_24_bits(i24 |
| 20 | 20 | #[no_mangle] |
| 21 | 21 | pub extern "sysv64" fn struct_24_bits(a: S24) -> S24 { |
| 22 | a | |
| 22 | a | |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | // CHECK: i48 @struct_48_bits(i48 |
| 26 | 26 | #[no_mangle] |
| 27 | 27 | pub extern "sysv64" fn struct_48_bits(a: S48) -> S48 { |
| 28 | a | |
| 28 | a | |
| 29 | 29 | } |
tests/codegen/adjustments.rs+5-6| ... | ... | @@ -5,17 +5,16 @@ |
| 5 | 5 | // Hack to get the correct size for the length part in slices |
| 6 | 6 | // CHECK: @helper([[USIZE:i[0-9]+]] %_1) |
| 7 | 7 | #[no_mangle] |
| 8 | pub fn helper(_: usize) { | |
| 9 | } | |
| 8 | pub fn helper(_: usize) {} | |
| 10 | 9 | |
| 11 | 10 | // CHECK-LABEL: @no_op_slice_adjustment |
| 12 | 11 | #[no_mangle] |
| 13 | 12 | pub fn no_op_slice_adjustment(x: &[u8]) -> &[u8] { |
| 14 | 13 | // We used to generate an extra alloca and memcpy for the block's trailing expression value, so |
| 15 | 14 | // check that we copy directly to the return value slot |
| 16 | // CHECK: %0 = insertvalue { ptr, [[USIZE]] } poison, ptr %x.0, 0 | |
| 17 | // CHECK: %1 = insertvalue { ptr, [[USIZE]] } %0, [[USIZE]] %x.1, 1 | |
| 18 | // CHECK: ret { ptr, [[USIZE]] } %1 | |
| 15 | // CHECK: %0 = insertvalue { ptr, [[USIZE]] } poison, ptr %x.0, 0 | |
| 16 | // CHECK: %1 = insertvalue { ptr, [[USIZE]] } %0, [[USIZE]] %x.1, 1 | |
| 17 | // CHECK: ret { ptr, [[USIZE]] } %1 | |
| 19 | 18 | { x } |
| 20 | 19 | } |
| 21 | 20 | |
| ... | ... | @@ -24,6 +23,6 @@ pub fn no_op_slice_adjustment(x: &[u8]) -> &[u8] { |
| 24 | 23 | pub fn no_op_slice_adjustment2(x: &[u8]) -> &[u8] { |
| 25 | 24 | // We used to generate an extra alloca and memcpy for the function's return value, so check |
| 26 | 25 | // that there's no memcpy (the slice is written to sret_slot element-wise) |
| 27 | // CHECK-NOT: call void @llvm.memcpy. | |
| 26 | // CHECK-NOT: call void @llvm.memcpy. | |
| 28 | 27 | no_op_slice_adjustment(x) |
| 29 | 28 | } |
tests/codegen/align-byval.rs+12-9| ... | ... | @@ -23,9 +23,12 @@ |
| 23 | 23 | #![no_std] |
| 24 | 24 | #![no_core] |
| 25 | 25 | |
| 26 | #[lang="sized"] trait Sized { } | |
| 27 | #[lang="freeze"] trait Freeze { } | |
| 28 | #[lang="copy"] trait Copy { } | |
| 26 | #[lang = "sized"] | |
| 27 | trait Sized {} | |
| 28 | #[lang = "freeze"] | |
| 29 | trait Freeze {} | |
| 30 | #[lang = "copy"] | |
| 31 | trait Copy {} | |
| 29 | 32 | |
| 30 | 33 | impl Copy for i32 {} |
| 31 | 34 | impl Copy for i64 {} |
| ... | ... | @@ -58,7 +61,7 @@ pub struct ForceAlign4 { |
| 58 | 61 | pub struct NaturalAlign8 { |
| 59 | 62 | a: i64, |
| 60 | 63 | b: i64, |
| 61 | c: i64 | |
| 64 | c: i64, | |
| 62 | 65 | } |
| 63 | 66 | |
| 64 | 67 | // On i686-windows, this is passed by reference (because alignment is >4 and requested/forced), |
| ... | ... | @@ -68,7 +71,7 @@ pub struct NaturalAlign8 { |
| 68 | 71 | pub struct ForceAlign8 { |
| 69 | 72 | a: i64, |
| 70 | 73 | b: i64, |
| 71 | c: i64 | |
| 74 | c: i64, | |
| 72 | 75 | } |
| 73 | 76 | |
| 74 | 77 | // On i686-windows, this is passed on stack, because requested alignment is <=4. |
| ... | ... | @@ -77,28 +80,28 @@ pub struct ForceAlign8 { |
| 77 | 80 | pub struct LowerFA8 { |
| 78 | 81 | a: i64, |
| 79 | 82 | b: i64, |
| 80 | c: i64 | |
| 83 | c: i64, | |
| 81 | 84 | } |
| 82 | 85 | |
| 83 | 86 | // On i686-windows, this is passed by reference, because it contains a field with |
| 84 | 87 | // requested/forced alignment. |
| 85 | 88 | #[repr(C)] |
| 86 | 89 | pub struct WrappedFA8 { |
| 87 | a: ForceAlign8 | |
| 90 | a: ForceAlign8, | |
| 88 | 91 | } |
| 89 | 92 | |
| 90 | 93 | // On i686-windows, this has the same ABI as ForceAlign8, i.e. passed by reference. |
| 91 | 94 | #[repr(transparent)] |
| 92 | 95 | pub struct TransparentFA8 { |
| 93 | 96 | _0: (), |
| 94 | a: ForceAlign8 | |
| 97 | a: ForceAlign8, | |
| 95 | 98 | } |
| 96 | 99 | |
| 97 | 100 | #[repr(C)] |
| 98 | 101 | #[repr(align(16))] |
| 99 | 102 | pub struct ForceAlign16 { |
| 100 | 103 | a: [i32; 16], |
| 101 | b: i8 | |
| 104 | b: i8, | |
| 102 | 105 | } |
| 103 | 106 | |
| 104 | 107 | // CHECK-LABEL: @call_na1 |
tests/codegen/align-enum.rs+3-3| ... | ... | @@ -18,8 +18,8 @@ pub struct Nested64 { |
| 18 | 18 | // CHECK-LABEL: @align64 |
| 19 | 19 | #[no_mangle] |
| 20 | 20 | pub fn align64(a: u32) -> Align64 { |
| 21 | // CHECK: %a64 = alloca [64 x i8], align 64 | |
| 22 | // CHECK: call void @llvm.memcpy.{{.*}}(ptr align 64 %{{.*}}, ptr align 64 %{{.*}}, i{{[0-9]+}} 64, i1 false) | |
| 21 | // CHECK: %a64 = alloca [64 x i8], align 64 | |
| 22 | // CHECK: call void @llvm.memcpy.{{.*}}(ptr align 64 %{{.*}}, ptr align 64 %{{.*}}, i{{[0-9]+}} 64, i1 false) | |
| 23 | 23 | let a64 = Align64::A(a); |
| 24 | 24 | a64 |
| 25 | 25 | } |
| ... | ... | @@ -27,7 +27,7 @@ pub fn align64(a: u32) -> Align64 { |
| 27 | 27 | // CHECK-LABEL: @nested64 |
| 28 | 28 | #[no_mangle] |
| 29 | 29 | pub fn nested64(a: u8, b: u32, c: u16) -> Nested64 { |
| 30 | // CHECK: %n64 = alloca [128 x i8], align 64 | |
| 30 | // CHECK: %n64 = alloca [128 x i8], align 64 | |
| 31 | 31 | let n64 = Nested64 { a, b: Align64::B(b), c }; |
| 32 | 32 | n64 |
| 33 | 33 | } |
tests/codegen/align-offset.rs-1| ... | ... | @@ -53,7 +53,6 @@ pub fn align_offset_word_slice(slice: &[Align4]) -> usize { |
| 53 | 53 | slice.as_ptr().align_offset(32) |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | ||
| 57 | 56 | // CHECK-LABEL: @align_offset_word_ptr(ptr{{.+}}%ptr |
| 58 | 57 | #[no_mangle] |
| 59 | 58 | pub fn align_offset_word_ptr(ptr: *const Align4) -> usize { |
tests/codegen/align-struct.rs+7-7| ... | ... | @@ -25,9 +25,9 @@ pub enum Enum64 { |
| 25 | 25 | |
| 26 | 26 | // CHECK-LABEL: @align64 |
| 27 | 27 | #[no_mangle] |
| 28 | pub fn align64(i : i32) -> Align64 { | |
| 29 | // CHECK: %a64 = alloca [64 x i8], align 64 | |
| 30 | // CHECK: call void @llvm.memcpy.{{.*}}(ptr align 64 %{{.*}}, ptr align 64 %{{.*}}, i{{[0-9]+}} 64, i1 false) | |
| 28 | pub fn align64(i: i32) -> Align64 { | |
| 29 | // CHECK: %a64 = alloca [64 x i8], align 64 | |
| 30 | // CHECK: call void @llvm.memcpy.{{.*}}(ptr align 64 %{{.*}}, ptr align 64 %{{.*}}, i{{[0-9]+}} 64, i1 false) | |
| 31 | 31 | let a64 = Align64(i); |
| 32 | 32 | a64 |
| 33 | 33 | } |
| ... | ... | @@ -37,14 +37,14 @@ pub fn align64(i : i32) -> Align64 { |
| 37 | 37 | // CHECK-LABEL: @align64_load |
| 38 | 38 | #[no_mangle] |
| 39 | 39 | pub fn align64_load(a: Align64) -> i32 { |
| 40 | // CHECK: {{%.*}} = load i32, ptr {{%.*}}, align 64 | |
| 40 | // CHECK: {{%.*}} = load i32, ptr {{%.*}}, align 64 | |
| 41 | 41 | a.0 |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | // CHECK-LABEL: @nested64 |
| 45 | 45 | #[no_mangle] |
| 46 | 46 | pub fn nested64(a: Align64, b: i32, c: i32, d: i8) -> Nested64 { |
| 47 | // CHECK: %n64 = alloca [128 x i8], align 64 | |
| 47 | // CHECK: %n64 = alloca [128 x i8], align 64 | |
| 48 | 48 | let n64 = Nested64 { a, b, c, d }; |
| 49 | 49 | n64 |
| 50 | 50 | } |
| ... | ... | @@ -52,7 +52,7 @@ pub fn nested64(a: Align64, b: i32, c: i32, d: i8) -> Nested64 { |
| 52 | 52 | // CHECK-LABEL: @enum4 |
| 53 | 53 | #[no_mangle] |
| 54 | 54 | pub fn enum4(a: i32) -> Enum4 { |
| 55 | // CHECK: %e4 = alloca [8 x i8], align 4 | |
| 55 | // CHECK: %e4 = alloca [8 x i8], align 4 | |
| 56 | 56 | let e4 = Enum4::A(a); |
| 57 | 57 | e4 |
| 58 | 58 | } |
| ... | ... | @@ -60,7 +60,7 @@ pub fn enum4(a: i32) -> Enum4 { |
| 60 | 60 | // CHECK-LABEL: @enum64 |
| 61 | 61 | #[no_mangle] |
| 62 | 62 | pub fn enum64(a: Align64) -> Enum64 { |
| 63 | // CHECK: %e64 = alloca [128 x i8], align 64 | |
| 63 | // CHECK: %e64 = alloca [128 x i8], align 64 | |
| 64 | 64 | let e64 = Enum64::A(a); |
| 65 | 65 | e64 |
| 66 | 66 | } |
tests/codegen/array-cmp.rs+6-5| ... | ... | @@ -10,9 +10,10 @@ |
| 10 | 10 | #[no_mangle] |
| 11 | 11 | pub fn compare() -> bool { |
| 12 | 12 | let bytes = 12.5f32.to_ne_bytes(); |
| 13 | bytes == if cfg!(target_endian = "big") { | |
| 14 | [0x41, 0x48, 0x00, 0x00] | |
| 15 | } else { | |
| 16 | [0x00, 0x00, 0x48, 0x41] | |
| 17 | } | |
| 13 | bytes | |
| 14 | == if cfg!(target_endian = "big") { | |
| 15 | [0x41, 0x48, 0x00, 0x00] | |
| 16 | } else { | |
| 17 | [0x00, 0x00, 0x48, 0x41] | |
| 18 | } | |
| 18 | 19 | } |
tests/codegen/asm-maybe-uninit.rs+1-1| ... | ... | @@ -4,8 +4,8 @@ |
| 4 | 4 | #![crate_type = "rlib"] |
| 5 | 5 | #![allow(asm_sub_register)] |
| 6 | 6 | |
| 7 | use std::mem::MaybeUninit; | |
| 8 | 7 | use std::arch::asm; |
| 8 | use std::mem::MaybeUninit; | |
| 9 | 9 | |
| 10 | 10 | // CHECK-LABEL: @int |
| 11 | 11 | #[no_mangle] |
tests/codegen/asm-sanitize-llvm.rs+2-6| ... | ... | @@ -21,14 +21,10 @@ trait Copy {} |
| 21 | 21 | |
| 22 | 22 | pub unsafe fn we_escape_dollar_signs() { |
| 23 | 23 | // CHECK: call void asm sideeffect alignstack inteldialect "banana$$:" |
| 24 | asm!( | |
| 25 | r"banana$:", | |
| 26 | ) | |
| 24 | asm!(r"banana$:",) | |
| 27 | 25 | } |
| 28 | 26 | |
| 29 | 27 | pub unsafe fn we_escape_escapes_too() { |
| 30 | 28 | // CHECK: call void asm sideeffect alignstack inteldialect "banana\{{(\\|5C)}}36:" |
| 31 | asm!( | |
| 32 | r"banana\36:", | |
| 33 | ) | |
| 29 | asm!(r"banana\36:",) | |
| 34 | 30 | } |
tests/codegen/atomicptr.rs+1-2| ... | ... | @@ -6,13 +6,12 @@ |
| 6 | 6 | |
| 7 | 7 | //@ compile-flags: -O -Cno-prepopulate-passes |
| 8 | 8 | #![crate_type = "lib"] |
| 9 | ||
| 10 | 9 | #![feature(strict_provenance)] |
| 11 | 10 | #![feature(strict_provenance_atomic_ptr)] |
| 12 | 11 | |
| 12 | use std::ptr::without_provenance_mut; | |
| 13 | 13 | use std::sync::atomic::AtomicPtr; |
| 14 | 14 | use std::sync::atomic::Ordering::Relaxed; |
| 15 | use std::ptr::without_provenance_mut; | |
| 16 | 15 | |
| 17 | 16 | // Portability hack so that we can say [[USIZE]] instead of i64/i32/i16 for usize. |
| 18 | 17 | // CHECK: @helper([[USIZE:i[0-9]+]] noundef %_1) |
tests/codegen/autovectorize-f32x4.rs+13-18| ... | ... | @@ -5,25 +5,20 @@ |
| 5 | 5 | // CHECK-LABEL: @auto_vectorize_direct |
| 6 | 6 | #[no_mangle] |
| 7 | 7 | pub fn auto_vectorize_direct(a: [f32; 4], b: [f32; 4]) -> [f32; 4] { |
| 8 | // CHECK: load <4 x float> | |
| 9 | // CHECK: load <4 x float> | |
| 10 | // CHECK: fadd <4 x float> | |
| 11 | // CHECK: store <4 x float> | |
| 12 | [ | |
| 13 | a[0] + b[0], | |
| 14 | a[1] + b[1], | |
| 15 | a[2] + b[2], | |
| 16 | a[3] + b[3], | |
| 17 | ] | |
| 8 | // CHECK: load <4 x float> | |
| 9 | // CHECK: load <4 x float> | |
| 10 | // CHECK: fadd <4 x float> | |
| 11 | // CHECK: store <4 x float> | |
| 12 | [a[0] + b[0], a[1] + b[1], a[2] + b[2], a[3] + b[3]] | |
| 18 | 13 | } |
| 19 | 14 | |
| 20 | 15 | // CHECK-LABEL: @auto_vectorize_loop |
| 21 | 16 | #[no_mangle] |
| 22 | 17 | pub fn auto_vectorize_loop(a: [f32; 4], b: [f32; 4]) -> [f32; 4] { |
| 23 | // CHECK: load <4 x float> | |
| 24 | // CHECK: load <4 x float> | |
| 25 | // CHECK: fadd <4 x float> | |
| 26 | // CHECK: store <4 x float> | |
| 18 | // CHECK: load <4 x float> | |
| 19 | // CHECK: load <4 x float> | |
| 20 | // CHECK: fadd <4 x float> | |
| 21 | // CHECK: store <4 x float> | |
| 27 | 22 | let mut c = [0.0; 4]; |
| 28 | 23 | for i in 0..4 { |
| 29 | 24 | c[i] = a[i] + b[i]; |
| ... | ... | @@ -34,9 +29,9 @@ pub fn auto_vectorize_loop(a: [f32; 4], b: [f32; 4]) -> [f32; 4] { |
| 34 | 29 | // CHECK-LABEL: @auto_vectorize_array_from_fn |
| 35 | 30 | #[no_mangle] |
| 36 | 31 | pub fn auto_vectorize_array_from_fn(a: [f32; 4], b: [f32; 4]) -> [f32; 4] { |
| 37 | // CHECK: load <4 x float> | |
| 38 | // CHECK: load <4 x float> | |
| 39 | // CHECK: fadd <4 x float> | |
| 40 | // CHECK: store <4 x float> | |
| 32 | // CHECK: load <4 x float> | |
| 33 | // CHECK: load <4 x float> | |
| 34 | // CHECK: fadd <4 x float> | |
| 35 | // CHECK: store <4 x float> | |
| 41 | 36 | std::array::from_fn(|i| a[i] + b[i]) |
| 42 | 37 | } |
tests/codegen/auxiliary/extern_decl.rs+3-1| ... | ... | @@ -5,7 +5,9 @@ |
| 5 | 5 | #![crate_type = "lib"] |
| 6 | 6 | |
| 7 | 7 | #[no_mangle] |
| 8 | pub fn extern_fn() -> u8 { unsafe { extern_static } } | |
| 8 | pub fn extern_fn() -> u8 { | |
| 9 | unsafe { extern_static } | |
| 10 | } | |
| 9 | 11 | |
| 10 | 12 | #[no_mangle] |
| 11 | 13 | pub static mut extern_static: u8 = 71; |
tests/codegen/auxiliary/nounwind.rs+1-2| ... | ... | @@ -1,3 +1,2 @@ |
| 1 | 1 | #[no_mangle] |
| 2 | pub fn bar() { | |
| 3 | } | |
| 2 | pub fn bar() {} |
tests/codegen/avr/avr-func-addrspace.rs+14-8| ... | ... | @@ -14,15 +14,18 @@ |
| 14 | 14 | #![no_core] |
| 15 | 15 | |
| 16 | 16 | #[lang = "sized"] |
| 17 | pub trait Sized { } | |
| 17 | pub trait Sized {} | |
| 18 | 18 | #[lang = "copy"] |
| 19 | pub trait Copy { } | |
| 19 | pub trait Copy {} | |
| 20 | 20 | #[lang = "receiver"] |
| 21 | pub trait Receiver { } | |
| 21 | pub trait Receiver {} | |
| 22 | 22 | #[lang = "tuple_trait"] |
| 23 | pub trait Tuple { } | |
| 23 | pub trait Tuple {} | |
| 24 | 24 | |
| 25 | pub struct Result<T, E> { _a: T, _b: E } | |
| 25 | pub struct Result<T, E> { | |
| 26 | _a: T, | |
| 27 | _b: E, | |
| 28 | } | |
| 26 | 29 | |
| 27 | 30 | impl Copy for usize {} |
| 28 | 31 | impl Copy for &usize {} |
| ... | ... | @@ -39,7 +42,7 @@ pub trait FnOnce<Args: Tuple> { |
| 39 | 42 | } |
| 40 | 43 | |
| 41 | 44 | #[lang = "fn_mut"] |
| 42 | pub trait FnMut<Args: Tuple> : FnOnce<Args> { | |
| 45 | pub trait FnMut<Args: Tuple>: FnOnce<Args> { | |
| 43 | 46 | extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output; |
| 44 | 47 | } |
| 45 | 48 | |
| ... | ... | @@ -64,7 +67,7 @@ fn arbitrary_black_box(ptr: &usize, _: &mut u32) -> Result<(), ()> { |
| 64 | 67 | |
| 65 | 68 | #[inline(never)] |
| 66 | 69 | #[no_mangle] |
| 67 | fn call_through_fn_trait(a: &mut impl Fn<(), Output=()>) { | |
| 70 | fn call_through_fn_trait(a: &mut impl Fn<(), Output = ()>) { | |
| 68 | 71 | (*a)() |
| 69 | 72 | } |
| 70 | 73 | |
| ... | ... | @@ -110,7 +113,10 @@ pub unsafe fn transmute_fn_ptr_to_data(x: fn()) -> *const () { |
| 110 | 113 | transmute(x) |
| 111 | 114 | } |
| 112 | 115 | |
| 113 | pub enum Either<T, U> { A(T), B(U) } | |
| 116 | pub enum Either<T, U> { | |
| 117 | A(T), | |
| 118 | B(U), | |
| 119 | } | |
| 114 | 120 | |
| 115 | 121 | // Previously, we would codegen this as passing/returning a scalar pair of `{ i8, ptr }`, |
| 116 | 122 | // with the `ptr` field representing both `&i32` and `fn()` depending on the variant. |
tests/codegen/binary-search-index-no-bound-check.rs+1-5| ... | ... | @@ -11,11 +11,7 @@ pub fn binary_search_index_no_bounds_check(s: &[u8]) -> u8 { |
| 11 | 11 | // CHECK-NOT: slice_start_index_len_fail |
| 12 | 12 | // CHECK-NOT: slice_end_index_len_fail |
| 13 | 13 | // CHECK-NOT: panic_bounds_check |
| 14 | if let Ok(idx) = s.binary_search(&b'\\') { | |
| 15 | s[idx] | |
| 16 | } else { | |
| 17 | 42 | |
| 18 | } | |
| 14 | if let Ok(idx) = s.binary_search(&b'\\') { s[idx] } else { 42 } | |
| 19 | 15 | } |
| 20 | 16 | |
| 21 | 17 | // Similarly, check that `partition_point` is known to return a valid fencepost. |
tests/codegen/bool-cmp.rs+4-4| ... | ... | @@ -10,9 +10,9 @@ use std::cmp::Ordering; |
| 10 | 10 | // CHECK-LABEL: @cmp_bool |
| 11 | 11 | #[no_mangle] |
| 12 | 12 | pub fn cmp_bool(a: bool, b: bool) -> Ordering { |
| 13 | // LLVM 10 produces (zext a) + (sext b), but the final lowering is (zext a) - (zext b). | |
| 14 | // CHECK: zext i1 | |
| 15 | // CHECK: {{z|s}}ext i1 | |
| 16 | // CHECK: {{sub|add}} nsw | |
| 13 | // LLVM 10 produces (zext a) + (sext b), but the final lowering is (zext a) - (zext b). | |
| 14 | // CHECK: zext i1 | |
| 15 | // CHECK: {{z|s}}ext i1 | |
| 16 | // CHECK: {{sub|add}} nsw | |
| 17 | 17 | a.cmp(&b) |
| 18 | 18 | } |
tests/codegen/branch-protection.rs+3-4| ... | ... | @@ -12,12 +12,11 @@ |
| 12 | 12 | #![feature(no_core, lang_items)] |
| 13 | 13 | #![no_core] |
| 14 | 14 | |
| 15 | #[lang="sized"] | |
| 16 | trait Sized { } | |
| 15 | #[lang = "sized"] | |
| 16 | trait Sized {} | |
| 17 | 17 | |
| 18 | 18 | // A basic test function. |
| 19 | pub fn test() { | |
| 20 | } | |
| 19 | pub fn test() {} | |
| 21 | 20 | |
| 22 | 21 | // BTI: !"branch-target-enforcement", i32 1 |
| 23 | 22 | // BTI: !"sign-return-address", i32 0 |
tests/codegen/cast-target-abi.rs+6-7| ... | ... | @@ -18,9 +18,12 @@ |
| 18 | 18 | #![no_std] |
| 19 | 19 | #![no_core] |
| 20 | 20 | |
| 21 | #[lang="sized"] trait Sized { } | |
| 22 | #[lang="freeze"] trait Freeze { } | |
| 23 | #[lang="copy"] trait Copy { } | |
| 21 | #[lang = "sized"] | |
| 22 | trait Sized {} | |
| 23 | #[lang = "freeze"] | |
| 24 | trait Freeze {} | |
| 25 | #[lang = "copy"] | |
| 26 | trait Copy {} | |
| 24 | 27 | |
| 25 | 28 | // This struct will be passed as a single `i64` or `i32`. |
| 26 | 29 | // 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 { |
| 104 | 107 | // powerpc64: [[RETVAL:%.+]] = alloca [4 x i8], align 2 |
| 105 | 108 | // powerpc64: call void @returns_twou16s(ptr {{.+}} [[RETVAL]]) |
| 106 | 109 | |
| 107 | ||
| 108 | 110 | // The other targets copy the cast ABI type to an alloca. |
| 109 | 111 | |
| 110 | 112 | // aarch64: [[ABI_ALLOCA:%.+]] = alloca [8 x i8], align [[ABI_ALIGN:8]] |
| ... | ... | @@ -151,7 +153,6 @@ pub unsafe fn return_fiveu16s() -> FiveU16s { |
| 151 | 153 | |
| 152 | 154 | // powerpc64: call void @returns_fiveu16s(ptr {{.+}} [[RET_PTR]]) |
| 153 | 155 | |
| 154 | ||
| 155 | 156 | // The other targets copy the cast ABI type to the sret pointer. |
| 156 | 157 | |
| 157 | 158 | // aarch64: [[ABI_ALLOCA:%.+]] = alloca [16 x i8], align [[ABI_ALIGN:8]] |
| ... | ... | @@ -199,7 +200,6 @@ pub unsafe fn return_doubledouble() -> DoubleDouble { |
| 199 | 200 | // powerpc64: [[RETVAL:%.+]] = alloca [16 x i8], align 8 |
| 200 | 201 | // powerpc64: call void @returns_doubledouble(ptr {{.+}} [[RETVAL]]) |
| 201 | 202 | |
| 202 | ||
| 203 | 203 | // The other targets copy the cast ABI type to an alloca. |
| 204 | 204 | |
| 205 | 205 | // aarch64: [[ABI_ALLOCA:%.+]] = alloca [16 x i8], align [[ABI_ALIGN:8]] |
| ... | ... | @@ -266,7 +266,6 @@ pub unsafe fn return_doublefloat() -> DoubleFloat { |
| 266 | 266 | // powerpc64: [[RETVAL:%.+]] = alloca [16 x i8], align 8 |
| 267 | 267 | // powerpc64: call void @returns_doublefloat(ptr {{.+}} [[RETVAL]]) |
| 268 | 268 | |
| 269 | ||
| 270 | 269 | // The other targets copy the cast ABI type to an alloca. |
| 271 | 270 | |
| 272 | 271 | // aarch64: [[ABI_ALLOCA:%.+]] = alloca [16 x i8], align [[ABI_ALIGN:8]] |
tests/codegen/cf-protection.rs+3-4| ... | ... | @@ -13,12 +13,11 @@ |
| 13 | 13 | #![feature(no_core, lang_items)] |
| 14 | 14 | #![no_core] |
| 15 | 15 | |
| 16 | #[lang="sized"] | |
| 17 | trait Sized { } | |
| 16 | #[lang = "sized"] | |
| 17 | trait Sized {} | |
| 18 | 18 | |
| 19 | 19 | // A basic test function. |
| 20 | pub fn test() { | |
| 21 | } | |
| 20 | pub fn test() {} | |
| 22 | 21 | |
| 23 | 22 | // undefined-NOT: !"cf-protection-branch" |
| 24 | 23 | // undefined-NOT: !"cf-protection-return" |
tests/codegen/cffi/ffi-const.rs+5-2| ... | ... | @@ -2,12 +2,15 @@ |
| 2 | 2 | #![crate_type = "lib"] |
| 3 | 3 | #![feature(ffi_const)] |
| 4 | 4 | |
| 5 | pub fn bar() { unsafe { foo() } } | |
| 5 | pub fn bar() { | |
| 6 | unsafe { foo() } | |
| 7 | } | |
| 6 | 8 | |
| 7 | 9 | extern "C" { |
| 8 | 10 | // CHECK-LABEL: declare{{.*}}void @foo() |
| 9 | 11 | // CHECK-SAME: [[ATTRS:#[0-9]+]] |
| 10 | 12 | // The attribute changed from `readnone` to `memory(none)` with LLVM 16.0. |
| 11 | 13 | // CHECK-DAG: attributes [[ATTRS]] = { {{.*}}{{readnone|memory\(none\)}}{{.*}} } |
| 12 | #[ffi_const] pub fn foo(); | |
| 14 | #[ffi_const] | |
| 15 | pub fn foo(); | |
| 13 | 16 | } |
tests/codegen/cffi/ffi-out-of-bounds-loads.rs+6-3| ... | ... | @@ -13,9 +13,12 @@ |
| 13 | 13 | #![no_std] |
| 14 | 14 | #![no_core] |
| 15 | 15 | |
| 16 | #[lang="sized"] trait Sized { } | |
| 17 | #[lang="freeze"] trait Freeze { } | |
| 18 | #[lang="copy"] trait Copy { } | |
| 16 | #[lang = "sized"] | |
| 17 | trait Sized {} | |
| 18 | #[lang = "freeze"] | |
| 19 | trait Freeze {} | |
| 20 | #[lang = "copy"] | |
| 21 | trait Copy {} | |
| 19 | 22 | |
| 20 | 23 | #[repr(C)] |
| 21 | 24 | struct S { |
tests/codegen/cffi/ffi-pure.rs+5-2| ... | ... | @@ -2,12 +2,15 @@ |
| 2 | 2 | #![crate_type = "lib"] |
| 3 | 3 | #![feature(ffi_pure)] |
| 4 | 4 | |
| 5 | pub fn bar() { unsafe { foo() } } | |
| 5 | pub fn bar() { | |
| 6 | unsafe { foo() } | |
| 7 | } | |
| 6 | 8 | |
| 7 | 9 | extern "C" { |
| 8 | 10 | // CHECK-LABEL: declare{{.*}}void @foo() |
| 9 | 11 | // CHECK-SAME: [[ATTRS:#[0-9]+]] |
| 10 | 12 | // The attribute changed from `readonly` to `memory(read)` with LLVM 16.0. |
| 11 | 13 | // CHECK-DAG: attributes [[ATTRS]] = { {{.*}}{{readonly|memory\(read\)}}{{.*}} } |
| 12 | #[ffi_pure] pub fn foo(); | |
| 14 | #[ffi_pure] | |
| 15 | pub fn foo(); | |
| 13 | 16 | } |
tests/codegen/cfguard-checks.rs+1-2| ... | ... | @@ -4,8 +4,7 @@ |
| 4 | 4 | #![crate_type = "lib"] |
| 5 | 5 | |
| 6 | 6 | // A basic test function. |
| 7 | pub fn test() { | |
| 8 | } | |
| 7 | pub fn test() {} | |
| 9 | 8 | |
| 10 | 9 | // Ensure the module flag cfguard=2 is present |
| 11 | 10 | // CHECK: !"cfguard", i32 2 |
tests/codegen/cfguard-disabled.rs+1-2| ... | ... | @@ -4,8 +4,7 @@ |
| 4 | 4 | #![crate_type = "lib"] |
| 5 | 5 | |
| 6 | 6 | // A basic test function. |
| 7 | pub fn test() { | |
| 8 | } | |
| 7 | pub fn test() {} | |
| 9 | 8 | |
| 10 | 9 | // Ensure the module flag cfguard is not present |
| 11 | 10 | // CHECK-NOT: !"cfguard" |
tests/codegen/cfguard-nochecks.rs+1-2| ... | ... | @@ -4,8 +4,7 @@ |
| 4 | 4 | #![crate_type = "lib"] |
| 5 | 5 | |
| 6 | 6 | // A basic test function. |
| 7 | pub fn test() { | |
| 8 | } | |
| 7 | pub fn test() {} | |
| 9 | 8 | |
| 10 | 9 | // Ensure the module flag cfguard=1 is present |
| 11 | 10 | // CHECK: !"cfguard", i32 1 |
tests/codegen/cfguard-non-msvc.rs+1-2| ... | ... | @@ -4,8 +4,7 @@ |
| 4 | 4 | #![crate_type = "lib"] |
| 5 | 5 | |
| 6 | 6 | // A basic test function. |
| 7 | pub fn test() { | |
| 8 | } | |
| 7 | pub fn test() {} | |
| 9 | 8 | |
| 10 | 9 | // Ensure the cfguard module flag is not added for non-MSVC targets. |
| 11 | 10 | // CHECK-NOT: !"cfguard" |
tests/codegen/coercions.rs+1-1| ... | ... | @@ -7,7 +7,7 @@ static X: i32 = 5; |
| 7 | 7 | // CHECK-LABEL: @raw_ptr_to_raw_ptr_noop |
| 8 | 8 | // CHECK-NOT: alloca |
| 9 | 9 | #[no_mangle] |
| 10 | pub fn raw_ptr_to_raw_ptr_noop() -> *const i32{ | |
| 10 | pub fn raw_ptr_to_raw_ptr_noop() -> *const i32 { | |
| 11 | 11 | &X as *const i32 |
| 12 | 12 | } |
| 13 | 13 |
tests/codegen/constant-branch.rs+8-24| ... | ... | @@ -8,18 +8,10 @@ |
| 8 | 8 | #[no_mangle] |
| 9 | 9 | pub fn if_bool() { |
| 10 | 10 | // CHECK: br label %{{.+}} |
| 11 | _ = if true { | |
| 12 | 0 | |
| 13 | } else { | |
| 14 | 1 | |
| 15 | }; | |
| 11 | _ = if true { 0 } else { 1 }; | |
| 16 | 12 | |
| 17 | 13 | // CHECK: br label %{{.+}} |
| 18 | _ = if false { | |
| 19 | 0 | |
| 20 | } else { | |
| 21 | 1 | |
| 22 | }; | |
| 14 | _ = if false { 0 } else { 1 }; | |
| 23 | 15 | } |
| 24 | 16 | |
| 25 | 17 | // CHECK-LABEL: @if_constant_int_eq |
| ... | ... | @@ -27,18 +19,10 @@ pub fn if_bool() { |
| 27 | 19 | pub fn if_constant_int_eq() { |
| 28 | 20 | let val = 0; |
| 29 | 21 | // CHECK: br label %{{.+}} |
| 30 | _ = if val == 0 { | |
| 31 | 0 | |
| 32 | } else { | |
| 33 | 1 | |
| 34 | }; | |
| 22 | _ = if val == 0 { 0 } else { 1 }; | |
| 35 | 23 | |
| 36 | 24 | // CHECK: br label %{{.+}} |
| 37 | _ = if val == 1 { | |
| 38 | 0 | |
| 39 | } else { | |
| 40 | 1 | |
| 41 | }; | |
| 25 | _ = if val == 1 { 0 } else { 1 }; | |
| 42 | 26 | } |
| 43 | 27 | |
| 44 | 28 | // CHECK-LABEL: @if_constant_match |
| ... | ... | @@ -48,19 +32,19 @@ pub fn if_constant_match() { |
| 48 | 32 | _ = match 1 { |
| 49 | 33 | 1 => 2, |
| 50 | 34 | 2 => 3, |
| 51 | _ => 4 | |
| 35 | _ => 4, | |
| 52 | 36 | }; |
| 53 | 37 | |
| 54 | 38 | // CHECK: br label %{{.+}} |
| 55 | 39 | _ = match 1 { |
| 56 | 40 | 2 => 3, |
| 57 | _ => 4 | |
| 41 | _ => 4, | |
| 58 | 42 | }; |
| 59 | 43 | |
| 60 | 44 | // CHECK: br label %[[MINUS1:.+]] |
| 61 | 45 | _ = match -1 { |
| 62 | // CHECK: [[MINUS1]]: | |
| 63 | // CHECK: store i32 1 | |
| 46 | // CHECK: [[MINUS1]]: | |
| 47 | // CHECK: store i32 1 | |
| 64 | 48 | -1 => 1, |
| 65 | 49 | _ => 0, |
| 66 | 50 | } |
tests/codegen/coroutine-debug-msvc.rs+7-6| ... | ... | @@ -11,7 +11,8 @@ |
| 11 | 11 | use std::ops::Coroutine; |
| 12 | 12 | |
| 13 | 13 | fn coroutine_test() -> impl Coroutine<Yield = i32, Return = ()> { |
| 14 | #[coroutine] || { | |
| 14 | #[coroutine] | |
| 15 | || { | |
| 15 | 16 | yield 0; |
| 16 | 17 | let s = String::from("foo"); |
| 17 | 18 | yield 1; |
| ... | ... | @@ -23,23 +24,23 @@ fn coroutine_test() -> impl Coroutine<Yield = i32, Return = ()> { |
| 23 | 24 | // CHECK-DAG: [[GEN:!.*]] = !DICompositeType(tag: DW_TAG_union_type, name: "enum2$<coroutine_debug_msvc::coroutine_test::coroutine_env$0>" |
| 24 | 25 | // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "variant0", scope: [[GEN]], |
| 25 | 26 | // For brevity, we only check the struct name and members of the last variant. |
| 26 | // CHECK-SAME: file: [[FILE:![0-9]*]], line: 14, | |
| 27 | // CHECK-SAME: file: [[FILE:![0-9]*]], line: 15, | |
| 27 | 28 | // CHECK-NOT: flags: DIFlagArtificial |
| 28 | 29 | // CHECK-SAME: ) |
| 29 | 30 | // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "variant1", scope: [[GEN]], |
| 30 | // CHECK-SAME: file: [[FILE]], line: 18, | |
| 31 | // CHECK-SAME: file: [[FILE]], line: 19, | |
| 31 | 32 | // CHECK-NOT: flags: DIFlagArtificial |
| 32 | 33 | // CHECK-SAME: ) |
| 33 | 34 | // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "variant2", scope: [[GEN]], |
| 34 | // CHECK-SAME: file: [[FILE]], line: 18, | |
| 35 | // CHECK-SAME: file: [[FILE]], line: 19, | |
| 35 | 36 | // CHECK-NOT: flags: DIFlagArtificial |
| 36 | 37 | // CHECK-SAME: ) |
| 37 | 38 | // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "variant3", scope: [[GEN]], |
| 38 | // CHECK-SAME: file: [[FILE]], line: 15, | |
| 39 | // CHECK-SAME: file: [[FILE]], line: 16, | |
| 39 | 40 | // CHECK-NOT: flags: DIFlagArtificial |
| 40 | 41 | // CHECK-SAME: ) |
| 41 | 42 | // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "variant4", scope: [[GEN]], |
| 42 | // CHECK-SAME: file: [[FILE]], line: 17, | |
| 43 | // CHECK-SAME: file: [[FILE]], line: 18, | |
| 43 | 44 | // CHECK-SAME: baseType: [[VARIANT_WRAPPER:![0-9]*]] |
| 44 | 45 | // CHECK-NOT: flags: DIFlagArtificial |
| 45 | 46 | // CHECK-SAME: ) |
tests/codegen/coroutine-debug.rs+7-6| ... | ... | @@ -11,7 +11,8 @@ |
| 11 | 11 | use std::ops::Coroutine; |
| 12 | 12 | |
| 13 | 13 | fn coroutine_test() -> impl Coroutine<Yield = i32, Return = ()> { |
| 14 | #[coroutine] || { | |
| 14 | #[coroutine] | |
| 15 | || { | |
| 15 | 16 | yield 0; |
| 16 | 17 | let s = String::from("foo"); |
| 17 | 18 | yield 1; |
| ... | ... | @@ -26,26 +27,26 @@ fn coroutine_test() -> impl Coroutine<Yield = i32, Return = ()> { |
| 26 | 27 | // CHECK-NOT: flags: DIFlagArtificial |
| 27 | 28 | // CHECK-SAME: discriminator: [[DISC:![0-9]*]] |
| 28 | 29 | // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "0", scope: [[VARIANT]], |
| 29 | // CHECK-SAME: file: [[FILE:![0-9]*]], line: 14, | |
| 30 | // CHECK-SAME: file: [[FILE:![0-9]*]], line: 15, | |
| 30 | 31 | // CHECK-NOT: flags: DIFlagArtificial |
| 31 | 32 | // CHECK-SAME: ) |
| 32 | 33 | // CHECK: {{!.*}} = !DICompositeType(tag: DW_TAG_structure_type, name: "Unresumed", scope: [[GEN]], |
| 33 | 34 | // CHECK-NOT: flags: DIFlagArtificial |
| 34 | 35 | // CHECK-SAME: ) |
| 35 | 36 | // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "1", scope: [[VARIANT]], |
| 36 | // CHECK-SAME: file: [[FILE]], line: 18, | |
| 37 | // CHECK-SAME: file: [[FILE]], line: 19, | |
| 37 | 38 | // CHECK-NOT: flags: DIFlagArtificial |
| 38 | 39 | // CHECK-SAME: ) |
| 39 | 40 | // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "2", scope: [[VARIANT]], |
| 40 | // CHECK-SAME: file: [[FILE]], line: 18, | |
| 41 | // CHECK-SAME: file: [[FILE]], line: 19, | |
| 41 | 42 | // CHECK-NOT: flags: DIFlagArtificial |
| 42 | 43 | // CHECK-SAME: ) |
| 43 | 44 | // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "3", scope: [[VARIANT]], |
| 44 | // CHECK-SAME: file: [[FILE]], line: 15, | |
| 45 | // CHECK-SAME: file: [[FILE]], line: 16, | |
| 45 | 46 | // CHECK-NOT: flags: DIFlagArtificial |
| 46 | 47 | // CHECK-SAME: ) |
| 47 | 48 | // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "4", scope: [[VARIANT]], |
| 48 | // CHECK-SAME: file: [[FILE]], line: 17, | |
| 49 | // CHECK-SAME: file: [[FILE]], line: 18, | |
| 49 | 50 | // CHECK-NOT: flags: DIFlagArtificial |
| 50 | 51 | // CHECK-SAME: ) |
| 51 | 52 | // CHECK: [[S1:!.*]] = !DICompositeType(tag: DW_TAG_structure_type, name: "Suspend1", scope: [[GEN]], |
tests/codegen/dealloc-no-unwind.rs+7-3| ... | ... | @@ -1,13 +1,17 @@ |
| 1 | 1 | //@ compile-flags: -O |
| 2 | 2 | |
| 3 | #![crate_type="lib"] | |
| 3 | #![crate_type = "lib"] | |
| 4 | 4 | |
| 5 | 5 | struct A; |
| 6 | 6 | |
| 7 | 7 | impl Drop for A { |
| 8 | 8 | fn drop(&mut self) { |
| 9 | extern "C" { fn foo(); } | |
| 10 | unsafe { foo(); } | |
| 9 | extern "C" { | |
| 10 | fn foo(); | |
| 11 | } | |
| 12 | unsafe { | |
| 13 | foo(); | |
| 14 | } | |
| 11 | 15 | } |
| 12 | 16 | } |
| 13 | 17 |
tests/codegen/debug-column.rs+3-2| ... | ... | @@ -3,6 +3,7 @@ |
| 3 | 3 | //@ ignore-windows |
| 4 | 4 | //@ compile-flags: -C debuginfo=2 |
| 5 | 5 | |
| 6 | #[rustfmt::skip] | |
| 6 | 7 | fn main() { |
| 7 | 8 | unsafe { |
| 8 | 9 | // Column numbers are 1-based. Regression test for #65437. |
| ... | ... | @@ -13,8 +14,8 @@ fn main() { |
| 13 | 14 | // CHECK: call void @turtle(){{( #[0-9]+)?}}, !dbg [[B:!.*]] |
| 14 | 15 | /* ż */ turtle(); |
| 15 | 16 | |
| 16 | // CHECK: [[A]] = !DILocation(line: 10, column: 9, | |
| 17 | // CHECK: [[B]] = !DILocation(line: 14, column: 10, | |
| 17 | // CHECK: [[A]] = !DILocation(line: 11, column: 9, | |
| 18 | // CHECK: [[B]] = !DILocation(line: 15, column: 10, | |
| 18 | 19 | } |
| 19 | 20 | } |
| 20 | 21 |
tests/codegen/debug-compile-unit-path.rs+1-1| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | // |
| 4 | 4 | // Ensure that we remap the compile unit directory and that we set it to the compilers current |
| 5 | 5 | // working directory and not something else. |
| 6 | #![crate_type="rlib"] | |
| 6 | #![crate_type = "rlib"] | |
| 7 | 7 | |
| 8 | 8 | // CHECK-DAG: [[FILE:![0-9]*]] = !DIFile(filename: "/base/debug-compile-unit-path.rs{{.*}}", directory: "/cwd/") |
| 9 | 9 | // CHECK-DAG: {{![0-9]*}} = distinct !DICompileUnit({{.*}}file: [[FILE]] |
tests/codegen/debuginfo-generic-closure-env-names.rs+2-5| ... | ... | @@ -46,7 +46,6 @@ |
| 46 | 46 | // NONMSVC-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "{closure_env#0}<debuginfo_generic_closure_env_names::Foo>", scope: ![[function_containing_closure_NAMESPACE]] |
| 47 | 47 | // MSVC-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "closure_env$0<debuginfo_generic_closure_env_names::Foo>", scope: ![[function_containing_closure_NAMESPACE]] |
| 48 | 48 | |
| 49 | ||
| 50 | 49 | #![crate_type = "lib"] |
| 51 | 50 | use std::future::Future; |
| 52 | 51 | |
| ... | ... | @@ -70,11 +69,9 @@ async fn generic_async_function<T: 'static>(x: T) -> T { |
| 70 | 69 | x |
| 71 | 70 | } |
| 72 | 71 | |
| 73 | fn generic_async_block<T: 'static>(x: T) -> impl Future<Output=T> { | |
| 72 | fn generic_async_block<T: 'static>(x: T) -> impl Future<Output = T> { | |
| 74 | 73 | static _X: u8 = 0; // Same as above |
| 75 | async move { | |
| 76 | x | |
| 77 | } | |
| 74 | async move { x } | |
| 78 | 75 | } |
| 79 | 76 | |
| 80 | 77 | pub fn instantiate_generics() { |
tests/codegen/dllimports/auxiliary/wrapper.rs+2-2| ... | ... | @@ -1,13 +1,13 @@ |
| 1 | 1 | //@ no-prefer-dynamic |
| 2 | 2 | #![crate_type = "rlib"] |
| 3 | 3 | |
| 4 | #[link(name = "dummy", kind="dylib")] | |
| 4 | #[link(name = "dummy", kind = "dylib")] | |
| 5 | 5 | extern "C" { |
| 6 | 6 | pub fn dylib_func2(x: i32) -> i32; |
| 7 | 7 | pub static dylib_global2: i32; |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | #[link(name = "dummy", kind="static")] | |
| 10 | #[link(name = "dummy", kind = "static")] | |
| 11 | 11 | extern "C" { |
| 12 | 12 | pub fn static_func2(x: i32) -> i32; |
| 13 | 13 | pub static static_global2: i32; |
tests/codegen/dllimports/main.rs+3-3| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | // This test is for *-windows-msvc only. | |
| 1 | // This test is for *-windows-msvc only. | |
| 2 | 2 | //@ only-windows |
| 3 | 3 | //@ ignore-gnu |
| 4 | 4 | |
| ... | ... | @@ -20,13 +20,13 @@ extern crate wrapper; |
| 20 | 20 | // CHECK: declare noundef i32 @static_func1(i32 noundef) |
| 21 | 21 | // CHECK: declare noundef i32 @static_func2(i32 noundef) |
| 22 | 22 | |
| 23 | #[link(name = "dummy", kind="dylib")] | |
| 23 | #[link(name = "dummy", kind = "dylib")] | |
| 24 | 24 | extern "C" { |
| 25 | 25 | pub fn dylib_func1(x: i32) -> i32; |
| 26 | 26 | pub static dylib_global1: i32; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | #[link(name = "dummy", kind="static")] | |
| 29 | #[link(name = "dummy", kind = "static")] | |
| 30 | 30 | extern "C" { |
| 31 | 31 | pub fn static_func1(x: i32) -> i32; |
| 32 | 32 | pub static static_global1: i32; |
tests/codegen/drop-in-place-noalias.rs+1-1| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | // Tests that the compiler can apply `noalias` and other &mut attributes to `drop_in_place`. |
| 4 | 4 | // Note that non-Unpin types should not get `noalias`, matching &mut behavior. |
| 5 | 5 | |
| 6 | #![crate_type="lib"] | |
| 6 | #![crate_type = "lib"] | |
| 7 | 7 | |
| 8 | 8 | use std::marker::PhantomPinned; |
| 9 | 9 |
tests/codegen/drop.rs+13-15| ... | ... | @@ -7,28 +7,26 @@ struct SomeUniqueName; |
| 7 | 7 | |
| 8 | 8 | impl Drop for SomeUniqueName { |
| 9 | 9 | #[inline(never)] |
| 10 | fn drop(&mut self) { | |
| 11 | } | |
| 10 | fn drop(&mut self) {} | |
| 12 | 11 | } |
| 13 | 12 | |
| 14 | 13 | #[inline(never)] |
| 15 | pub fn possibly_unwinding() { | |
| 16 | } | |
| 14 | pub fn possibly_unwinding() {} | |
| 17 | 15 | |
| 18 | 16 | // CHECK-LABEL: @droppy |
| 19 | 17 | #[no_mangle] |
| 20 | 18 | pub fn droppy() { |
| 21 | // Check that there are exactly 6 drop calls. The cleanups for the unwinding should be reused, so | |
| 22 | // that's one new drop call per call to possibly_unwinding(), and finally 3 drop calls for the | |
| 23 | // regular function exit. We used to have problems with quadratic growths of drop calls in such | |
| 24 | // functions. | |
| 25 | // FIXME(eddyb) the `void @` forces a match on the instruction, instead of the | |
| 26 | // comment, that's `; call core::ptr::drop_in_place::<drop::SomeUniqueName>` | |
| 27 | // for the `v0` mangling, should switch to matching on that once `legacy` is gone. | |
| 28 | // CHECK-COUNT-6: {{(call|invoke) void @.*}}drop_in_place{{.*}}SomeUniqueName | |
| 29 | // CHECK-NOT: {{(call|invoke) void @.*}}drop_in_place{{.*}}SomeUniqueName | |
| 30 | // The next line checks for the } that ends the function definition | |
| 31 | // CHECK-LABEL: {{^[}]}} | |
| 19 | // Check that there are exactly 6 drop calls. The cleanups for the unwinding should be reused, | |
| 20 | // so that's one new drop call per call to possibly_unwinding(), and finally 3 drop calls for | |
| 21 | // the regular function exit. We used to have problems with quadratic growths of drop calls in | |
| 22 | // such functions. | |
| 23 | // FIXME(eddyb) the `void @` forces a match on the instruction, instead of the | |
| 24 | // comment, that's `; call core::ptr::drop_in_place::<drop::SomeUniqueName>` | |
| 25 | // for the `v0` mangling, should switch to matching on that once `legacy` is gone. | |
| 26 | // CHECK-COUNT-6: {{(call|invoke) void @.*}}drop_in_place{{.*}}SomeUniqueName | |
| 27 | // CHECK-NOT: {{(call|invoke) void @.*}}drop_in_place{{.*}}SomeUniqueName | |
| 28 | // The next line checks for the } that ends the function definition | |
| 29 | // CHECK-LABEL: {{^[}]}} | |
| 32 | 30 | let _s = SomeUniqueName; |
| 33 | 31 | possibly_unwinding(); |
| 34 | 32 | let _s = SomeUniqueName; |
tests/codegen/dst-offset.rs+28-29| ... | ... | @@ -3,7 +3,6 @@ |
| 3 | 3 | //@ compile-flags: -C no-prepopulate-passes -Copt-level=0 |
| 4 | 4 | |
| 5 | 5 | #![crate_type = "lib"] |
| 6 | ||
| 7 | 6 | #![feature(extern_types)] |
| 8 | 7 | |
| 9 | 8 | use std::ptr::addr_of; |
| ... | ... | @@ -11,8 +10,7 @@ use std::ptr::addr_of; |
| 11 | 10 | // Hack to get the correct type for usize |
| 12 | 11 | // CHECK: @helper([[USIZE:i[0-9]+]] %_1) |
| 13 | 12 | #[no_mangle] |
| 14 | pub fn helper(_: usize) { | |
| 15 | } | |
| 13 | pub fn helper(_: usize) {} | |
| 16 | 14 | |
| 17 | 15 | struct Dst<T: ?Sized> { |
| 18 | 16 | x: u32, |
| ... | ... | @@ -23,30 +21,31 @@ struct Dst<T: ?Sized> { |
| 23 | 21 | // CHECK: @dst_dyn_trait_offset(ptr align {{[0-9]+}} [[DATA_PTR:%.+]], ptr align {{[0-9]+}} [[VTABLE_PTR:%.+]]) |
| 24 | 22 | #[no_mangle] |
| 25 | 23 | pub fn dst_dyn_trait_offset(s: &Dst<dyn Drop>) -> &dyn Drop { |
| 26 | // The alignment of dyn trait is unknown, so we compute the offset based on align from the vtable. | |
| 27 | ||
| 28 | // CHECK: [[SIZE_PTR:%[0-9]+]] = getelementptr inbounds i8, ptr [[VTABLE_PTR]] | |
| 29 | // CHECK: load [[USIZE]], ptr [[SIZE_PTR]] | |
| 30 | // CHECK: [[ALIGN_PTR:%[0-9]+]] = getelementptr inbounds i8, ptr [[VTABLE_PTR]] | |
| 31 | // CHECK: load [[USIZE]], ptr [[ALIGN_PTR]] | |
| 32 | ||
| 33 | // CHECK: getelementptr inbounds i8, ptr [[DATA_PTR]] | |
| 34 | // CHECK-NEXT: insertvalue | |
| 35 | // CHECK-NEXT: insertvalue | |
| 36 | // CHECK-NEXT: ret | |
| 24 | // The alignment of dyn trait is unknown, so we compute the offset based on align from the | |
| 25 | // vtable. | |
| 26 | ||
| 27 | // CHECK: [[SIZE_PTR:%[0-9]+]] = getelementptr inbounds i8, ptr [[VTABLE_PTR]] | |
| 28 | // CHECK: load [[USIZE]], ptr [[SIZE_PTR]] | |
| 29 | // CHECK: [[ALIGN_PTR:%[0-9]+]] = getelementptr inbounds i8, ptr [[VTABLE_PTR]] | |
| 30 | // CHECK: load [[USIZE]], ptr [[ALIGN_PTR]] | |
| 31 | ||
| 32 | // CHECK: getelementptr inbounds i8, ptr [[DATA_PTR]] | |
| 33 | // CHECK-NEXT: insertvalue | |
| 34 | // CHECK-NEXT: insertvalue | |
| 35 | // CHECK-NEXT: ret | |
| 37 | 36 | &s.z |
| 38 | 37 | } |
| 39 | 38 | |
| 40 | 39 | // CHECK-LABEL: @dst_slice_offset |
| 41 | 40 | #[no_mangle] |
| 42 | 41 | pub fn dst_slice_offset(s: &Dst<[u16]>) -> &[u16] { |
| 43 | // The alignment of [u16] is known, so we generate a GEP directly. | |
| 42 | // The alignment of [u16] is known, so we generate a GEP directly. | |
| 44 | 43 | |
| 45 | // CHECK: start: | |
| 46 | // CHECK-NEXT: getelementptr inbounds i8, {{.+}}, [[USIZE]] 6 | |
| 47 | // CHECK-NEXT: insertvalue | |
| 48 | // CHECK-NEXT: insertvalue | |
| 49 | // CHECK-NEXT: ret | |
| 44 | // CHECK: start: | |
| 45 | // CHECK-NEXT: getelementptr inbounds i8, {{.+}}, [[USIZE]] 6 | |
| 46 | // CHECK-NEXT: insertvalue | |
| 47 | // CHECK-NEXT: insertvalue | |
| 48 | // CHECK-NEXT: ret | |
| 50 | 49 | &s.z |
| 51 | 50 | } |
| 52 | 51 | |
| ... | ... | @@ -60,25 +59,25 @@ struct PackedDstSlice { |
| 60 | 59 | // CHECK-LABEL: @packed_dst_slice_offset |
| 61 | 60 | #[no_mangle] |
| 62 | 61 | pub fn packed_dst_slice_offset(s: &PackedDstSlice) -> *const [u16] { |
| 63 | // The alignment of [u16] is known, so we generate a GEP directly. | |
| 62 | // The alignment of [u16] is known, so we generate a GEP directly. | |
| 64 | 63 | |
| 65 | // CHECK: start: | |
| 66 | // CHECK-NEXT: getelementptr inbounds i8, {{.+}}, [[USIZE]] 5 | |
| 67 | // CHECK-NEXT: insertvalue | |
| 68 | // CHECK-NEXT: insertvalue | |
| 69 | // CHECK-NEXT: ret | |
| 64 | // CHECK: start: | |
| 65 | // CHECK-NEXT: getelementptr inbounds i8, {{.+}}, [[USIZE]] 5 | |
| 66 | // CHECK-NEXT: insertvalue | |
| 67 | // CHECK-NEXT: insertvalue | |
| 68 | // CHECK-NEXT: ret | |
| 70 | 69 | addr_of!(s.z) |
| 71 | 70 | } |
| 72 | 71 | |
| 73 | extern { | |
| 72 | extern "C" { | |
| 74 | 73 | pub type Extern; |
| 75 | 74 | } |
| 76 | 75 | |
| 77 | 76 | // CHECK-LABEL: @dst_extern |
| 78 | 77 | #[no_mangle] |
| 79 | 78 | pub fn dst_extern(s: &Dst<Extern>) -> &Extern { |
| 80 | // Computing the alignment of an extern type is currently unsupported and just panics. | |
| 79 | // Computing the alignment of an extern type is currently unsupported and just panics. | |
| 81 | 80 | |
| 82 | // CHECK: call void @{{.+}}panic | |
| 81 | // CHECK: call void @{{.+}}panic | |
| 83 | 82 | &s.z |
| 84 | 83 | } |
tests/codegen/dst-vtable-align-nonzero.rs+10-4| ... | ... | @@ -10,9 +10,15 @@ pub trait Trait { |
| 10 | 10 | fn f(&self); |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | pub struct WrapperWithAlign1<T: ?Sized> { x: u8, y: T } | |
| 13 | pub struct WrapperWithAlign1<T: ?Sized> { | |
| 14 | x: u8, | |
| 15 | y: T, | |
| 16 | } | |
| 14 | 17 | |
| 15 | pub struct WrapperWithAlign2<T: ?Sized> { x: u16, y: T } | |
| 18 | pub struct WrapperWithAlign2<T: ?Sized> { | |
| 19 | x: u16, | |
| 20 | y: T, | |
| 21 | } | |
| 16 | 22 | |
| 17 | 23 | pub struct Struct<W: ?Sized> { |
| 18 | 24 | _field: i8, |
| ... | ... | @@ -22,7 +28,7 @@ pub struct Struct<W: ?Sized> { |
| 22 | 28 | // CHECK-LABEL: @eliminates_runtime_check_when_align_1 |
| 23 | 29 | #[no_mangle] |
| 24 | 30 | pub fn eliminates_runtime_check_when_align_1( |
| 25 | x: &Struct<WrapperWithAlign1<dyn Trait>> | |
| 31 | x: &Struct<WrapperWithAlign1<dyn Trait>>, | |
| 26 | 32 | ) -> &WrapperWithAlign1<dyn Trait> { |
| 27 | 33 | // CHECK: load [[USIZE:i[0-9]+]], {{.+}} !range [[RANGE_META:![0-9]+]] |
| 28 | 34 | // CHECK-NOT: llvm.umax |
| ... | ... | @@ -35,7 +41,7 @@ pub fn eliminates_runtime_check_when_align_1( |
| 35 | 41 | // CHECK-LABEL: @does_not_eliminate_runtime_check_when_align_2 |
| 36 | 42 | #[no_mangle] |
| 37 | 43 | pub fn does_not_eliminate_runtime_check_when_align_2( |
| 38 | x: &Struct<WrapperWithAlign2<dyn Trait>> | |
| 44 | x: &Struct<WrapperWithAlign2<dyn Trait>>, | |
| 39 | 45 | ) -> &WrapperWithAlign2<dyn Trait> { |
| 40 | 46 | // CHECK: [[X0:%[0-9]+]] = load [[USIZE]], {{.+}} !range [[RANGE_META]] |
| 41 | 47 | // CHECK: {{icmp|llvm.umax}} |
tests/codegen/ehcontguard_disabled.rs+1-2| ... | ... | @@ -3,8 +3,7 @@ |
| 3 | 3 | #![crate_type = "lib"] |
| 4 | 4 | |
| 5 | 5 | // A basic test function. |
| 6 | pub fn test() { | |
| 7 | } | |
| 6 | pub fn test() {} | |
| 8 | 7 | |
| 9 | 8 | // Ensure the module flag ehcontguard is not present |
| 10 | 9 | // CHECK-NOT: !"ehcontguard" |
tests/codegen/ehcontguard_enabled.rs+1-2| ... | ... | @@ -3,8 +3,7 @@ |
| 3 | 3 | #![crate_type = "lib"] |
| 4 | 4 | |
| 5 | 5 | // A basic test function. |
| 6 | pub fn test() { | |
| 7 | } | |
| 6 | pub fn test() {} | |
| 8 | 7 | |
| 9 | 8 | // Ensure the module flag ehcontguard=1 is present |
| 10 | 9 | // CHECK: !"ehcontguard", i32 1 |
tests/codegen/emcripten-catch-unwind.rs+11-6| ... | ... | @@ -9,18 +9,23 @@ |
| 9 | 9 | #![no_std] |
| 10 | 10 | #![no_core] |
| 11 | 11 | |
| 12 | #[lang="sized"] trait Sized { } | |
| 13 | #[lang="freeze"] trait Freeze { } | |
| 14 | #[lang="copy"] trait Copy { } | |
| 12 | #[lang = "sized"] | |
| 13 | trait Sized {} | |
| 14 | #[lang = "freeze"] | |
| 15 | trait Freeze {} | |
| 16 | #[lang = "copy"] | |
| 17 | trait Copy {} | |
| 15 | 18 | |
| 16 | 19 | #[rustc_intrinsic] |
| 17 | fn size_of<T>() -> usize { loop {} } | |
| 20 | fn size_of<T>() -> usize { | |
| 21 | loop {} | |
| 22 | } | |
| 18 | 23 | |
| 19 | 24 | extern "rust-intrinsic" { |
| 20 | 25 | fn catch_unwind( |
| 21 | 26 | try_fn: fn(_: *mut u8), |
| 22 | 27 | data: *mut u8, |
| 23 | catch_fn: fn(_: *mut u8, _: *mut u8) | |
| 28 | catch_fn: fn(_: *mut u8, _: *mut u8), | |
| 24 | 29 | ) -> i32; |
| 25 | 30 | } |
| 26 | 31 | |
| ... | ... | @@ -36,7 +41,7 @@ pub fn ptr_size() -> usize { |
| 36 | 41 | pub unsafe fn test_catch_unwind( |
| 37 | 42 | try_fn: fn(_: *mut u8), |
| 38 | 43 | data: *mut u8, |
| 39 | catch_fn: fn(_: *mut u8, _: *mut u8) | |
| 44 | catch_fn: fn(_: *mut u8, _: *mut u8), | |
| 40 | 45 | ) -> i32 { |
| 41 | 46 | // CHECK: start: |
| 42 | 47 | // CHECK: [[ALLOCA:%.*]] = alloca |
tests/codegen/enable-lto-unit-splitting.rs+2-3| ... | ... | @@ -2,9 +2,8 @@ |
| 2 | 2 | // |
| 3 | 3 | //@ compile-flags: -Clto -Ctarget-feature=-crt-static -Zsplit-lto-unit |
| 4 | 4 | |
| 5 | #![crate_type="lib"] | |
| 5 | #![crate_type = "lib"] | |
| 6 | 6 | |
| 7 | pub fn foo() { | |
| 8 | } | |
| 7 | pub fn foo() {} | |
| 9 | 8 | |
| 10 | 9 | // CHECK: !{{[0-9]+}} = !{i32 4, !"EnableSplitLTOUnit", i32 1} |
tests/codegen/enum/enum-bounds-check.rs+3-2| ... | ... | @@ -3,7 +3,8 @@ |
| 3 | 3 | #![crate_type = "lib"] |
| 4 | 4 | |
| 5 | 5 | pub enum Foo { |
| 6 | A, B | |
| 6 | A, | |
| 7 | B, | |
| 7 | 8 | } |
| 8 | 9 | |
| 9 | 10 | // CHECK-LABEL: @lookup |
| ... | ... | @@ -15,7 +16,7 @@ pub fn lookup(buf: &[u8; 2], f: Foo) -> u8 { |
| 15 | 16 | |
| 16 | 17 | pub enum Bar { |
| 17 | 18 | A = 2, |
| 18 | B = 3 | |
| 19 | B = 3, | |
| 19 | 20 | } |
| 20 | 21 | |
| 21 | 22 | // CHECK-LABEL: @lookup_unmodified |
tests/codegen/enum/enum-debug-clike.rs+5-1| ... | ... | @@ -17,7 +17,11 @@ |
| 17 | 17 | #![allow(unused_variables)] |
| 18 | 18 | #![allow(unused_assignments)] |
| 19 | 19 | |
| 20 | enum E { A, B, C } | |
| 20 | enum E { | |
| 21 | A, | |
| 22 | B, | |
| 23 | C, | |
| 24 | } | |
| 21 | 25 | |
| 22 | 26 | pub fn main() { |
| 23 | 27 | let e = E::C; |
tests/codegen/enum/enum-debug-niche.rs+6-1| ... | ... | @@ -23,7 +23,12 @@ |
| 23 | 23 | #![allow(unused_variables)] |
| 24 | 24 | #![allow(unused_assignments)] |
| 25 | 25 | |
| 26 | enum E { A, B, C, D(bool) } | |
| 26 | enum E { | |
| 27 | A, | |
| 28 | B, | |
| 29 | C, | |
| 30 | D(bool), | |
| 31 | } | |
| 27 | 32 | |
| 28 | 33 | pub fn main() { |
| 29 | 34 | let e = E::D(true); |
tests/codegen/enum/enum-debug-tagged.rs+4-1| ... | ... | @@ -21,7 +21,10 @@ |
| 21 | 21 | #![allow(unused_variables)] |
| 22 | 22 | #![allow(unused_assignments)] |
| 23 | 23 | |
| 24 | enum E { A(u32), B(u32) } | |
| 24 | enum E { | |
| 25 | A(u32), | |
| 26 | B(u32), | |
| 27 | } | |
| 25 | 28 | |
| 26 | 29 | pub fn main() { |
| 27 | 30 | let e = E::A(23); |
tests/codegen/enum/enum-match.rs+1| ... | ... | @@ -50,6 +50,7 @@ pub fn match1(e: Enum1) -> u8 { |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | // Case 2: Special cases don't apply. |
| 53 | #[rustfmt::skip] | |
| 53 | 54 | pub enum X { |
| 54 | 55 | _2=2, _3, _4, _5, _6, _7, _8, _9, _10, _11, |
| 55 | 56 | _12, _13, _14, _15, _16, _17, _18, _19, _20, |
tests/codegen/enum/unreachable_enum_default_branch.rs+2-7| ... | ... | @@ -22,8 +22,7 @@ const C: Int = Int(153); |
| 22 | 22 | // CHECK-NEXT: ret i1 [[SPEC_SELECT]] |
| 23 | 23 | #[no_mangle] |
| 24 | 24 | pub fn implicit_match(x: Int) -> bool { |
| 25 | (x >= A && x <= B) | |
| 26 | || x == C | |
| 25 | (x >= A && x <= B) || x == C | |
| 27 | 26 | } |
| 28 | 27 | |
| 29 | 28 | // The code is from https://github.com/rust-lang/rust/issues/110097. |
| ... | ... | @@ -35,9 +34,5 @@ pub fn implicit_match(x: Int) -> bool { |
| 35 | 34 | // CHECK-NEXT: ret |
| 36 | 35 | #[no_mangle] |
| 37 | 36 | pub fn if_let(val: Result<i32, ()>) -> Result<i32, ()> { |
| 38 | if let Ok(x) = val { | |
| 39 | Ok(x) | |
| 40 | } else { | |
| 41 | Err(()) | |
| 42 | } | |
| 37 | if let Ok(x) = val { Ok(x) } else { Err(()) } | |
| 43 | 38 | } |
tests/codegen/fatptr.rs+1-1| ... | ... | @@ -7,6 +7,6 @@ pub trait T {} |
| 7 | 7 | // CHECK-LABEL: @copy_fat_ptr |
| 8 | 8 | #[no_mangle] |
| 9 | 9 | pub fn copy_fat_ptr(x: &T) { |
| 10 | // CHECK-NOT: extractvalue | |
| 10 | // CHECK-NOT: extractvalue | |
| 11 | 11 | let x2 = x; |
| 12 | 12 | } |
tests/codegen/float_math.rs+11-19| ... | ... | @@ -3,48 +3,40 @@ |
| 3 | 3 | #![crate_type = "lib"] |
| 4 | 4 | #![feature(core_intrinsics)] |
| 5 | 5 | |
| 6 | use std::intrinsics::{fadd_fast, fsub_fast, fmul_fast, fdiv_fast, frem_fast}; | |
| 6 | use std::intrinsics::{fadd_fast, fdiv_fast, fmul_fast, frem_fast, fsub_fast}; | |
| 7 | 7 | |
| 8 | 8 | // CHECK-LABEL: @add |
| 9 | 9 | #[no_mangle] |
| 10 | 10 | pub fn add(x: f32, y: f32) -> f32 { |
| 11 | // CHECK: fadd float | |
| 12 | // CHECK-NOT: fast | |
| 11 | // CHECK: fadd float | |
| 12 | // CHECK-NOT: fast | |
| 13 | 13 | x + y |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | // CHECK-LABEL: @addition |
| 17 | 17 | #[no_mangle] |
| 18 | 18 | pub fn addition(x: f32, y: f32) -> f32 { |
| 19 | // CHECK: fadd fast float | |
| 20 | unsafe { | |
| 21 | fadd_fast(x, y) | |
| 22 | } | |
| 19 | // CHECK: fadd fast float | |
| 20 | unsafe { fadd_fast(x, y) } | |
| 23 | 21 | } |
| 24 | 22 | |
| 25 | 23 | // CHECK-LABEL: @subtraction |
| 26 | 24 | #[no_mangle] |
| 27 | 25 | pub fn subtraction(x: f32, y: f32) -> f32 { |
| 28 | // CHECK: fsub fast float | |
| 29 | unsafe { | |
| 30 | fsub_fast(x, y) | |
| 31 | } | |
| 26 | // CHECK: fsub fast float | |
| 27 | unsafe { fsub_fast(x, y) } | |
| 32 | 28 | } |
| 33 | 29 | |
| 34 | 30 | // CHECK-LABEL: @multiplication |
| 35 | 31 | #[no_mangle] |
| 36 | 32 | pub fn multiplication(x: f32, y: f32) -> f32 { |
| 37 | // CHECK: fmul fast float | |
| 38 | unsafe { | |
| 39 | fmul_fast(x, y) | |
| 40 | } | |
| 33 | // CHECK: fmul fast float | |
| 34 | unsafe { fmul_fast(x, y) } | |
| 41 | 35 | } |
| 42 | 36 | |
| 43 | 37 | // CHECK-LABEL: @division |
| 44 | 38 | #[no_mangle] |
| 45 | 39 | pub fn division(x: f32, y: f32) -> f32 { |
| 46 | // CHECK: fdiv fast float | |
| 47 | unsafe { | |
| 48 | fdiv_fast(x, y) | |
| 49 | } | |
| 40 | // CHECK: fdiv fast float | |
| 41 | unsafe { fdiv_fast(x, y) } | |
| 50 | 42 | } |
tests/codegen/force-frame-pointers.rs+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | //@ compile-flags: -C no-prepopulate-passes -C force-frame-pointers=y -Copt-level=0 |
| 2 | 2 | |
| 3 | #![crate_type="lib"] | |
| 3 | #![crate_type = "lib"] | |
| 4 | 4 | |
| 5 | 5 | // CHECK: attributes #{{.*}} "frame-pointer"="all" |
| 6 | 6 | pub fn foo() {} |
tests/codegen/force-no-unwind-tables.rs+1-1| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | //@ compile-flags: -C no-prepopulate-passes -C panic=abort -C force-unwind-tables=n |
| 2 | 2 | //@ ignore-windows |
| 3 | 3 | |
| 4 | #![crate_type="lib"] | |
| 4 | #![crate_type = "lib"] | |
| 5 | 5 | |
| 6 | 6 | // CHECK-LABEL: define{{.*}}void @foo |
| 7 | 7 | // CHECK-NOT: attributes #{{.*}} uwtable |
tests/codegen/force-unwind-tables.rs+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | //@ compile-flags: -C no-prepopulate-passes -C force-unwind-tables=y -Copt-level=0 |
| 2 | 2 | |
| 3 | #![crate_type="lib"] | |
| 3 | #![crate_type = "lib"] | |
| 4 | 4 | |
| 5 | 5 | // CHECK: attributes #{{.*}} uwtable |
| 6 | 6 | pub fn foo() {} |
tests/codegen/frame-pointer.rs+4-5| ... | ... | @@ -13,13 +13,12 @@ |
| 13 | 13 | |
| 14 | 14 | #![feature(no_core, lang_items)] |
| 15 | 15 | #![no_core] |
| 16 | #[lang="sized"] | |
| 17 | trait Sized { } | |
| 18 | #[lang="copy"] | |
| 19 | trait Copy { } | |
| 16 | #[lang = "sized"] | |
| 17 | trait Sized {} | |
| 18 | #[lang = "copy"] | |
| 19 | trait Copy {} | |
| 20 | 20 | impl Copy for u32 {} |
| 21 | 21 | |
| 22 | ||
| 23 | 22 | // CHECK: define i32 @peach{{.*}}[[PEACH_ATTRS:\#[0-9]+]] { |
| 24 | 23 | #[no_mangle] |
| 25 | 24 | pub fn peach(x: u32) -> u32 { |
tests/codegen/function-arguments-noopt.rs+14-14| ... | ... | @@ -7,63 +7,63 @@ |
| 7 | 7 | #![feature(rustc_attrs)] |
| 8 | 8 | |
| 9 | 9 | pub struct S { |
| 10 | _field: [i32; 8], | |
| 10 | _field: [i32; 8], | |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | // CHECK: zeroext i1 @boolean(i1 zeroext %x) |
| 14 | 14 | #[no_mangle] |
| 15 | 15 | pub fn boolean(x: bool) -> bool { |
| 16 | x | |
| 16 | x | |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | // CHECK-LABEL: @boolean_call |
| 20 | 20 | #[no_mangle] |
| 21 | 21 | pub fn boolean_call(x: bool, f: fn(bool) -> bool) -> bool { |
| 22 | // CHECK: call zeroext i1 %f(i1 zeroext %x) | |
| 23 | f(x) | |
| 22 | // CHECK: call zeroext i1 %f(i1 zeroext %x) | |
| 23 | f(x) | |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | // CHECK: align 4 ptr @borrow(ptr align 4 %x) |
| 27 | 27 | #[no_mangle] |
| 28 | 28 | pub fn borrow(x: &i32) -> &i32 { |
| 29 | x | |
| 29 | x | |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | // CHECK: align 4 ptr @borrow_mut(ptr align 4 %x) |
| 33 | 33 | #[no_mangle] |
| 34 | 34 | pub fn borrow_mut(x: &mut i32) -> &mut i32 { |
| 35 | x | |
| 35 | x | |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | // CHECK-LABEL: @borrow_call |
| 39 | 39 | #[no_mangle] |
| 40 | 40 | pub fn borrow_call(x: &i32, f: fn(&i32) -> &i32) -> &i32 { |
| 41 | // CHECK: call align 4 ptr %f(ptr align 4 %x) | |
| 42 | f(x) | |
| 41 | // CHECK: call align 4 ptr %f(ptr align 4 %x) | |
| 42 | f(x) | |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | // CHECK: void @struct_(ptr sret([32 x i8]) align 4{{( %_0)?}}, ptr align 4 %x) |
| 46 | 46 | #[no_mangle] |
| 47 | 47 | pub fn struct_(x: S) -> S { |
| 48 | x | |
| 48 | x | |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | // CHECK-LABEL: @struct_call |
| 52 | 52 | #[no_mangle] |
| 53 | 53 | pub fn struct_call(x: S, f: fn(S) -> S) -> S { |
| 54 | // CHECK: call void %f(ptr sret([32 x i8]) align 4{{( %_0)?}}, ptr align 4 %{{.+}}) | |
| 55 | f(x) | |
| 54 | // CHECK: call void %f(ptr sret([32 x i8]) align 4{{( %_0)?}}, ptr align 4 %{{.+}}) | |
| 55 | f(x) | |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | // CHECK: { i1, i8 } @enum_(i1 zeroext %x.0, i8 %x.1) |
| 59 | 59 | #[no_mangle] |
| 60 | 60 | pub fn enum_(x: Option<u8>) -> Option<u8> { |
| 61 | x | |
| 61 | x | |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | // CHECK-LABEL: @enum_call |
| 65 | 65 | #[no_mangle] |
| 66 | 66 | pub fn enum_call(x: Option<u8>, f: fn(Option<u8>) -> Option<u8>) -> Option<u8> { |
| 67 | // CHECK: call { i1, i8 } %f(i1 zeroext %x.0, i8 %x.1) | |
| 68 | f(x) | |
| 67 | // CHECK: call { i1, i8 } %f(i1 zeroext %x.0, i8 %x.1) | |
| 68 | f(x) | |
| 69 | 69 | } |
tests/codegen/function-arguments.rs+52-80| ... | ... | @@ -3,129 +3,123 @@ |
| 3 | 3 | #![feature(dyn_star)] |
| 4 | 4 | #![feature(allocator_api)] |
| 5 | 5 | |
| 6 | use std::marker::PhantomPinned; | |
| 6 | 7 | use std::mem::MaybeUninit; |
| 7 | 8 | use std::num::NonZero; |
| 8 | use std::marker::PhantomPinned; | |
| 9 | 9 | use std::ptr::NonNull; |
| 10 | 10 | |
| 11 | 11 | pub struct S { |
| 12 | _field: [i32; 8], | |
| 12 | _field: [i32; 8], | |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | pub struct UnsafeInner { |
| 16 | _field: std::cell::UnsafeCell<i16>, | |
| 16 | _field: std::cell::UnsafeCell<i16>, | |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | pub struct NotUnpin { |
| 20 | _field: i32, | |
| 21 | _marker: PhantomPinned, | |
| 20 | _field: i32, | |
| 21 | _marker: PhantomPinned, | |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | pub enum MyBool { |
| 25 | True, | |
| 26 | False, | |
| 25 | True, | |
| 26 | False, | |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | // CHECK: noundef zeroext i1 @boolean(i1 noundef zeroext %x) |
| 30 | 30 | #[no_mangle] |
| 31 | 31 | pub fn boolean(x: bool) -> bool { |
| 32 | x | |
| 32 | x | |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | // CHECK: i8 @maybeuninit_boolean(i8 %x) |
| 36 | 36 | #[no_mangle] |
| 37 | 37 | pub fn maybeuninit_boolean(x: MaybeUninit<bool>) -> MaybeUninit<bool> { |
| 38 | x | |
| 38 | x | |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | // CHECK: noundef zeroext i1 @enum_bool(i1 noundef zeroext %x) |
| 42 | 42 | #[no_mangle] |
| 43 | 43 | pub fn enum_bool(x: MyBool) -> MyBool { |
| 44 | x | |
| 44 | x | |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | // CHECK: i8 @maybeuninit_enum_bool(i8 %x) |
| 48 | 48 | #[no_mangle] |
| 49 | 49 | pub fn maybeuninit_enum_bool(x: MaybeUninit<MyBool>) -> MaybeUninit<MyBool> { |
| 50 | x | |
| 50 | x | |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | // CHECK: noundef i32 @char(i32 noundef %x) |
| 54 | 54 | #[no_mangle] |
| 55 | 55 | pub fn char(x: char) -> char { |
| 56 | x | |
| 56 | x | |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | // CHECK: i32 @maybeuninit_char(i32 %x) |
| 60 | 60 | #[no_mangle] |
| 61 | 61 | pub fn maybeuninit_char(x: MaybeUninit<char>) -> MaybeUninit<char> { |
| 62 | x | |
| 62 | x | |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | // CHECK: noundef i64 @int(i64 noundef %x) |
| 66 | 66 | #[no_mangle] |
| 67 | 67 | pub fn int(x: u64) -> u64 { |
| 68 | x | |
| 68 | x | |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | // CHECK: noundef i64 @nonzero_int(i64 noundef %x) |
| 72 | 72 | #[no_mangle] |
| 73 | 73 | pub fn nonzero_int(x: NonZero<u64>) -> NonZero<u64> { |
| 74 | x | |
| 74 | x | |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | // CHECK: noundef i64 @option_nonzero_int(i64 noundef %x) |
| 78 | 78 | #[no_mangle] |
| 79 | 79 | pub fn option_nonzero_int(x: Option<NonZero<u64>>) -> Option<NonZero<u64>> { |
| 80 | x | |
| 80 | x | |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | // CHECK: @readonly_borrow(ptr noalias noundef readonly align 4 dereferenceable(4) %_1) |
| 84 | 84 | // FIXME #25759 This should also have `nocapture` |
| 85 | 85 | #[no_mangle] |
| 86 | pub fn readonly_borrow(_: &i32) { | |
| 87 | } | |
| 86 | pub fn readonly_borrow(_: &i32) {} | |
| 88 | 87 | |
| 89 | 88 | // CHECK: noundef align 4 dereferenceable(4) ptr @readonly_borrow_ret() |
| 90 | 89 | #[no_mangle] |
| 91 | 90 | pub fn readonly_borrow_ret() -> &'static i32 { |
| 92 | loop {} | |
| 91 | loop {} | |
| 93 | 92 | } |
| 94 | 93 | |
| 95 | 94 | // CHECK: @static_borrow(ptr noalias noundef readonly align 4 dereferenceable(4) %_1) |
| 96 | 95 | // static borrow may be captured |
| 97 | 96 | #[no_mangle] |
| 98 | pub fn static_borrow(_: &'static i32) { | |
| 99 | } | |
| 97 | pub fn static_borrow(_: &'static i32) {} | |
| 100 | 98 | |
| 101 | 99 | // CHECK: @named_borrow(ptr noalias noundef readonly align 4 dereferenceable(4) %_1) |
| 102 | 100 | // borrow with named lifetime may be captured |
| 103 | 101 | #[no_mangle] |
| 104 | pub fn named_borrow<'r>(_: &'r i32) { | |
| 105 | } | |
| 102 | pub fn named_borrow<'r>(_: &'r i32) {} | |
| 106 | 103 | |
| 107 | 104 | // CHECK: @unsafe_borrow(ptr noundef nonnull align 2 %_1) |
| 108 | 105 | // unsafe interior means this isn't actually readonly and there may be aliases ... |
| 109 | 106 | #[no_mangle] |
| 110 | pub fn unsafe_borrow(_: &UnsafeInner) { | |
| 111 | } | |
| 107 | pub fn unsafe_borrow(_: &UnsafeInner) {} | |
| 112 | 108 | |
| 113 | 109 | // CHECK: @mutable_unsafe_borrow(ptr noalias noundef align 2 dereferenceable(2) %_1) |
| 114 | 110 | // ... unless this is a mutable borrow, those never alias |
| 115 | 111 | #[no_mangle] |
| 116 | pub fn mutable_unsafe_borrow(_: &mut UnsafeInner) { | |
| 117 | } | |
| 112 | pub fn mutable_unsafe_borrow(_: &mut UnsafeInner) {} | |
| 118 | 113 | |
| 119 | 114 | // CHECK: @mutable_borrow(ptr noalias noundef align 4 dereferenceable(4) %_1) |
| 120 | 115 | // FIXME #25759 This should also have `nocapture` |
| 121 | 116 | #[no_mangle] |
| 122 | pub fn mutable_borrow(_: &mut i32) { | |
| 123 | } | |
| 117 | pub fn mutable_borrow(_: &mut i32) {} | |
| 124 | 118 | |
| 125 | 119 | // CHECK: noundef align 4 dereferenceable(4) ptr @mutable_borrow_ret() |
| 126 | 120 | #[no_mangle] |
| 127 | 121 | pub fn mutable_borrow_ret() -> &'static mut i32 { |
| 128 | loop {} | |
| 122 | loop {} | |
| 129 | 123 | } |
| 130 | 124 | |
| 131 | 125 | #[no_mangle] |
| ... | ... | @@ -133,53 +127,44 @@ pub fn mutable_borrow_ret() -> &'static mut i32 { |
| 133 | 127 | // This one is *not* `noalias` because it might be self-referential. |
| 134 | 128 | // It is also not `dereferenceable` due to |
| 135 | 129 | // <https://github.com/rust-lang/unsafe-code-guidelines/issues/381>. |
| 136 | pub fn mutable_notunpin_borrow(_: &mut NotUnpin) { | |
| 137 | } | |
| 130 | pub fn mutable_notunpin_borrow(_: &mut NotUnpin) {} | |
| 138 | 131 | |
| 139 | 132 | // CHECK: @notunpin_borrow(ptr noalias noundef readonly align 4 dereferenceable(4) %_1) |
| 140 | 133 | // But `&NotUnpin` behaves perfectly normal. |
| 141 | 134 | #[no_mangle] |
| 142 | pub fn notunpin_borrow(_: &NotUnpin) { | |
| 143 | } | |
| 135 | pub fn notunpin_borrow(_: &NotUnpin) {} | |
| 144 | 136 | |
| 145 | 137 | // CHECK: @indirect_struct(ptr noalias nocapture noundef readonly align 4 dereferenceable(32) %_1) |
| 146 | 138 | #[no_mangle] |
| 147 | pub fn indirect_struct(_: S) { | |
| 148 | } | |
| 139 | pub fn indirect_struct(_: S) {} | |
| 149 | 140 | |
| 150 | 141 | // CHECK: @borrowed_struct(ptr noalias noundef readonly align 4 dereferenceable(32) %_1) |
| 151 | 142 | // FIXME #25759 This should also have `nocapture` |
| 152 | 143 | #[no_mangle] |
| 153 | pub fn borrowed_struct(_: &S) { | |
| 154 | } | |
| 144 | pub fn borrowed_struct(_: &S) {} | |
| 155 | 145 | |
| 156 | 146 | // CHECK: @option_borrow(ptr noalias noundef readonly align 4 dereferenceable_or_null(4) %x) |
| 157 | 147 | #[no_mangle] |
| 158 | pub fn option_borrow(x: Option<&i32>) { | |
| 159 | } | |
| 148 | pub fn option_borrow(x: Option<&i32>) {} | |
| 160 | 149 | |
| 161 | 150 | // CHECK: @option_borrow_mut(ptr noalias noundef align 4 dereferenceable_or_null(4) %x) |
| 162 | 151 | #[no_mangle] |
| 163 | pub fn option_borrow_mut(x: Option<&mut i32>) { | |
| 164 | } | |
| 152 | pub fn option_borrow_mut(x: Option<&mut i32>) {} | |
| 165 | 153 | |
| 166 | 154 | // CHECK: @raw_struct(ptr noundef %_1) |
| 167 | 155 | #[no_mangle] |
| 168 | pub fn raw_struct(_: *const S) { | |
| 169 | } | |
| 156 | pub fn raw_struct(_: *const S) {} | |
| 170 | 157 | |
| 171 | 158 | // CHECK: @raw_option_nonnull_struct(ptr noundef %_1) |
| 172 | 159 | #[no_mangle] |
| 173 | pub fn raw_option_nonnull_struct(_: Option<NonNull<S>>) { | |
| 174 | } | |
| 175 | ||
| 160 | pub fn raw_option_nonnull_struct(_: Option<NonNull<S>>) {} | |
| 176 | 161 | |
| 177 | 162 | // `Box` can get deallocated during execution of the function, so it should |
| 178 | 163 | // not get `dereferenceable`. |
| 179 | 164 | // CHECK: noundef nonnull align 4 ptr @_box(ptr noalias noundef nonnull align 4 %x) |
| 180 | 165 | #[no_mangle] |
| 181 | 166 | pub fn _box(x: Box<i32>) -> Box<i32> { |
| 182 | x | |
| 167 | x | |
| 183 | 168 | } |
| 184 | 169 | |
| 185 | 170 | // With a custom allocator, it should *not* have `noalias`. (See |
| ... | ... | @@ -188,106 +173,93 @@ pub fn _box(x: Box<i32>) -> Box<i32> { |
| 188 | 173 | // CHECK: @_box_custom(ptr noundef nonnull align 4 %x.0, ptr noalias noundef nonnull readonly align 1 %x.1) |
| 189 | 174 | #[no_mangle] |
| 190 | 175 | pub fn _box_custom(x: Box<i32, &std::alloc::Global>) { |
| 191 | drop(x) | |
| 176 | drop(x) | |
| 192 | 177 | } |
| 193 | 178 | |
| 194 | 179 | // CHECK: noundef nonnull align 4 ptr @notunpin_box(ptr noundef nonnull align 4 %x) |
| 195 | 180 | #[no_mangle] |
| 196 | 181 | pub fn notunpin_box(x: Box<NotUnpin>) -> Box<NotUnpin> { |
| 197 | x | |
| 182 | x | |
| 198 | 183 | } |
| 199 | 184 | |
| 200 | 185 | // CHECK: @struct_return(ptr{{( dead_on_unwind)?}} noalias nocapture noundef{{( writable)?}} sret([32 x i8]) align 4 dereferenceable(32){{( %_0)?}}) |
| 201 | 186 | #[no_mangle] |
| 202 | 187 | pub fn struct_return() -> S { |
| 203 | S { | |
| 204 | _field: [0, 0, 0, 0, 0, 0, 0, 0] | |
| 205 | } | |
| 188 | S { _field: [0, 0, 0, 0, 0, 0, 0, 0] } | |
| 206 | 189 | } |
| 207 | 190 | |
| 208 | 191 | // Hack to get the correct size for the length part in slices |
| 209 | 192 | // CHECK: @helper([[USIZE:i[0-9]+]] noundef %_1) |
| 210 | 193 | #[no_mangle] |
| 211 | pub fn helper(_: usize) { | |
| 212 | } | |
| 194 | pub fn helper(_: usize) {} | |
| 213 | 195 | |
| 214 | 196 | // CHECK: @slice(ptr noalias noundef nonnull readonly align 1 %_1.0, [[USIZE]] noundef %_1.1) |
| 215 | 197 | // FIXME #25759 This should also have `nocapture` |
| 216 | 198 | #[no_mangle] |
| 217 | pub fn slice(_: &[u8]) { | |
| 218 | } | |
| 199 | pub fn slice(_: &[u8]) {} | |
| 219 | 200 | |
| 220 | 201 | // CHECK: @mutable_slice(ptr noalias noundef nonnull align 1 %_1.0, [[USIZE]] noundef %_1.1) |
| 221 | 202 | // FIXME #25759 This should also have `nocapture` |
| 222 | 203 | #[no_mangle] |
| 223 | pub fn mutable_slice(_: &mut [u8]) { | |
| 224 | } | |
| 204 | pub fn mutable_slice(_: &mut [u8]) {} | |
| 225 | 205 | |
| 226 | 206 | // CHECK: @unsafe_slice(ptr noundef nonnull align 2 %_1.0, [[USIZE]] noundef %_1.1) |
| 227 | 207 | // unsafe interior means this isn't actually readonly and there may be aliases ... |
| 228 | 208 | #[no_mangle] |
| 229 | pub fn unsafe_slice(_: &[UnsafeInner]) { | |
| 230 | } | |
| 209 | pub fn unsafe_slice(_: &[UnsafeInner]) {} | |
| 231 | 210 | |
| 232 | 211 | // CHECK: @raw_slice(ptr noundef %_1.0, [[USIZE]] noundef %_1.1) |
| 233 | 212 | #[no_mangle] |
| 234 | pub fn raw_slice(_: *const [u8]) { | |
| 235 | } | |
| 213 | pub fn raw_slice(_: *const [u8]) {} | |
| 236 | 214 | |
| 237 | 215 | // CHECK: @str(ptr noalias noundef nonnull readonly align 1 %_1.0, [[USIZE]] noundef %_1.1) |
| 238 | 216 | // FIXME #25759 This should also have `nocapture` |
| 239 | 217 | #[no_mangle] |
| 240 | pub fn str(_: &[u8]) { | |
| 241 | } | |
| 218 | pub fn str(_: &[u8]) {} | |
| 242 | 219 | |
| 243 | 220 | // CHECK: @trait_borrow(ptr noundef nonnull align 1 %_1.0, {{.+}} noalias noundef readonly align {{.*}} dereferenceable({{.*}}) %_1.1) |
| 244 | 221 | // FIXME #25759 This should also have `nocapture` |
| 245 | 222 | #[no_mangle] |
| 246 | pub fn trait_borrow(_: &dyn Drop) { | |
| 247 | } | |
| 223 | pub fn trait_borrow(_: &dyn Drop) {} | |
| 248 | 224 | |
| 249 | 225 | // CHECK: @option_trait_borrow(ptr noundef align 1 %x.0, ptr %x.1) |
| 250 | 226 | #[no_mangle] |
| 251 | pub fn option_trait_borrow(x: Option<&dyn Drop>) { | |
| 252 | } | |
| 227 | pub fn option_trait_borrow(x: Option<&dyn Drop>) {} | |
| 253 | 228 | |
| 254 | 229 | // CHECK: @option_trait_borrow_mut(ptr noundef align 1 %x.0, ptr %x.1) |
| 255 | 230 | #[no_mangle] |
| 256 | pub fn option_trait_borrow_mut(x: Option<&mut dyn Drop>) { | |
| 257 | } | |
| 231 | pub fn option_trait_borrow_mut(x: Option<&mut dyn Drop>) {} | |
| 258 | 232 | |
| 259 | 233 | // CHECK: @trait_raw(ptr noundef %_1.0, {{.+}} noalias noundef readonly align {{.*}} dereferenceable({{.*}}) %_1.1) |
| 260 | 234 | #[no_mangle] |
| 261 | pub fn trait_raw(_: *const dyn Drop) { | |
| 262 | } | |
| 235 | pub fn trait_raw(_: *const dyn Drop) {} | |
| 263 | 236 | |
| 264 | 237 | // CHECK: @trait_box(ptr noalias noundef nonnull align 1{{( %0)?}}, {{.+}} noalias noundef readonly align {{.*}} dereferenceable({{.*}}){{( %1)?}}) |
| 265 | 238 | #[no_mangle] |
| 266 | pub fn trait_box(_: Box<dyn Drop + Unpin>) { | |
| 267 | } | |
| 239 | pub fn trait_box(_: Box<dyn Drop + Unpin>) {} | |
| 268 | 240 | |
| 269 | 241 | // CHECK: { ptr, ptr } @trait_option(ptr noalias noundef align 1 %x.0, ptr %x.1) |
| 270 | 242 | #[no_mangle] |
| 271 | 243 | pub fn trait_option(x: Option<Box<dyn Drop + Unpin>>) -> Option<Box<dyn Drop + Unpin>> { |
| 272 | x | |
| 244 | x | |
| 273 | 245 | } |
| 274 | 246 | |
| 275 | 247 | // CHECK: { ptr, [[USIZE]] } @return_slice(ptr noalias noundef nonnull readonly align 2 %x.0, [[USIZE]] noundef %x.1) |
| 276 | 248 | #[no_mangle] |
| 277 | 249 | pub fn return_slice(x: &[u16]) -> &[u16] { |
| 278 | x | |
| 250 | x | |
| 279 | 251 | } |
| 280 | 252 | |
| 281 | 253 | // CHECK: { i16, i16 } @enum_id_1(i16 noundef %x.0, i16 %x.1) |
| 282 | 254 | #[no_mangle] |
| 283 | 255 | pub fn enum_id_1(x: Option<Result<u16, u16>>) -> Option<Result<u16, u16>> { |
| 284 | x | |
| 256 | x | |
| 285 | 257 | } |
| 286 | 258 | |
| 287 | 259 | // CHECK: { i1, i8 } @enum_id_2(i1 noundef zeroext %x.0, i8 %x.1) |
| 288 | 260 | #[no_mangle] |
| 289 | 261 | pub fn enum_id_2(x: Option<u8>) -> Option<u8> { |
| 290 | x | |
| 262 | x | |
| 291 | 263 | } |
| 292 | 264 | |
| 293 | 265 | // 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<u8>) -> Option<u8> { |
| 295 | 267 | // so do like the `trait_box` test and just match on `{{.+}}` for the vtable. |
| 296 | 268 | #[no_mangle] |
| 297 | 269 | pub fn dyn_star(x: dyn* Drop) -> dyn* Drop { |
| 298 | x | |
| 270 | x | |
| 299 | 271 | } |
tests/codegen/generic-debug.rs+1-1| ... | ... | @@ -13,6 +13,6 @@ |
| 13 | 13 | |
| 14 | 14 | pub struct Generic<Type>(Type); |
| 15 | 15 | |
| 16 | fn main () { | |
| 16 | fn main() { | |
| 17 | 17 | let generic = Generic(10); |
| 18 | 18 | } |
tests/codegen/inline-always-works-always.rs+1-1| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | //@[SIZE-OPT] compile-flags: -Copt-level=s |
| 4 | 4 | //@[SPEED-OPT] compile-flags: -Copt-level=3 |
| 5 | 5 | |
| 6 | #![crate_type="rlib"] | |
| 6 | #![crate_type = "rlib"] | |
| 7 | 7 | |
| 8 | 8 | #[no_mangle] |
| 9 | 9 | #[inline(always)] |
tests/codegen/inline-debuginfo.rs+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | #![crate_type="rlib"] | |
| 1 | #![crate_type = "rlib"] | |
| 2 | 2 | //@ compile-flags: -Copt-level=3 -g |
| 3 | 3 | // |
| 4 | 4 |
tests/codegen/instrument-coverage/instrument-coverage.rs+2-4| ... | ... | @@ -12,12 +12,10 @@ |
| 12 | 12 | // CHECK: @__llvm_profile_filename = {{.*}}"default_%m_%p.profraw\00"{{.*}} |
| 13 | 13 | // CHECK: @__llvm_coverage_mapping |
| 14 | 14 | |
| 15 | #![crate_type="lib"] | |
| 15 | #![crate_type = "lib"] | |
| 16 | 16 | |
| 17 | 17 | #[inline(never)] |
| 18 | fn some_function() { | |
| 19 | ||
| 20 | } | |
| 18 | fn some_function() {} | |
| 21 | 19 | |
| 22 | 20 | pub fn some_other_function() { |
| 23 | 21 | some_function(); |
tests/codegen/integer-cmp.rs+8-8| ... | ... | @@ -10,19 +10,19 @@ use std::cmp::Ordering; |
| 10 | 10 | // CHECK-LABEL: @cmp_signed |
| 11 | 11 | #[no_mangle] |
| 12 | 12 | pub fn cmp_signed(a: i64, b: i64) -> Ordering { |
| 13 | // CHECK: icmp slt | |
| 14 | // CHECK: icmp ne | |
| 15 | // CHECK: zext i1 | |
| 16 | // CHECK: select i1 | |
| 13 | // CHECK: icmp slt | |
| 14 | // CHECK: icmp ne | |
| 15 | // CHECK: zext i1 | |
| 16 | // CHECK: select i1 | |
| 17 | 17 | a.cmp(&b) |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | // CHECK-LABEL: @cmp_unsigned |
| 21 | 21 | #[no_mangle] |
| 22 | 22 | pub fn cmp_unsigned(a: u32, b: u32) -> Ordering { |
| 23 | // CHECK: icmp ult | |
| 24 | // CHECK: icmp ne | |
| 25 | // CHECK: zext i1 | |
| 26 | // CHECK: select i1 | |
| 23 | // CHECK: icmp ult | |
| 24 | // CHECK: icmp ne | |
| 25 | // CHECK: zext i1 | |
| 26 | // CHECK: select i1 | |
| 27 | 27 | a.cmp(&b) |
| 28 | 28 | } |
tests/codegen/integer-overflow.rs+1-2| ... | ... | @@ -2,7 +2,6 @@ |
| 2 | 2 | |
| 3 | 3 | #![crate_type = "lib"] |
| 4 | 4 | |
| 5 | ||
| 6 | 5 | pub struct S1<'a> { |
| 7 | 6 | data: &'a [u8], |
| 8 | 7 | position: usize, |
| ... | ... | @@ -12,7 +11,7 @@ pub struct S1<'a> { |
| 12 | 11 | #[no_mangle] |
| 13 | 12 | pub fn slice_no_index_order<'a>(s: &'a mut S1, n: usize) -> &'a [u8] { |
| 14 | 13 | // CHECK-NOT: slice_index_order_fail |
| 15 | let d = &s.data[s.position..s.position+n]; | |
| 14 | let d = &s.data[s.position..s.position + n]; | |
| 16 | 15 | s.position += n; |
| 17 | 16 | return d; |
| 18 | 17 | } |
tests/codegen/internalize-closures.rs+1-2| ... | ... | @@ -1,7 +1,6 @@ |
| 1 | 1 | //@ compile-flags: -C no-prepopulate-passes -Zmir-opt-level=0 |
| 2 | 2 | |
| 3 | 3 | pub fn main() { |
| 4 | ||
| 5 | 4 | // We want to make sure that closures get 'internal' linkage instead of |
| 6 | 5 | // 'weak_odr' when they are not shared between codegen units |
| 7 | 6 | // FIXME(eddyb) `legacy` mangling uses `{{closure}}`, while `v0` |
| ... | ... | @@ -9,6 +8,6 @@ pub fn main() { |
| 9 | 8 | // CHECK-LABEL: ; internalize_closures::main::{{.*}}closure |
| 10 | 9 | // CHECK-NEXT: ; Function Attrs: |
| 11 | 10 | // CHECK-NEXT: define internal |
| 12 | let c = |x:i32| { x + 1 }; | |
| 11 | let c = |x: i32| x + 1; | |
| 13 | 12 | let _ = c(1); |
| 14 | 13 | } |
tests/codegen/intrinsic-no-unnamed-attr.rs+3-1| ... | ... | @@ -8,5 +8,7 @@ extern "rust-intrinsic" { |
| 8 | 8 | // CHECK: @llvm.sqrt.f32(float) #{{[0-9]*}} |
| 9 | 9 | |
| 10 | 10 | fn main() { |
| 11 | unsafe { sqrtf32(0.0f32); } | |
| 11 | unsafe { | |
| 12 | sqrtf32(0.0f32); | |
| 13 | } | |
| 12 | 14 | } |
tests/codegen/intrinsics/const_eval_select.rs+6-2| ... | ... | @@ -6,10 +6,14 @@ |
| 6 | 6 | |
| 7 | 7 | use std::intrinsics::const_eval_select; |
| 8 | 8 | |
| 9 | const fn foo(_: i32) -> i32 { 1 } | |
| 9 | const fn foo(_: i32) -> i32 { | |
| 10 | 1 | |
| 11 | } | |
| 10 | 12 | |
| 11 | 13 | #[no_mangle] |
| 12 | pub fn hi(n: i32) -> i32 { n } | |
| 14 | pub fn hi(n: i32) -> i32 { | |
| 15 | n | |
| 16 | } | |
| 13 | 17 | |
| 14 | 18 | #[no_mangle] |
| 15 | 19 | pub unsafe fn hey() { |
tests/codegen/intrinsics/likely.rs+3-11| ... | ... | @@ -3,17 +3,13 @@ |
| 3 | 3 | #![crate_type = "lib"] |
| 4 | 4 | #![feature(core_intrinsics)] |
| 5 | 5 | |
| 6 | use std::intrinsics::{likely,unlikely}; | |
| 6 | use std::intrinsics::{likely, unlikely}; | |
| 7 | 7 | |
| 8 | 8 | #[no_mangle] |
| 9 | 9 | pub fn check_likely(x: i32, y: i32) -> Option<i32> { |
| 10 | 10 | unsafe { |
| 11 | 11 | // CHECK: call i1 @llvm.expect.i1(i1 %{{.*}}, i1 true) |
| 12 | if likely(x == y) { | |
| 13 | None | |
| 14 | } else { | |
| 15 | Some(x + y) | |
| 16 | } | |
| 12 | if likely(x == y) { None } else { Some(x + y) } | |
| 17 | 13 | } |
| 18 | 14 | } |
| 19 | 15 | |
| ... | ... | @@ -21,10 +17,6 @@ pub fn check_likely(x: i32, y: i32) -> Option<i32> { |
| 21 | 17 | pub fn check_unlikely(x: i32, y: i32) -> Option<i32> { |
| 22 | 18 | unsafe { |
| 23 | 19 | // CHECK: call i1 @llvm.expect.i1(i1 %{{.*}}, i1 false) |
| 24 | if unlikely(x == y) { | |
| 25 | None | |
| 26 | } else { | |
| 27 | Some(x + y) | |
| 28 | } | |
| 20 | if unlikely(x == y) { None } else { Some(x + y) } | |
| 29 | 21 | } |
| 30 | 22 | } |
tests/codegen/intrinsics/prefetch.rs+3-2| ... | ... | @@ -3,8 +3,9 @@ |
| 3 | 3 | #![crate_type = "lib"] |
| 4 | 4 | #![feature(core_intrinsics)] |
| 5 | 5 | |
| 6 | use std::intrinsics::{prefetch_read_data, prefetch_write_data, | |
| 7 | prefetch_read_instruction, prefetch_write_instruction}; | |
| 6 | use std::intrinsics::{ | |
| 7 | prefetch_read_data, prefetch_read_instruction, prefetch_write_data, prefetch_write_instruction, | |
| 8 | }; | |
| 8 | 9 | |
| 9 | 10 | #[no_mangle] |
| 10 | 11 | pub fn check_prefetch_read_data(data: &[i8]) { |
tests/codegen/is_val_statically_known.rs+1-1| ... | ... | @@ -75,7 +75,7 @@ pub fn _slice_ref(a: &[u8]) -> i32 { |
| 75 | 75 | #[no_mangle] |
| 76 | 76 | pub fn _slice_ref_borrow() -> i32 { |
| 77 | 77 | // CHECK: ret i32 6 |
| 78 | _slice_ref(&[0;3]) | |
| 78 | _slice_ref(&[0; 3]) | |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | // CHECK-LABEL: @_slice_ref_arg( |
tests/codegen/issue-97217.rs+1-1| ... | ... | @@ -16,6 +16,6 @@ pub fn issue97217() -> i32 { |
| 16 | 16 | let v1 = vec![5, 6, 7]; |
| 17 | 17 | let v1_iter = v1.iter(); |
| 18 | 18 | let total: i32 = v1_iter.sum(); |
| 19 | println!("{}",total); | |
| 19 | println!("{}", total); | |
| 20 | 20 | total |
| 21 | 21 | } |
tests/codegen/issues/issue-103327.rs+1-5| ... | ... | @@ -9,9 +9,5 @@ pub fn test(a: i32, b: i32) -> bool { |
| 9 | 9 | let c1 = (a >= 0) && (a <= 10); |
| 10 | 10 | let c2 = (b >= 0) && (b <= 20); |
| 11 | 11 | |
| 12 | if c1 & c2 { | |
| 13 | a + 100 != b | |
| 14 | } else { | |
| 15 | true | |
| 16 | } | |
| 12 | if c1 & c2 { a + 100 != b } else { true } | |
| 17 | 13 | } |
tests/codegen/issues/issue-105386-ub-in-debuginfo.rs+2-1| ... | ... | @@ -6,7 +6,8 @@ pub struct S([usize; 8]); |
| 6 | 6 | |
| 7 | 7 | #[no_mangle] |
| 8 | 8 | pub fn outer_function(x: S, y: S) -> usize { |
| 9 | (#[inline(always)]|| { | |
| 9 | (#[inline(always)] | |
| 10 | || { | |
| 10 | 11 | let _z = x; |
| 11 | 12 | y.0[0] |
| 12 | 13 | })() |
tests/codegen/issues/issue-119422.rs+2-2| ... | ... | @@ -5,8 +5,8 @@ |
| 5 | 5 | //@ only-64bit (because the LLVM type of i64 for usize shows up) |
| 6 | 6 | #![crate_type = "lib"] |
| 7 | 7 | |
| 8 | use core::ptr::NonNull; | |
| 9 | 8 | use core::num::NonZero; |
| 9 | use core::ptr::NonNull; | |
| 10 | 10 | |
| 11 | 11 | // CHECK-LABEL: @check_non_null |
| 12 | 12 | #[no_mangle] |
| ... | ... | @@ -73,7 +73,7 @@ pub fn isize_try_from_i32(x: NonZero<i32>) -> NonZero<isize> { |
| 73 | 73 | |
| 74 | 74 | // CHECK-LABEL: @u64_from_nonzero_is_not_zero |
| 75 | 75 | #[no_mangle] |
| 76 | pub fn u64_from_nonzero_is_not_zero(x: NonZero<u64>)->bool { | |
| 76 | pub fn u64_from_nonzero_is_not_zero(x: NonZero<u64>) -> bool { | |
| 77 | 77 | // CHECK-NOT: br |
| 78 | 78 | // CHECK: ret i1 false |
| 79 | 79 | // CHECK-NOT: br |
tests/codegen/issues/issue-13018.rs+1-1| ... | ... | @@ -6,6 +6,6 @@ |
| 6 | 6 | use std::rc::Rc; |
| 7 | 7 | |
| 8 | 8 | pub fn foo(t: &Rc<Vec<usize>>) { |
| 9 | // CHECK-NOT: __rust_dealloc | |
| 9 | // CHECK-NOT: __rust_dealloc | |
| 10 | 10 | drop(t.clone()); |
| 11 | 11 | } |
tests/codegen/issues/issue-32364.rs+2-3| ... | ... | @@ -7,10 +7,9 @@ |
| 7 | 7 | struct Foo; |
| 8 | 8 | |
| 9 | 9 | impl Foo { |
| 10 | // CHECK: define internal x86_stdcallcc void @{{.*}}foo{{.*}}() | |
| 10 | // CHECK: define internal x86_stdcallcc void @{{.*}}foo{{.*}}() | |
| 11 | 11 | #[inline(never)] |
| 12 | pub extern "stdcall" fn foo<T>() { | |
| 13 | } | |
| 12 | pub extern "stdcall" fn foo<T>() {} | |
| 14 | 13 | } |
| 15 | 14 | |
| 16 | 15 | fn main() { |
tests/codegen/issues/issue-37945.rs+17-17| ... | ... | @@ -9,26 +9,26 @@ use std::slice::Iter; |
| 9 | 9 | |
| 10 | 10 | #[no_mangle] |
| 11 | 11 | pub fn is_empty_1(xs: Iter<f32>) -> bool { |
| 12 | // CHECK-LABEL: @is_empty_1( | |
| 13 | // CHECK-NEXT: start: | |
| 14 | // CHECK-NEXT: [[A:%.*]] = icmp ne ptr {{%xs.0|%xs.1}}, null | |
| 15 | // CHECK-NEXT: tail call void @llvm.assume(i1 [[A]]) | |
| 16 | // The order between %xs.0 and %xs.1 on the next line doesn't matter | |
| 17 | // and different LLVM versions produce different order. | |
| 18 | // CHECK-NEXT: [[B:%.*]] = icmp eq ptr {{%xs.0, %xs.1|%xs.1, %xs.0}} | |
| 19 | // CHECK-NEXT: ret i1 [[B:%.*]] | |
| 20 | {xs}.next().is_none() | |
| 12 | // CHECK-LABEL: @is_empty_1( | |
| 13 | // CHECK-NEXT: start: | |
| 14 | // CHECK-NEXT: [[A:%.*]] = icmp ne ptr {{%xs.0|%xs.1}}, null | |
| 15 | // CHECK-NEXT: tail call void @llvm.assume(i1 [[A]]) | |
| 16 | // The order between %xs.0 and %xs.1 on the next line doesn't matter | |
| 17 | // and different LLVM versions produce different order. | |
| 18 | // CHECK-NEXT: [[B:%.*]] = icmp eq ptr {{%xs.0, %xs.1|%xs.1, %xs.0}} | |
| 19 | // CHECK-NEXT: ret i1 [[B:%.*]] | |
| 20 | { xs }.next().is_none() | |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | #[no_mangle] |
| 24 | 24 | pub fn is_empty_2(xs: Iter<f32>) -> bool { |
| 25 | // CHECK-LABEL: @is_empty_2 | |
| 26 | // CHECK-NEXT: start: | |
| 27 | // CHECK-NEXT: [[C:%.*]] = icmp ne ptr {{%xs.0|%xs.1}}, null | |
| 28 | // CHECK-NEXT: tail call void @llvm.assume(i1 [[C]]) | |
| 29 | // The order between %xs.0 and %xs.1 on the next line doesn't matter | |
| 30 | // and different LLVM versions produce different order. | |
| 31 | // CHECK-NEXT: [[D:%.*]] = icmp eq ptr {{%xs.0, %xs.1|%xs.1, %xs.0}} | |
| 32 | // CHECK-NEXT: ret i1 [[D:%.*]] | |
| 25 | // CHECK-LABEL: @is_empty_2 | |
| 26 | // CHECK-NEXT: start: | |
| 27 | // CHECK-NEXT: [[C:%.*]] = icmp ne ptr {{%xs.0|%xs.1}}, null | |
| 28 | // CHECK-NEXT: tail call void @llvm.assume(i1 [[C]]) | |
| 29 | // The order between %xs.0 and %xs.1 on the next line doesn't matter | |
| 30 | // and different LLVM versions produce different order. | |
| 31 | // CHECK-NEXT: [[D:%.*]] = icmp eq ptr {{%xs.0, %xs.1|%xs.1, %xs.0}} | |
| 32 | // CHECK-NEXT: ret i1 [[D:%.*]] | |
| 33 | 33 | xs.map(|&x| x).next().is_none() |
| 34 | 34 | } |
tests/codegen/issues/issue-45466.rs+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | //@ compile-flags: -O |
| 2 | 2 | |
| 3 | #![crate_type="rlib"] | |
| 3 | #![crate_type = "rlib"] | |
| 4 | 4 | |
| 5 | 5 | // CHECK-LABEL: @memzero |
| 6 | 6 | // CHECK-NOT: store |
tests/codegen/issues/issue-45964-bounds-check-slice-pos.rs+1-1| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | |
| 4 | 4 | //@ compile-flags: -O |
| 5 | 5 | |
| 6 | #![crate_type="rlib"] | |
| 6 | #![crate_type = "rlib"] | |
| 7 | 7 | |
| 8 | 8 | // CHECK-LABEL: @test |
| 9 | 9 | #[no_mangle] |
tests/codegen/issues/issue-47278.rs+4-2| ... | ... | @@ -1,9 +1,11 @@ |
| 1 | 1 | // -C no-prepopulate-passes |
| 2 | #![crate_type="staticlib"] | |
| 2 | #![crate_type = "staticlib"] | |
| 3 | 3 | |
| 4 | 4 | #[repr(C)] |
| 5 | 5 | pub struct Foo(u64); |
| 6 | 6 | |
| 7 | 7 | // CHECK: define {{.*}} @foo( |
| 8 | 8 | #[no_mangle] |
| 9 | pub extern "C" fn foo(_: Foo) -> Foo { loop {} } | |
| 9 | pub extern "C" fn foo(_: Foo) -> Foo { | |
| 10 | loop {} | |
| 11 | } |
tests/codegen/issues/issue-47442.rs+1-1| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | // CHECK-NOT: Unwind |
| 5 | 5 | |
| 6 | 6 | #![feature(test)] |
| 7 | #![crate_type="rlib"] | |
| 7 | #![crate_type = "rlib"] | |
| 8 | 8 | |
| 9 | 9 | extern crate test; |
| 10 | 10 |
tests/codegen/issues/issue-56267-2.rs+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | //@ compile-flags: -C no-prepopulate-passes |
| 2 | 2 | |
| 3 | #![crate_type="rlib"] | |
| 3 | #![crate_type = "rlib"] | |
| 4 | 4 | |
| 5 | 5 | #[allow(dead_code)] |
| 6 | 6 | pub struct Foo<T> { |
tests/codegen/issues/issue-56267.rs+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | //@ compile-flags: -C no-prepopulate-passes |
| 2 | 2 | |
| 3 | #![crate_type="rlib"] | |
| 3 | #![crate_type = "rlib"] | |
| 4 | 4 | |
| 5 | 5 | #[allow(dead_code)] |
| 6 | 6 | pub struct Foo<T> { |
tests/codegen/issues/issue-56927.rs+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | //@ compile-flags: -C no-prepopulate-passes |
| 2 | 2 | |
| 3 | #![crate_type="rlib"] | |
| 3 | #![crate_type = "rlib"] | |
| 4 | 4 | |
| 5 | 5 | #[repr(align(16))] |
| 6 | 6 | pub struct S { |
tests/codegen/issues/issue-73031.rs+1-5| ... | ... | @@ -12,11 +12,7 @@ pub enum All { |
| 12 | 12 | // CHECK-LABEL: @issue_73031 |
| 13 | 13 | #[no_mangle] |
| 14 | 14 | pub fn issue_73031(a: &mut All, q: i32) -> i32 { |
| 15 | *a = if q == 5 { | |
| 16 | All::Foo | |
| 17 | } else { | |
| 18 | All::Bar | |
| 19 | }; | |
| 15 | *a = if q == 5 { All::Foo } else { All::Bar }; | |
| 20 | 16 | match *a { |
| 21 | 17 | // CHECK-NOT: panic |
| 22 | 18 | All::None => panic!(), |
tests/codegen/issues/issue-73258.rs+4-1| ... | ... | @@ -7,7 +7,10 @@ |
| 7 | 7 | #[derive(Clone, Copy)] |
| 8 | 8 | #[repr(u8)] |
| 9 | 9 | pub enum Foo { |
| 10 | A, B, C, D, | |
| 10 | A, | |
| 11 | B, | |
| 12 | C, | |
| 13 | D, | |
| 11 | 14 | } |
| 12 | 15 | |
| 13 | 16 | // CHECK-LABEL: @issue_73258( |
tests/codegen/issues/issue-73338-effecient-cmp.rs+5-5| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | |
| 5 | 5 | //@ compile-flags: -Copt-level=3 |
| 6 | 6 | |
| 7 | #![crate_type="lib"] | |
| 7 | #![crate_type = "lib"] | |
| 8 | 8 | |
| 9 | 9 | #[repr(u32)] |
| 10 | 10 | #[derive(Copy, Clone, Eq, PartialEq, PartialOrd)] |
| ... | ... | @@ -15,25 +15,25 @@ pub enum Foo { |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | #[no_mangle] |
| 18 | pub fn compare_less(a: Foo, b: Foo)->bool{ | |
| 18 | pub fn compare_less(a: Foo, b: Foo) -> bool { | |
| 19 | 19 | // CHECK-NOT: br {{.*}} |
| 20 | 20 | a < b |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | #[no_mangle] |
| 24 | pub fn compare_le(a: Foo, b: Foo)->bool{ | |
| 24 | pub fn compare_le(a: Foo, b: Foo) -> bool { | |
| 25 | 25 | // CHECK-NOT: br {{.*}} |
| 26 | 26 | a <= b |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | #[no_mangle] |
| 30 | pub fn compare_ge(a: Foo, b: Foo)->bool{ | |
| 30 | pub fn compare_ge(a: Foo, b: Foo) -> bool { | |
| 31 | 31 | // CHECK-NOT: br {{.*}} |
| 32 | 32 | a >= b |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | #[no_mangle] |
| 36 | pub fn compare_greater(a: Foo, b: Foo)->bool{ | |
| 36 | pub fn compare_greater(a: Foo, b: Foo) -> bool { | |
| 37 | 37 | // CHECK-NOT: br {{.*}} |
| 38 | 38 | a > b |
| 39 | 39 | } |
tests/codegen/issues/issue-73396-bounds-check-after-position.rs+6-30| ... | ... | @@ -12,11 +12,7 @@ pub fn position_slice_to_no_bounds_check(s: &[u8]) -> &[u8] { |
| 12 | 12 | // CHECK-NOT: slice_end_index_len_fail |
| 13 | 13 | // CHECK-NOT: panic_bounds_check |
| 14 | 14 | // CHECK-NOT: unreachable |
| 15 | if let Some(idx) = s.iter().position(|b| *b == b'\\') { | |
| 16 | &s[..idx] | |
| 17 | } else { | |
| 18 | s | |
| 19 | } | |
| 15 | if let Some(idx) = s.iter().position(|b| *b == b'\\') { &s[..idx] } else { s } | |
| 20 | 16 | } |
| 21 | 17 | |
| 22 | 18 | // CHECK-LABEL: @position_slice_from_no_bounds_check |
| ... | ... | @@ -27,11 +23,7 @@ pub fn position_slice_from_no_bounds_check(s: &[u8]) -> &[u8] { |
| 27 | 23 | // CHECK-NOT: slice_end_index_len_fail |
| 28 | 24 | // CHECK-NOT: panic_bounds_check |
| 29 | 25 | // CHECK-NOT: unreachable |
| 30 | if let Some(idx) = s.iter().position(|b| *b == b'\\') { | |
| 31 | &s[idx..] | |
| 32 | } else { | |
| 33 | s | |
| 34 | } | |
| 26 | if let Some(idx) = s.iter().position(|b| *b == b'\\') { &s[idx..] } else { s } | |
| 35 | 27 | } |
| 36 | 28 | |
| 37 | 29 | // CHECK-LABEL: @position_index_no_bounds_check |
| ... | ... | @@ -42,11 +34,7 @@ pub fn position_index_no_bounds_check(s: &[u8]) -> u8 { |
| 42 | 34 | // CHECK-NOT: slice_end_index_len_fail |
| 43 | 35 | // CHECK-NOT: panic_bounds_check |
| 44 | 36 | // CHECK-NOT: unreachable |
| 45 | if let Some(idx) = s.iter().position(|b| *b == b'\\') { | |
| 46 | s[idx] | |
| 47 | } else { | |
| 48 | 42 | |
| 49 | } | |
| 37 | if let Some(idx) = s.iter().position(|b| *b == b'\\') { s[idx] } else { 42 } | |
| 50 | 38 | } |
| 51 | 39 | // CHECK-LABEL: @rposition_slice_to_no_bounds_check |
| 52 | 40 | #[no_mangle] |
| ... | ... | @@ -56,11 +44,7 @@ pub fn rposition_slice_to_no_bounds_check(s: &[u8]) -> &[u8] { |
| 56 | 44 | // CHECK-NOT: slice_end_index_len_fail |
| 57 | 45 | // CHECK-NOT: panic_bounds_check |
| 58 | 46 | // CHECK-NOT: unreachable |
| 59 | if let Some(idx) = s.iter().rposition(|b| *b == b'\\') { | |
| 60 | &s[..idx] | |
| 61 | } else { | |
| 62 | s | |
| 63 | } | |
| 47 | if let Some(idx) = s.iter().rposition(|b| *b == b'\\') { &s[..idx] } else { s } | |
| 64 | 48 | } |
| 65 | 49 | |
| 66 | 50 | // CHECK-LABEL: @rposition_slice_from_no_bounds_check |
| ... | ... | @@ -71,11 +55,7 @@ pub fn rposition_slice_from_no_bounds_check(s: &[u8]) -> &[u8] { |
| 71 | 55 | // CHECK-NOT: slice_end_index_len_fail |
| 72 | 56 | // CHECK-NOT: panic_bounds_check |
| 73 | 57 | // CHECK-NOT: unreachable |
| 74 | if let Some(idx) = s.iter().rposition(|b| *b == b'\\') { | |
| 75 | &s[idx..] | |
| 76 | } else { | |
| 77 | s | |
| 78 | } | |
| 58 | if let Some(idx) = s.iter().rposition(|b| *b == b'\\') { &s[idx..] } else { s } | |
| 79 | 59 | } |
| 80 | 60 | |
| 81 | 61 | // CHECK-LABEL: @rposition_index_no_bounds_check |
| ... | ... | @@ -86,9 +66,5 @@ pub fn rposition_index_no_bounds_check(s: &[u8]) -> u8 { |
| 86 | 66 | // CHECK-NOT: slice_end_index_len_fail |
| 87 | 67 | // CHECK-NOT: panic_bounds_check |
| 88 | 68 | // CHECK-NOT: unreachable |
| 89 | if let Some(idx) = s.iter().rposition(|b| *b == b'\\') { | |
| 90 | s[idx] | |
| 91 | } else { | |
| 92 | 42 | |
| 93 | } | |
| 69 | if let Some(idx) = s.iter().rposition(|b| *b == b'\\') { s[idx] } else { 42 } | |
| 94 | 70 | } |
tests/codegen/issues/issue-75546.rs+3-1| ... | ... | @@ -9,7 +9,9 @@ pub fn issue_75546() { |
| 9 | 9 | let mut i = 1u32; |
| 10 | 10 | while i < u32::MAX { |
| 11 | 11 | // CHECK-NOT: panic |
| 12 | if i == 0 { panic!(); } | |
| 12 | if i == 0 { | |
| 13 | panic!(); | |
| 14 | } | |
| 13 | 15 | i += 1; |
| 14 | 16 | } |
| 15 | 17 | } |
tests/codegen/issues/issue-77812.rs+1-1| ... | ... | @@ -10,7 +10,7 @@ pub enum Variant { |
| 10 | 10 | Two, |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | extern { | |
| 13 | extern "C" { | |
| 14 | 14 | fn exf1(); |
| 15 | 15 | fn exf2(); |
| 16 | 16 | } |
tests/codegen/issues/issue-84268.rs+1-3| ... | ... | @@ -17,7 +17,5 @@ pub struct M([i32; 4]); |
| 17 | 17 | pub fn is_infinite(v: V) -> M { |
| 18 | 18 | // CHECK: fabs |
| 19 | 19 | // CHECK: cmp oeq |
| 20 | unsafe { | |
| 21 | simd_eq(simd_fabs(v), V([f32::INFINITY; 4])) | |
| 22 | } | |
| 20 | unsafe { simd_eq(simd_fabs(v), V([f32::INFINITY; 4])) } | |
| 23 | 21 | } |
tests/codegen/issues/issue-96497-slice-size-nowrap.rs+1-1| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | |
| 5 | 5 | //@ compile-flags: -O |
| 6 | 6 | |
| 7 | #![crate_type="lib"] | |
| 7 | #![crate_type = "lib"] | |
| 8 | 8 | |
| 9 | 9 | // CHECK-LABEL: @simple_size_of_nowrap |
| 10 | 10 | #[no_mangle] |
tests/codegen/issues/issue-99960.rs+1-5| ... | ... | @@ -6,9 +6,5 @@ |
| 6 | 6 | pub fn test(dividend: i64, divisor: i64) -> Option<i64> { |
| 7 | 7 | // CHECK-LABEL: @test( |
| 8 | 8 | // CHECK-NOT: panic |
| 9 | if dividend > i64::min_value() && divisor != 0 { | |
| 10 | Some(dividend / divisor) | |
| 11 | } else { | |
| 12 | None | |
| 13 | } | |
| 9 | if dividend > i64::min_value() && divisor != 0 { Some(dividend / divisor) } else { None } | |
| 14 | 10 | } |
tests/codegen/lib-optimizations/iter-sum.rs-1| ... | ... | @@ -2,7 +2,6 @@ |
| 2 | 2 | //@ only-x86_64 (vectorization varies between architectures) |
| 3 | 3 | #![crate_type = "lib"] |
| 4 | 4 | |
| 5 | ||
| 6 | 5 | // Ensure that slice + take + sum gets vectorized. |
| 7 | 6 | // Currently this relies on the slice::Iter::try_fold implementation |
| 8 | 7 | // CHECK-LABEL: @slice_take_sum |
tests/codegen/lifetime_start_end.rs+8-8| ... | ... | @@ -8,27 +8,27 @@ pub fn test() { |
| 8 | 8 | let a = 0u8; |
| 9 | 9 | &a; // keep variable in an alloca |
| 10 | 10 | |
| 11 | // CHECK: call void @llvm.lifetime.start{{.*}}(i{{[0-9 ]+}}, ptr %a) | |
| 11 | // CHECK: call void @llvm.lifetime.start{{.*}}(i{{[0-9 ]+}}, ptr %a) | |
| 12 | 12 | |
| 13 | 13 | { |
| 14 | 14 | let b = &Some(a); |
| 15 | 15 | &b; // keep variable in an alloca |
| 16 | 16 | |
| 17 | // CHECK: call void @llvm.lifetime.start{{.*}}(i{{[0-9 ]+}}, {{.*}}) | |
| 17 | // CHECK: call void @llvm.lifetime.start{{.*}}(i{{[0-9 ]+}}, {{.*}}) | |
| 18 | 18 | |
| 19 | // CHECK: call void @llvm.lifetime.start{{.*}}(i{{[0-9 ]+}}, {{.*}}) | |
| 19 | // CHECK: call void @llvm.lifetime.start{{.*}}(i{{[0-9 ]+}}, {{.*}}) | |
| 20 | 20 | |
| 21 | // CHECK: call void @llvm.lifetime.end{{.*}}(i{{[0-9 ]+}}, {{.*}}) | |
| 21 | // CHECK: call void @llvm.lifetime.end{{.*}}(i{{[0-9 ]+}}, {{.*}}) | |
| 22 | 22 | |
| 23 | // CHECK: call void @llvm.lifetime.end{{.*}}(i{{[0-9 ]+}}, {{.*}}) | |
| 23 | // CHECK: call void @llvm.lifetime.end{{.*}}(i{{[0-9 ]+}}, {{.*}}) | |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | let c = 1u8; |
| 27 | 27 | &c; // keep variable in an alloca |
| 28 | 28 | |
| 29 | // CHECK: call void @llvm.lifetime.start{{.*}}(i{{[0-9 ]+}}, ptr %c) | |
| 29 | // CHECK: call void @llvm.lifetime.start{{.*}}(i{{[0-9 ]+}}, ptr %c) | |
| 30 | 30 | |
| 31 | // CHECK: call void @llvm.lifetime.end{{.*}}(i{{[0-9 ]+}}, ptr %c) | |
| 31 | // CHECK: call void @llvm.lifetime.end{{.*}}(i{{[0-9 ]+}}, ptr %c) | |
| 32 | 32 | |
| 33 | // CHECK: call void @llvm.lifetime.end{{.*}}(i{{[0-9 ]+}}, ptr %a) | |
| 33 | // CHECK: call void @llvm.lifetime.end{{.*}}(i{{[0-9 ]+}}, ptr %a) | |
| 34 | 34 | } |
tests/codegen/link-dead-code.rs+9-3| ... | ... | @@ -8,15 +8,21 @@ |
| 8 | 8 | // CHECK-LABEL: ; link_dead_code::const_fn |
| 9 | 9 | // CHECK-NEXT: ; Function Attrs: |
| 10 | 10 | // CHECK-NEXT: define hidden |
| 11 | const fn const_fn() -> i32 { 1 } | |
| 11 | const fn const_fn() -> i32 { | |
| 12 | 1 | |
| 13 | } | |
| 12 | 14 | |
| 13 | 15 | // CHECK-LABEL: ; link_dead_code::inline_fn |
| 14 | 16 | // CHECK-NEXT: ; Function Attrs: |
| 15 | 17 | // CHECK-NEXT: define hidden |
| 16 | 18 | #[inline] |
| 17 | fn inline_fn() -> i32 { 2 } | |
| 19 | fn inline_fn() -> i32 { | |
| 20 | 2 | |
| 21 | } | |
| 18 | 22 | |
| 19 | 23 | // CHECK-LABEL: ; link_dead_code::private_fn |
| 20 | 24 | // CHECK-NEXT: ; Function Attrs: |
| 21 | 25 | // CHECK-NEXT: define hidden |
| 22 | fn private_fn() -> i32 { 3 } | |
| 26 | fn private_fn() -> i32 { | |
| 27 | 3 | |
| 28 | } |
tests/codegen/link_section.rs+1-1| ... | ... | @@ -16,7 +16,7 @@ pub static VAR1: u32 = 0x01000000; |
| 16 | 16 | |
| 17 | 17 | pub enum E { |
| 18 | 18 | A(u32), |
| 19 | B(f32) | |
| 19 | B(f32), | |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | // CHECK: @VAR2 = {{(dso_local )?}}constant {{.*}}, section ".test_two" |
tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs+6-3| ... | ... | @@ -6,9 +6,12 @@ |
| 6 | 6 | #![no_std] |
| 7 | 7 | #![no_core] |
| 8 | 8 | |
| 9 | #[lang="sized"] trait Sized { } | |
| 10 | #[lang="freeze"] trait Freeze { } | |
| 11 | #[lang="copy"] trait Copy { } | |
| 9 | #[lang = "sized"] | |
| 10 | trait Sized {} | |
| 11 | #[lang = "freeze"] | |
| 12 | trait Freeze {} | |
| 13 | #[lang = "copy"] | |
| 14 | trait Copy {} | |
| 12 | 15 | |
| 13 | 16 | // 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) |
| 14 | 17 | #[no_mangle] |
tests/codegen/lto-removes-invokes.rs+2-2| ... | ... | @@ -10,8 +10,8 @@ fn main() { |
| 10 | 10 | fn foo() { |
| 11 | 11 | let _a = Box::new(3); |
| 12 | 12 | bar(); |
| 13 | // CHECK-LABEL: define dso_local void @foo | |
| 14 | // CHECK: call void @bar | |
| 13 | // CHECK-LABEL: define dso_local void @foo | |
| 14 | // CHECK: call void @bar | |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | #[inline(never)] |
tests/codegen/macos/i686-macosx-deployment-target.rs+6-6| ... | ... | @@ -8,12 +8,12 @@ |
| 8 | 8 | #![feature(no_core, lang_items)] |
| 9 | 9 | #![no_core] |
| 10 | 10 | |
| 11 | #[lang="sized"] | |
| 12 | trait Sized { } | |
| 13 | #[lang="freeze"] | |
| 14 | trait Freeze { } | |
| 15 | #[lang="copy"] | |
| 16 | trait Copy { } | |
| 11 | #[lang = "sized"] | |
| 12 | trait Sized {} | |
| 13 | #[lang = "freeze"] | |
| 14 | trait Freeze {} | |
| 15 | #[lang = "copy"] | |
| 16 | trait Copy {} | |
| 17 | 17 | |
| 18 | 18 | #[repr(C)] |
| 19 | 19 | pub struct Bool { |
tests/codegen/macos/i686-no-macosx-deployment-target.rs+6-6| ... | ... | @@ -8,12 +8,12 @@ |
| 8 | 8 | #![feature(no_core, lang_items)] |
| 9 | 9 | #![no_core] |
| 10 | 10 | |
| 11 | #[lang="sized"] | |
| 12 | trait Sized { } | |
| 13 | #[lang="freeze"] | |
| 14 | trait Freeze { } | |
| 15 | #[lang="copy"] | |
| 16 | trait Copy { } | |
| 11 | #[lang = "sized"] | |
| 12 | trait Sized {} | |
| 13 | #[lang = "freeze"] | |
| 14 | trait Freeze {} | |
| 15 | #[lang = "copy"] | |
| 16 | trait Copy {} | |
| 17 | 17 | |
| 18 | 18 | #[repr(C)] |
| 19 | 19 | pub struct Bool { |
tests/codegen/macos/x86_64-macosx-deployment-target.rs+6-6| ... | ... | @@ -8,12 +8,12 @@ |
| 8 | 8 | #![feature(no_core, lang_items)] |
| 9 | 9 | #![no_core] |
| 10 | 10 | |
| 11 | #[lang="sized"] | |
| 12 | trait Sized { } | |
| 13 | #[lang="freeze"] | |
| 14 | trait Freeze { } | |
| 15 | #[lang="copy"] | |
| 16 | trait Copy { } | |
| 11 | #[lang = "sized"] | |
| 12 | trait Sized {} | |
| 13 | #[lang = "freeze"] | |
| 14 | trait Freeze {} | |
| 15 | #[lang = "copy"] | |
| 16 | trait Copy {} | |
| 17 | 17 | |
| 18 | 18 | #[repr(C)] |
| 19 | 19 | pub struct Bool { |
tests/codegen/macos/x86_64-no-macosx-deployment-target.rs+6-6| ... | ... | @@ -8,12 +8,12 @@ |
| 8 | 8 | #![feature(no_core, lang_items)] |
| 9 | 9 | #![no_core] |
| 10 | 10 | |
| 11 | #[lang="sized"] | |
| 12 | trait Sized { } | |
| 13 | #[lang="freeze"] | |
| 14 | trait Freeze { } | |
| 15 | #[lang="copy"] | |
| 16 | trait Copy { } | |
| 11 | #[lang = "sized"] | |
| 12 | trait Sized {} | |
| 13 | #[lang = "freeze"] | |
| 14 | trait Freeze {} | |
| 15 | #[lang = "copy"] | |
| 16 | trait Copy {} | |
| 17 | 17 | |
| 18 | 18 | #[repr(C)] |
| 19 | 19 | pub struct Bool { |
tests/codegen/match-optimized.rs+17-17| ... | ... | @@ -11,23 +11,23 @@ pub enum E { |
| 11 | 11 | // CHECK-LABEL: @exhaustive_match |
| 12 | 12 | #[no_mangle] |
| 13 | 13 | pub fn exhaustive_match(e: E) -> u8 { |
| 14 | // CHECK: switch{{.*}}, label %[[OTHERWISE:[a-zA-Z0-9_]+]] [ | |
| 15 | // CHECK-NEXT: i[[TY:[0-9]+]] [[DISCR:[0-9]+]], label %[[A:[a-zA-Z0-9_]+]] | |
| 16 | // CHECK-NEXT: i[[TY:[0-9]+]] [[DISCR:[0-9]+]], label %[[B:[a-zA-Z0-9_]+]] | |
| 17 | // CHECK-NEXT: i[[TY:[0-9]+]] [[DISCR:[0-9]+]], label %[[C:[a-zA-Z0-9_]+]] | |
| 18 | // CHECK-NEXT: ] | |
| 19 | // CHECK: [[OTHERWISE]]: | |
| 20 | // CHECK-NEXT: unreachable | |
| 21 | // | |
| 22 | // CHECK: [[A]]: | |
| 23 | // CHECK-NEXT: store i8 0, ptr %_0, align 1 | |
| 24 | // CHECK-NEXT: br label %[[EXIT:[a-zA-Z0-9_]+]] | |
| 25 | // CHECK: [[B]]: | |
| 26 | // CHECK-NEXT: store i8 1, ptr %_0, align 1 | |
| 27 | // CHECK-NEXT: br label %[[EXIT]] | |
| 28 | // CHECK: [[C]]: | |
| 29 | // CHECK-NEXT: store i8 3, ptr %_0, align 1 | |
| 30 | // CHECK-NEXT: br label %[[EXIT]] | |
| 14 | // CHECK: switch{{.*}}, label %[[OTHERWISE:[a-zA-Z0-9_]+]] [ | |
| 15 | // CHECK-NEXT: i[[TY:[0-9]+]] [[DISCR:[0-9]+]], label %[[A:[a-zA-Z0-9_]+]] | |
| 16 | // CHECK-NEXT: i[[TY:[0-9]+]] [[DISCR:[0-9]+]], label %[[B:[a-zA-Z0-9_]+]] | |
| 17 | // CHECK-NEXT: i[[TY:[0-9]+]] [[DISCR:[0-9]+]], label %[[C:[a-zA-Z0-9_]+]] | |
| 18 | // CHECK-NEXT: ] | |
| 19 | // CHECK: [[OTHERWISE]]: | |
| 20 | // CHECK-NEXT: unreachable | |
| 21 | // | |
| 22 | // CHECK: [[A]]: | |
| 23 | // CHECK-NEXT: store i8 0, ptr %_0, align 1 | |
| 24 | // CHECK-NEXT: br label %[[EXIT:[a-zA-Z0-9_]+]] | |
| 25 | // CHECK: [[B]]: | |
| 26 | // CHECK-NEXT: store i8 1, ptr %_0, align 1 | |
| 27 | // CHECK-NEXT: br label %[[EXIT]] | |
| 28 | // CHECK: [[C]]: | |
| 29 | // CHECK-NEXT: store i8 3, ptr %_0, align 1 | |
| 30 | // CHECK-NEXT: br label %[[EXIT]] | |
| 31 | 31 | match e { |
| 32 | 32 | E::A => 0, |
| 33 | 33 | E::B => 1, |
tests/codegen/match-optimizes-away.rs+12-3| ... | ... | @@ -1,11 +1,20 @@ |
| 1 | 1 | // |
| 2 | 2 | //@ compile-flags: -O |
| 3 | #![crate_type="lib"] | |
| 3 | #![crate_type = "lib"] | |
| 4 | 4 | |
| 5 | pub enum Three { A, B, C } | |
| 5 | pub enum Three { | |
| 6 | A, | |
| 7 | B, | |
| 8 | C, | |
| 9 | } | |
| 6 | 10 | |
| 7 | 11 | #[repr(u16)] |
| 8 | pub enum Four { A, B, C, D } | |
| 12 | pub enum Four { | |
| 13 | A, | |
| 14 | B, | |
| 15 | C, | |
| 16 | D, | |
| 17 | } | |
| 9 | 18 | |
| 10 | 19 | #[no_mangle] |
| 11 | 20 | pub fn three_valued(x: Three) -> Three { |
tests/codegen/mir_zst_stores.rs+3-1| ... | ... | @@ -4,7 +4,9 @@ |
| 4 | 4 | use std::marker::PhantomData; |
| 5 | 5 | |
| 6 | 6 | #[derive(Copy, Clone)] |
| 7 | struct Zst { phantom: PhantomData<Zst> } | |
| 7 | struct Zst { | |
| 8 | phantom: PhantomData<Zst>, | |
| 9 | } | |
| 8 | 10 | |
| 9 | 11 | // CHECK-LABEL: @mir |
| 10 | 12 | // CHECK-NOT: store{{.*}}undef |
tests/codegen/naked-fn/naked-functions.rs+2-5| ... | ... | @@ -14,8 +14,7 @@ pub unsafe extern "C" fn naked_empty() { |
| 14 | 14 | // CHECK-NEXT: {{.+}}: |
| 15 | 15 | // CHECK-NEXT: call void asm |
| 16 | 16 | // CHECK-NEXT: unreachable |
| 17 | asm!("ret", | |
| 18 | options(noreturn)); | |
| 17 | asm!("ret", options(noreturn)); | |
| 19 | 18 | } |
| 20 | 19 | |
| 21 | 20 | // CHECK: Function Attrs: naked |
| ... | ... | @@ -26,7 +25,5 @@ pub unsafe extern "C" fn naked_with_args_and_return(a: isize, b: isize) -> isize |
| 26 | 25 | // CHECK-NEXT: {{.+}}: |
| 27 | 26 | // CHECK-NEXT: call void asm |
| 28 | 27 | // CHECK-NEXT: unreachable |
| 29 | asm!("lea rax, [rdi + rsi]", | |
| 30 | "ret", | |
| 31 | options(noreturn)); | |
| 28 | asm!("lea rax, [rdi + rsi]", "ret", options(noreturn)); | |
| 32 | 29 | } |
tests/codegen/no-assumes-on-casts.rs+4-4| ... | ... | @@ -6,14 +6,14 @@ |
| 6 | 6 | #[no_mangle] |
| 7 | 7 | pub fn fna(a: i16) -> i32 { |
| 8 | 8 | a as i32 |
| 9 | // CHECK-NOT: assume | |
| 10 | // CHECK: sext | |
| 9 | // CHECK-NOT: assume | |
| 10 | // CHECK: sext | |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | // CHECK-LABEL: fnb |
| 14 | 14 | #[no_mangle] |
| 15 | 15 | pub fn fnb(a: u16) -> u32 { |
| 16 | 16 | a as u32 |
| 17 | // CHECK-NOT: assume | |
| 18 | // CHECK: zext | |
| 17 | // CHECK-NOT: assume | |
| 18 | // CHECK: zext | |
| 19 | 19 | } |
tests/codegen/noalias-freeze.rs+3-1| ... | ... | @@ -8,7 +8,9 @@ |
| 8 | 8 | |
| 9 | 9 | #![crate_type = "lib"] |
| 10 | 10 | |
| 11 | fn project<T>(x: &(T,)) -> &T { &x.0 } | |
| 11 | fn project<T>(x: &(T,)) -> &T { | |
| 12 | &x.0 | |
| 13 | } | |
| 12 | 14 | |
| 13 | 15 | fn dummy() {} |
| 14 | 16 |
tests/codegen/noalias-unpin.rs+1-1| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | |
| 5 | 5 | pub struct SelfRef { |
| 6 | 6 | self_ref: *mut SelfRef, |
| 7 | _pin: std::marker::PhantomPinned | |
| 7 | _pin: std::marker::PhantomPinned, | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | // CHECK-LABEL: @test_self_ref( |
tests/codegen/non-terminate/infinite-recursion.rs-1| ... | ... | @@ -1,7 +1,6 @@ |
| 1 | 1 | //@ compile-flags: -C opt-level=3 |
| 2 | 2 | |
| 3 | 3 | #![crate_type = "lib"] |
| 4 | ||
| 5 | 4 | #![allow(unconditional_recursion)] |
| 6 | 5 | |
| 7 | 6 | // CHECK-LABEL: @infinite_recursion |
tests/codegen/noreturnflag.rs+2-2| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | |
| 5 | 5 | #[no_mangle] |
| 6 | 6 | pub fn foo() -> ! { |
| 7 | // CHECK: @foo() unnamed_addr #0 | |
| 7 | // CHECK: @foo() unnamed_addr #0 | |
| 8 | 8 | loop {} |
| 9 | 9 | } |
| 10 | 10 | |
| ... | ... | @@ -12,7 +12,7 @@ pub enum EmptyEnum {} |
| 12 | 12 | |
| 13 | 13 | #[no_mangle] |
| 14 | 14 | pub fn bar() -> EmptyEnum { |
| 15 | // CHECK: @bar() unnamed_addr #0 | |
| 15 | // CHECK: @bar() unnamed_addr #0 | |
| 16 | 16 | loop {} |
| 17 | 17 | } |
| 18 | 18 |
tests/codegen/nounwind.rs+3-3| ... | ... | @@ -10,7 +10,7 @@ extern crate nounwind; |
| 10 | 10 | #[no_mangle] |
| 11 | 11 | pub fn foo() { |
| 12 | 12 | nounwind::bar(); |
| 13 | // CHECK: @foo() unnamed_addr #0 | |
| 14 | // CHECK: @bar() unnamed_addr #0 | |
| 15 | // CHECK: attributes #0 = { {{.*}}nounwind{{.*}} } | |
| 13 | // CHECK: @foo() unnamed_addr #0 | |
| 14 | // CHECK: @bar() unnamed_addr #0 | |
| 15 | // CHECK: attributes #0 = { {{.*}}nounwind{{.*}} } | |
| 16 | 16 | } |
tests/codegen/optimize-attr-1.rs+1-1| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | //@[SPEED-OPT] compile-flags: -Copt-level=3 -Ccodegen-units=1 |
| 5 | 5 | |
| 6 | 6 | #![feature(optimize_attribute)] |
| 7 | #![crate_type="rlib"] | |
| 7 | #![crate_type = "rlib"] | |
| 8 | 8 | |
| 9 | 9 | // CHECK-LABEL: define{{.*}}i32 @nothing |
| 10 | 10 | // CHECK-SAME: [[NOTHING_ATTRS:#[0-9]+]] |
tests/codegen/option-niche-eq.rs+1-1| ... | ... | @@ -4,8 +4,8 @@ |
| 4 | 4 | |
| 5 | 5 | extern crate core; |
| 6 | 6 | use core::cmp::Ordering; |
| 7 | use core::ptr::NonNull; | |
| 8 | 7 | use core::num::NonZero; |
| 8 | use core::ptr::NonNull; | |
| 9 | 9 | |
| 10 | 10 | // CHECK-LABEL: @non_zero_eq |
| 11 | 11 | #[no_mangle] |
tests/codegen/packed.rs+18-18| ... | ... | @@ -6,20 +6,20 @@ |
| 6 | 6 | #[repr(packed)] |
| 7 | 7 | pub struct Packed1 { |
| 8 | 8 | dealign: u8, |
| 9 | data: u32 | |
| 9 | data: u32, | |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | #[repr(packed(2))] |
| 13 | 13 | pub struct Packed2 { |
| 14 | 14 | dealign: u8, |
| 15 | data: u32 | |
| 15 | data: u32, | |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | // CHECK-LABEL: @write_pkd1 |
| 19 | 19 | #[no_mangle] |
| 20 | 20 | pub fn write_pkd1(pkd: &mut Packed1) -> u32 { |
| 21 | // CHECK: %{{.*}} = load i32, ptr %{{.*}}, align 1 | |
| 22 | // CHECK: store i32 42, ptr %{{.*}}, align 1 | |
| 21 | // CHECK: %{{.*}} = load i32, ptr %{{.*}}, align 1 | |
| 22 | // CHECK: store i32 42, ptr %{{.*}}, align 1 | |
| 23 | 23 | let result = pkd.data; |
| 24 | 24 | pkd.data = 42; |
| 25 | 25 | result |
| ... | ... | @@ -28,8 +28,8 @@ pub fn write_pkd1(pkd: &mut Packed1) -> u32 { |
| 28 | 28 | // CHECK-LABEL: @write_pkd2 |
| 29 | 29 | #[no_mangle] |
| 30 | 30 | pub fn write_pkd2(pkd: &mut Packed2) -> u32 { |
| 31 | // CHECK: %{{.*}} = load i32, ptr %{{.*}}, align 2 | |
| 32 | // CHECK: store i32 42, ptr %{{.*}}, align 2 | |
| 31 | // CHECK: %{{.*}} = load i32, ptr %{{.*}}, align 2 | |
| 32 | // CHECK: store i32 42, ptr %{{.*}}, align 2 | |
| 33 | 33 | let result = pkd.data; |
| 34 | 34 | pkd.data = 42; |
| 35 | 35 | result |
| ... | ... | @@ -39,21 +39,21 @@ pub struct Array([i32; 8]); |
| 39 | 39 | #[repr(packed)] |
| 40 | 40 | pub struct BigPacked1 { |
| 41 | 41 | dealign: u8, |
| 42 | data: Array | |
| 42 | data: Array, | |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | #[repr(packed(2))] |
| 46 | 46 | pub struct BigPacked2 { |
| 47 | 47 | dealign: u8, |
| 48 | data: Array | |
| 48 | data: Array, | |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | // CHECK-LABEL: @call_pkd1 |
| 52 | 52 | #[no_mangle] |
| 53 | 53 | pub fn call_pkd1(f: fn() -> Array) -> BigPacked1 { |
| 54 | // CHECK: [[ALLOCA:%[_a-z0-9]+]] = alloca [32 x i8] | |
| 55 | // CHECK: call void %{{.*}}(ptr noalias nocapture noundef sret{{.*}} dereferenceable(32) [[ALLOCA]]) | |
| 56 | // CHECK: call void @llvm.memcpy.{{.*}}(ptr align 1 %{{.*}}, ptr align 4 %{{.*}}, i{{[0-9]+}} 32, i1 false) | |
| 54 | // CHECK: [[ALLOCA:%[_a-z0-9]+]] = alloca [32 x i8] | |
| 55 | // CHECK: call void %{{.*}}(ptr noalias nocapture noundef sret{{.*}} dereferenceable(32) [[ALLOCA]]) | |
| 56 | // CHECK: call void @llvm.memcpy.{{.*}}(ptr align 1 %{{.*}}, ptr align 4 %{{.*}}, i{{[0-9]+}} 32, i1 false) | |
| 57 | 57 | // check that calls whose destination is a field of a packed struct |
| 58 | 58 | // go through an alloca rather than calling the function with an |
| 59 | 59 | // unaligned destination. |
| ... | ... | @@ -63,9 +63,9 @@ pub fn call_pkd1(f: fn() -> Array) -> BigPacked1 { |
| 63 | 63 | // CHECK-LABEL: @call_pkd2 |
| 64 | 64 | #[no_mangle] |
| 65 | 65 | pub fn call_pkd2(f: fn() -> Array) -> BigPacked2 { |
| 66 | // CHECK: [[ALLOCA:%[_a-z0-9]+]] = alloca [32 x i8] | |
| 67 | // CHECK: call void %{{.*}}(ptr noalias nocapture noundef sret{{.*}} dereferenceable(32) [[ALLOCA]]) | |
| 68 | // CHECK: call void @llvm.memcpy.{{.*}}(ptr align 2 %{{.*}}, ptr align 4 %{{.*}}, i{{[0-9]+}} 32, i1 false) | |
| 66 | // CHECK: [[ALLOCA:%[_a-z0-9]+]] = alloca [32 x i8] | |
| 67 | // CHECK: call void %{{.*}}(ptr noalias nocapture noundef sret{{.*}} dereferenceable(32) [[ALLOCA]]) | |
| 68 | // CHECK: call void @llvm.memcpy.{{.*}}(ptr align 2 %{{.*}}, ptr align 4 %{{.*}}, i{{[0-9]+}} 32, i1 false) | |
| 69 | 69 | // check that calls whose destination is a field of a packed struct |
| 70 | 70 | // go through an alloca rather than calling the function with an |
| 71 | 71 | // unaligned destination. |
| ... | ... | @@ -119,14 +119,14 @@ pub struct Packed2Pair(u8, u32); |
| 119 | 119 | // CHECK-LABEL: @pkd1_pair |
| 120 | 120 | #[no_mangle] |
| 121 | 121 | pub fn pkd1_pair(pair1: &mut Packed1Pair, pair2: &mut Packed1Pair) { |
| 122 | // CHECK: call void @llvm.memcpy.{{.*}}(ptr align 1 %{{.*}}, ptr align 1 %{{.*}}, i{{[0-9]+}} 5, i1 false) | |
| 122 | // CHECK: call void @llvm.memcpy.{{.*}}(ptr align 1 %{{.*}}, ptr align 1 %{{.*}}, i{{[0-9]+}} 5, i1 false) | |
| 123 | 123 | *pair2 = *pair1; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | // CHECK-LABEL: @pkd2_pair |
| 127 | 127 | #[no_mangle] |
| 128 | 128 | pub fn pkd2_pair(pair1: &mut Packed2Pair, pair2: &mut Packed2Pair) { |
| 129 | // CHECK: call void @llvm.memcpy.{{.*}}(ptr align 2 %{{.*}}, ptr align 2 %{{.*}}, i{{[0-9]+}} 6, i1 false) | |
| 129 | // CHECK: call void @llvm.memcpy.{{.*}}(ptr align 2 %{{.*}}, ptr align 2 %{{.*}}, i{{[0-9]+}} 6, i1 false) | |
| 130 | 130 | *pair2 = *pair1; |
| 131 | 131 | } |
| 132 | 132 | |
| ... | ... | @@ -141,13 +141,13 @@ pub struct Packed2NestedPair((u32, u32)); |
| 141 | 141 | // CHECK-LABEL: @pkd1_nested_pair |
| 142 | 142 | #[no_mangle] |
| 143 | 143 | pub fn pkd1_nested_pair(pair1: &mut Packed1NestedPair, pair2: &mut Packed1NestedPair) { |
| 144 | // CHECK: call void @llvm.memcpy.{{.*}}(ptr align 1 %{{.*}}, ptr align 1 %{{.*}}, i{{[0-9]+}} 8, i1 false) | |
| 144 | // CHECK: call void @llvm.memcpy.{{.*}}(ptr align 1 %{{.*}}, ptr align 1 %{{.*}}, i{{[0-9]+}} 8, i1 false) | |
| 145 | 145 | *pair2 = *pair1; |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | // CHECK-LABEL: @pkd2_nested_pair |
| 149 | 149 | #[no_mangle] |
| 150 | 150 | pub fn pkd2_nested_pair(pair1: &mut Packed2NestedPair, pair2: &mut Packed2NestedPair) { |
| 151 | // CHECK: call void @llvm.memcpy.{{.*}}(ptr align 2 %{{.*}}, ptr align 2 %{{.*}}, i{{[0-9]+}} 8, i1 false) | |
| 151 | // CHECK: call void @llvm.memcpy.{{.*}}(ptr align 2 %{{.*}}, ptr align 2 %{{.*}}, i{{[0-9]+}} 8, i1 false) | |
| 152 | 152 | *pair2 = *pair1; |
| 153 | 153 | } |
tests/codegen/panic-abort-windows.rs+2-4| ... | ... | @@ -8,11 +8,9 @@ |
| 8 | 8 | // CHECK: Function Attrs: nounwind uwtable |
| 9 | 9 | // CHECK-NEXT: define void @normal_uwtable() |
| 10 | 10 | #[no_mangle] |
| 11 | pub fn normal_uwtable() { | |
| 12 | } | |
| 11 | pub fn normal_uwtable() {} | |
| 13 | 12 | |
| 14 | 13 | // CHECK: Function Attrs: nounwind uwtable |
| 15 | 14 | // CHECK-NEXT: define void @extern_uwtable() |
| 16 | 15 | #[no_mangle] |
| 17 | pub extern fn extern_uwtable() { | |
| 18 | } | |
| 16 | pub extern "C" fn extern_uwtable() {} |
tests/codegen/personality_lifetimes.rs+3-5| ... | ... | @@ -3,19 +3,17 @@ |
| 3 | 3 | |
| 4 | 4 | //@ compile-flags: -O -C no-prepopulate-passes |
| 5 | 5 | |
| 6 | #![crate_type="lib"] | |
| 6 | #![crate_type = "lib"] | |
| 7 | 7 | |
| 8 | 8 | struct S; |
| 9 | 9 | |
| 10 | 10 | impl Drop for S { |
| 11 | 11 | #[inline(never)] |
| 12 | fn drop(&mut self) { | |
| 13 | } | |
| 12 | fn drop(&mut self) {} | |
| 14 | 13 | } |
| 15 | 14 | |
| 16 | 15 | #[inline(never)] |
| 17 | fn might_unwind() { | |
| 18 | } | |
| 16 | fn might_unwind() {} | |
| 19 | 17 | |
| 20 | 18 | // CHECK-LABEL: @test |
| 21 | 19 | #[no_mangle] |
tests/codegen/pgo-instrumentation.rs+2-4| ... | ... | @@ -10,12 +10,10 @@ |
| 10 | 10 | // CHECK-DAG: @__profd_{{.*}}pgo_instrumentation{{.*}}some_other_function{{.*}} = {{.*}}global |
| 11 | 11 | // CHECK: @__llvm_profile_filename = {{.*}}"default_%m.profraw\00"{{.*}} |
| 12 | 12 | |
| 13 | #![crate_type="lib"] | |
| 13 | #![crate_type = "lib"] | |
| 14 | 14 | |
| 15 | 15 | #[inline(never)] |
| 16 | fn some_function() { | |
| 17 | ||
| 18 | } | |
| 16 | fn some_function() {} | |
| 19 | 17 | |
| 20 | 18 | pub fn some_other_function() { |
| 21 | 19 | some_function(); |
tests/codegen/pic-relocation-model.rs+4-4| ... | ... | @@ -5,15 +5,15 @@ |
| 5 | 5 | // CHECK: define i8 @call_foreign_fn() |
| 6 | 6 | #[no_mangle] |
| 7 | 7 | pub fn call_foreign_fn() -> u8 { |
| 8 | unsafe { | |
| 9 | foreign_fn() | |
| 10 | } | |
| 8 | unsafe { foreign_fn() } | |
| 11 | 9 | } |
| 12 | 10 | |
| 13 | 11 | // (Allow but do not require `zeroext` here, because it is not worth effort to |
| 14 | 12 | // spell out which targets have it and which ones do not; see rust#97800.) |
| 15 | 13 | |
| 16 | 14 | // CHECK: declare{{( zeroext)?}} i8 @foreign_fn() |
| 17 | extern "C" {fn foreign_fn() -> u8;} | |
| 15 | extern "C" { | |
| 16 | fn foreign_fn() -> u8; | |
| 17 | } | |
| 18 | 18 | |
| 19 | 19 | // CHECK: !{i32 {{[78]}}, !"PIC Level", i32 2} |
tests/codegen/pie-relocation-model.rs+4-4| ... | ... | @@ -8,15 +8,15 @@ |
| 8 | 8 | // CHECK: define dso_local i8 @call_foreign_fn() |
| 9 | 9 | #[no_mangle] |
| 10 | 10 | pub fn call_foreign_fn() -> u8 { |
| 11 | unsafe { | |
| 12 | foreign_fn() | |
| 13 | } | |
| 11 | unsafe { foreign_fn() } | |
| 14 | 12 | } |
| 15 | 13 | |
| 16 | 14 | // External functions are still marked as non-dso_local, since we don't know if the symbol |
| 17 | 15 | // is defined in the binary or in the shared library. |
| 18 | 16 | // CHECK: declare zeroext i8 @foreign_fn() |
| 19 | extern "C" {fn foreign_fn() -> u8;} | |
| 17 | extern "C" { | |
| 18 | fn foreign_fn() -> u8; | |
| 19 | } | |
| 20 | 20 | |
| 21 | 21 | // CHECK: !{i32 {{[78]}}, !"PIC Level", i32 2} |
| 22 | 22 | // CHECK: !{i32 7, !"PIE Level", i32 2} |
tests/codegen/powerpc64le-struct-align-128.rs+18-12| ... | ... | @@ -8,12 +8,12 @@ |
| 8 | 8 | #![crate_type = "lib"] |
| 9 | 9 | #![no_core] |
| 10 | 10 | |
| 11 | #[lang="sized"] | |
| 12 | trait Sized { } | |
| 13 | #[lang="freeze"] | |
| 14 | trait Freeze { } | |
| 15 | #[lang="copy"] | |
| 16 | trait Copy { } | |
| 11 | #[lang = "sized"] | |
| 12 | trait Sized {} | |
| 13 | #[lang = "freeze"] | |
| 14 | trait Freeze {} | |
| 15 | #[lang = "copy"] | |
| 16 | trait Copy {} | |
| 17 | 17 | |
| 18 | 18 | #[repr(C)] |
| 19 | 19 | pub struct Align8 { |
| ... | ... | @@ -23,7 +23,7 @@ pub struct Align8 { |
| 23 | 23 | |
| 24 | 24 | #[repr(transparent)] |
| 25 | 25 | pub struct Transparent8 { |
| 26 | a: Align8 | |
| 26 | a: Align8, | |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | #[repr(C)] |
| ... | ... | @@ -45,7 +45,7 @@ pub struct Align16 { |
| 45 | 45 | |
| 46 | 46 | #[repr(transparent)] |
| 47 | 47 | pub struct Transparent16 { |
| 48 | a: Align16 | |
| 48 | a: Align16, | |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | #[repr(C)] |
| ... | ... | @@ -69,7 +69,7 @@ pub struct Align32 { |
| 69 | 69 | |
| 70 | 70 | #[repr(transparent)] |
| 71 | 71 | pub struct Transparent32 { |
| 72 | a: Align32 | |
| 72 | a: Align32, | |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | #[repr(C)] |
| ... | ... | @@ -83,9 +83,15 @@ extern "C" { |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | pub unsafe fn main( |
| 86 | a1: Align8, a2: Transparent8, a3: Wrapped8, | |
| 87 | b1: Align16, b2: Transparent16, b3: Wrapped16, | |
| 88 | c1: Align32, c2: Transparent32, c3: Wrapped32, | |
| 86 | a1: Align8, | |
| 87 | a2: Transparent8, | |
| 88 | a3: Wrapped8, | |
| 89 | b1: Align16, | |
| 90 | b2: Transparent16, | |
| 91 | b3: Wrapped16, | |
| 92 | c1: Align32, | |
| 93 | c2: Transparent32, | |
| 94 | c3: Wrapped32, | |
| 89 | 95 | ) { |
| 90 | 96 | test_8(a1, a2, a3); |
| 91 | 97 | test_16(b1, b2, b3); |
tests/codegen/precondition-checks.rs+1-3| ... | ... | @@ -21,7 +21,5 @@ use std::ptr::NonNull; |
| 21 | 21 | #[no_mangle] |
| 22 | 22 | pub unsafe fn nonnull_new(ptr: *mut u8) -> NonNull<u8> { |
| 23 | 23 | // CHECK: ; call core::ptr::non_null::NonNull<T>::new_unchecked |
| 24 | unsafe { | |
| 25 | NonNull::new_unchecked(ptr) | |
| 26 | } | |
| 24 | unsafe { NonNull::new_unchecked(ptr) } | |
| 27 | 25 | } |
tests/codegen/refs.rs+4-5| ... | ... | @@ -5,17 +5,16 @@ |
| 5 | 5 | // Hack to get the correct size for the length part in slices |
| 6 | 6 | // CHECK: @helper([[USIZE:i[0-9]+]] %_1) |
| 7 | 7 | #[no_mangle] |
| 8 | pub fn helper(_: usize) { | |
| 9 | } | |
| 8 | pub fn helper(_: usize) {} | |
| 10 | 9 | |
| 11 | 10 | // CHECK-LABEL: @ref_dst |
| 12 | 11 | #[no_mangle] |
| 13 | 12 | pub fn ref_dst(s: &[u8]) { |
| 14 | 13 | // We used to generate an extra alloca and memcpy to ref the dst, so check that we copy |
| 15 | 14 | // directly to the alloca for "x" |
| 16 | // CHECK: store ptr %s.0, {{.*}} %x | |
| 17 | // CHECK: [[X1:%[0-9]+]] = getelementptr inbounds i8, {{.*}} %x, {{i32 4|i64 8}} | |
| 18 | // CHECK: store [[USIZE]] %s.1, {{.*}} [[X1]] | |
| 15 | // CHECK: store ptr %s.0, {{.*}} %x | |
| 16 | // CHECK: [[X1:%[0-9]+]] = getelementptr inbounds i8, {{.*}} %x, {{i32 4|i64 8}} | |
| 17 | // CHECK: store [[USIZE]] %s.1, {{.*}} [[X1]] | |
| 19 | 18 | |
| 20 | 19 | let x = &*s; |
| 21 | 20 | &x; // keep variable in an alloca |
tests/codegen/repr/transparent-imm-array.rs+30-13| ... | ... | @@ -26,15 +26,17 @@ |
| 26 | 26 | #![no_std] |
| 27 | 27 | #![no_core] |
| 28 | 28 | |
| 29 | #[lang="sized"] trait Sized { } | |
| 30 | #[lang="freeze"] trait Freeze { } | |
| 31 | #[lang="copy"] trait Copy { } | |
| 29 | #[lang = "sized"] | |
| 30 | trait Sized {} | |
| 31 | #[lang = "freeze"] | |
| 32 | trait Freeze {} | |
| 33 | #[lang = "copy"] | |
| 34 | trait Copy {} | |
| 32 | 35 | |
| 33 | 36 | impl Copy for [u32; 16] {} |
| 34 | 37 | impl Copy for BigS {} |
| 35 | 38 | impl Copy for BigU {} |
| 36 | 39 | |
| 37 | ||
| 38 | 40 | #[repr(C)] |
| 39 | 41 | pub struct BigS([u32; 16]); |
| 40 | 42 | |
| ... | ... | @@ -53,20 +55,27 @@ pub enum TeBigS { |
| 53 | 55 | |
| 54 | 56 | // CHECK: define void @test_BigS(ptr [[BIGS_RET_ATTRS1:.*]] sret([64 x i8]) [[BIGS_RET_ATTRS2:.*]], [16 x i32] |
| 55 | 57 | #[no_mangle] |
| 56 | pub extern fn test_BigS(_: BigS) -> BigS { loop {} } | |
| 58 | pub extern "C" fn test_BigS(_: BigS) -> BigS { | |
| 59 | loop {} | |
| 60 | } | |
| 57 | 61 | |
| 58 | 62 | // CHECK: define void @test_TsBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], [16 x i32] |
| 59 | 63 | #[no_mangle] |
| 60 | pub extern fn test_TsBigS(_: TsBigS) -> TsBigS { loop {} } | |
| 64 | pub extern "C" fn test_TsBigS(_: TsBigS) -> TsBigS { | |
| 65 | loop {} | |
| 66 | } | |
| 61 | 67 | |
| 62 | 68 | // CHECK: define void @test_TuBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], [16 x i32] |
| 63 | 69 | #[no_mangle] |
| 64 | pub extern fn test_TuBigS(_: TuBigS) -> TuBigS { loop {} } | |
| 70 | pub extern "C" fn test_TuBigS(_: TuBigS) -> TuBigS { | |
| 71 | loop {} | |
| 72 | } | |
| 65 | 73 | |
| 66 | 74 | // CHECK: define void @test_TeBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], [16 x i32] |
| 67 | 75 | #[no_mangle] |
| 68 | pub extern fn test_TeBigS(_: TeBigS) -> TeBigS { loop {} } | |
| 69 | ||
| 76 | pub extern "C" fn test_TeBigS(_: TeBigS) -> TeBigS { | |
| 77 | loop {} | |
| 78 | } | |
| 70 | 79 | |
| 71 | 80 | #[repr(C)] |
| 72 | 81 | pub union BigU { |
| ... | ... | @@ -88,16 +97,24 @@ pub enum TeBigU { |
| 88 | 97 | |
| 89 | 98 | // CHECK: define void @test_BigU(ptr [[BIGU_RET_ATTRS1:.*]] sret([64 x i8]) [[BIGU_RET_ATTRS2:.*]], [16 x i32] |
| 90 | 99 | #[no_mangle] |
| 91 | pub extern fn test_BigU(_: BigU) -> BigU { loop {} } | |
| 100 | pub extern "C" fn test_BigU(_: BigU) -> BigU { | |
| 101 | loop {} | |
| 102 | } | |
| 92 | 103 | |
| 93 | 104 | // CHECK: define void @test_TsBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2]], [16 x i32] |
| 94 | 105 | #[no_mangle] |
| 95 | pub extern fn test_TsBigU(_: TsBigU) -> TsBigU { loop {} } | |
| 106 | pub extern "C" fn test_TsBigU(_: TsBigU) -> TsBigU { | |
| 107 | loop {} | |
| 108 | } | |
| 96 | 109 | |
| 97 | 110 | // CHECK: define void @test_TuBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2]], [16 x i32] |
| 98 | 111 | #[no_mangle] |
| 99 | pub extern fn test_TuBigU(_: TuBigU) -> TuBigU { loop {} } | |
| 112 | pub extern "C" fn test_TuBigU(_: TuBigU) -> TuBigU { | |
| 113 | loop {} | |
| 114 | } | |
| 100 | 115 | |
| 101 | 116 | // CHECK: define void @test_TeBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2]], [16 x i32] |
| 102 | 117 | #[no_mangle] |
| 103 | pub extern fn test_TeBigU(_: TeBigU) -> TeBigU { loop {} } | |
| 118 | pub extern "C" fn test_TeBigU(_: TeBigU) -> TeBigU { | |
| 119 | loop {} | |
| 120 | } |
tests/codegen/repr/transparent-mips64.rs+30-12| ... | ... | @@ -13,9 +13,12 @@ |
| 13 | 13 | #![no_std] |
| 14 | 14 | #![no_core] |
| 15 | 15 | |
| 16 | #[lang="sized"] trait Sized { } | |
| 17 | #[lang="freeze"] trait Freeze { } | |
| 18 | #[lang="copy"] trait Copy { } | |
| 16 | #[lang = "sized"] | |
| 17 | trait Sized {} | |
| 18 | #[lang = "freeze"] | |
| 19 | trait Freeze {} | |
| 20 | #[lang = "copy"] | |
| 21 | trait Copy {} | |
| 19 | 22 | |
| 20 | 23 | impl Copy for [u32; 16] {} |
| 21 | 24 | impl Copy for BigS {} |
| ... | ... | @@ -39,20 +42,27 @@ pub enum TeBigS { |
| 39 | 42 | |
| 40 | 43 | // CHECK: define void @test_BigS(ptr [[BIGS_RET_ATTRS1:.*]] sret([64 x i8]) [[BIGS_RET_ATTRS2:.*]], [8 x i64] |
| 41 | 44 | #[no_mangle] |
| 42 | pub extern fn test_BigS(_: BigS) -> BigS { loop {} } | |
| 45 | pub extern "C" fn test_BigS(_: BigS) -> BigS { | |
| 46 | loop {} | |
| 47 | } | |
| 43 | 48 | |
| 44 | 49 | // CHECK: define void @test_TsBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], [8 x i64] |
| 45 | 50 | #[no_mangle] |
| 46 | pub extern fn test_TsBigS(_: TsBigS) -> TsBigS { loop {} } | |
| 51 | pub extern "C" fn test_TsBigS(_: TsBigS) -> TsBigS { | |
| 52 | loop {} | |
| 53 | } | |
| 47 | 54 | |
| 48 | 55 | // CHECK: define void @test_TuBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], [8 x i64] |
| 49 | 56 | #[no_mangle] |
| 50 | pub extern fn test_TuBigS(_: TuBigS) -> TuBigS { loop {} } | |
| 57 | pub extern "C" fn test_TuBigS(_: TuBigS) -> TuBigS { | |
| 58 | loop {} | |
| 59 | } | |
| 51 | 60 | |
| 52 | 61 | // CHECK: define void @test_TeBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], [8 x i64] |
| 53 | 62 | #[no_mangle] |
| 54 | pub extern fn test_TeBigS(_: TeBigS) -> TeBigS { loop {} } | |
| 55 | ||
| 63 | pub extern "C" fn test_TeBigS(_: TeBigS) -> TeBigS { | |
| 64 | loop {} | |
| 65 | } | |
| 56 | 66 | |
| 57 | 67 | #[repr(C)] |
| 58 | 68 | pub union BigU { |
| ... | ... | @@ -74,16 +84,24 @@ pub enum TeBigU { |
| 74 | 84 | |
| 75 | 85 | // CHECK: define void @test_BigU(ptr [[BIGU_RET_ATTRS1:.*]] sret([64 x i8]) [[BIGU_RET_ATTRS2:.*]], [8 x i64] |
| 76 | 86 | #[no_mangle] |
| 77 | pub extern fn test_BigU(_: BigU) -> BigU { loop {} } | |
| 87 | pub extern "C" fn test_BigU(_: BigU) -> BigU { | |
| 88 | loop {} | |
| 89 | } | |
| 78 | 90 | |
| 79 | 91 | // CHECK: define void @test_TsBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2]], [8 x i64] |
| 80 | 92 | #[no_mangle] |
| 81 | pub extern fn test_TsBigU(_: TsBigU) -> TsBigU { loop {} } | |
| 93 | pub extern "C" fn test_TsBigU(_: TsBigU) -> TsBigU { | |
| 94 | loop {} | |
| 95 | } | |
| 82 | 96 | |
| 83 | 97 | // CHECK: define void @test_TuBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2]], [8 x i64] |
| 84 | 98 | #[no_mangle] |
| 85 | pub extern fn test_TuBigU(_: TuBigU) -> TuBigU { loop {} } | |
| 99 | pub extern "C" fn test_TuBigU(_: TuBigU) -> TuBigU { | |
| 100 | loop {} | |
| 101 | } | |
| 86 | 102 | |
| 87 | 103 | // CHECK: define void @test_TeBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2]], [8 x i64] |
| 88 | 104 | #[no_mangle] |
| 89 | pub extern fn test_TeBigU(_: TeBigU) -> TeBigU { loop {} } | |
| 105 | pub extern "C" fn test_TeBigU(_: TeBigU) -> TeBigU { | |
| 106 | loop {} | |
| 107 | } |
tests/codegen/repr/transparent-sparc64.rs+30-13| ... | ... | @@ -8,15 +8,17 @@ |
| 8 | 8 | #![no_std] |
| 9 | 9 | #![no_core] |
| 10 | 10 | |
| 11 | #[lang="sized"] trait Sized { } | |
| 12 | #[lang="freeze"] trait Freeze { } | |
| 13 | #[lang="copy"] trait Copy { } | |
| 11 | #[lang = "sized"] | |
| 12 | trait Sized {} | |
| 13 | #[lang = "freeze"] | |
| 14 | trait Freeze {} | |
| 15 | #[lang = "copy"] | |
| 16 | trait Copy {} | |
| 14 | 17 | |
| 15 | 18 | impl Copy for [u32; 16] {} |
| 16 | 19 | impl Copy for BigS {} |
| 17 | 20 | impl Copy for BigU {} |
| 18 | 21 | |
| 19 | ||
| 20 | 22 | #[repr(C)] |
| 21 | 23 | pub struct BigS([u32; 16]); |
| 22 | 24 | |
| ... | ... | @@ -37,26 +39,33 @@ pub enum TeBigS { |
| 37 | 39 | // CHECK-NOT: byval |
| 38 | 40 | // CHECK-SAME: %{{[0-9a-z_]+}}) |
| 39 | 41 | #[no_mangle] |
| 40 | pub extern "C" fn test_BigS(_: BigS) -> BigS { loop {} } | |
| 42 | pub extern "C" fn test_BigS(_: BigS) -> BigS { | |
| 43 | loop {} | |
| 44 | } | |
| 41 | 45 | |
| 42 | 46 | // CHECK: define{{.*}}void @test_TsBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], ptr |
| 43 | 47 | // CHECK-NOT: byval |
| 44 | 48 | // CHECK-SAME: %{{[0-9a-z_]+}}) |
| 45 | 49 | #[no_mangle] |
| 46 | pub extern "C" fn test_TsBigS(_: TsBigS) -> TsBigS { loop {} } | |
| 50 | pub extern "C" fn test_TsBigS(_: TsBigS) -> TsBigS { | |
| 51 | loop {} | |
| 52 | } | |
| 47 | 53 | |
| 48 | 54 | // CHECK: define{{.*}}void @test_TuBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], ptr |
| 49 | 55 | // CHECK-NOT: byval |
| 50 | 56 | // CHECK-SAME: %{{[0-9a-z_]+}}) |
| 51 | 57 | #[no_mangle] |
| 52 | pub extern "C" fn test_TuBigS(_: TuBigS) -> TuBigS { loop {} } | |
| 58 | pub extern "C" fn test_TuBigS(_: TuBigS) -> TuBigS { | |
| 59 | loop {} | |
| 60 | } | |
| 53 | 61 | |
| 54 | 62 | // CHECK: define{{.*}}void @test_TeBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], ptr |
| 55 | 63 | // CHECK-NOT: byval |
| 56 | 64 | // CHECK-SAME: %{{[0-9a-z_]+}}) |
| 57 | 65 | #[no_mangle] |
| 58 | pub extern "C" fn test_TeBigS(_: TeBigS) -> TeBigS { loop {} } | |
| 59 | ||
| 66 | pub extern "C" fn test_TeBigS(_: TeBigS) -> TeBigS { | |
| 67 | loop {} | |
| 68 | } | |
| 60 | 69 | |
| 61 | 70 | #[repr(C)] |
| 62 | 71 | pub union BigU { |
| ... | ... | @@ -80,22 +89,30 @@ pub enum TeBigU { |
| 80 | 89 | // CHECK-NOT: byval |
| 81 | 90 | // CHECK-SAME: %{{[0-9a-z_]+}}) |
| 82 | 91 | #[no_mangle] |
| 83 | pub extern "C" fn test_BigU(_: BigU) -> BigU { loop {} } | |
| 92 | pub extern "C" fn test_BigU(_: BigU) -> BigU { | |
| 93 | loop {} | |
| 94 | } | |
| 84 | 95 | |
| 85 | 96 | // CHECK: define{{.*}}void @test_TsBigU(ptr [[BIGU_RET_ATTRS1:.*]] sret([64 x i8]) [[BIGU_RET_ATTRS2:.*]], ptr |
| 86 | 97 | // CHECK-NOT: byval |
| 87 | 98 | // CHECK-SAME: %{{[0-9a-z_]+}}) |
| 88 | 99 | #[no_mangle] |
| 89 | pub extern "C" fn test_TsBigU(_: TsBigU) -> TsBigU { loop {} } | |
| 100 | pub extern "C" fn test_TsBigU(_: TsBigU) -> TsBigU { | |
| 101 | loop {} | |
| 102 | } | |
| 90 | 103 | |
| 91 | 104 | // CHECK: define{{.*}}void @test_TuBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2:.*]], ptr |
| 92 | 105 | // CHECK-NOT: byval |
| 93 | 106 | // CHECK-SAME: %{{[0-9a-z_]+}}) |
| 94 | 107 | #[no_mangle] |
| 95 | pub extern "C" fn test_TuBigU(_: TuBigU) -> TuBigU { loop {} } | |
| 108 | pub extern "C" fn test_TuBigU(_: TuBigU) -> TuBigU { | |
| 109 | loop {} | |
| 110 | } | |
| 96 | 111 | |
| 97 | 112 | // CHECK: define{{.*}}void @test_TeBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2:.*]], ptr |
| 98 | 113 | // CHECK-NOT: byval |
| 99 | 114 | // CHECK-SAME: %{{[0-9a-z_]+}}) |
| 100 | 115 | #[no_mangle] |
| 101 | pub extern "C" fn test_TeBigU(_: TeBigU) -> TeBigU { loop {} } | |
| 116 | pub extern "C" fn test_TeBigU(_: TeBigU) -> TeBigU { | |
| 117 | loop {} | |
| 118 | } |
tests/codegen/repr/transparent-struct-ptr.rs+30-13| ... | ... | @@ -22,15 +22,17 @@ |
| 22 | 22 | #![no_std] |
| 23 | 23 | #![no_core] |
| 24 | 24 | |
| 25 | #[lang="sized"] trait Sized { } | |
| 26 | #[lang="freeze"] trait Freeze { } | |
| 27 | #[lang="copy"] trait Copy { } | |
| 25 | #[lang = "sized"] | |
| 26 | trait Sized {} | |
| 27 | #[lang = "freeze"] | |
| 28 | trait Freeze {} | |
| 29 | #[lang = "copy"] | |
| 30 | trait Copy {} | |
| 28 | 31 | |
| 29 | 32 | impl Copy for [u32; 16] {} |
| 30 | 33 | impl Copy for BigS {} |
| 31 | 34 | impl Copy for BigU {} |
| 32 | 35 | |
| 33 | ||
| 34 | 36 | #[repr(C)] |
| 35 | 37 | pub struct BigS([u32; 16]); |
| 36 | 38 | |
| ... | ... | @@ -49,20 +51,27 @@ pub enum TeBigS { |
| 49 | 51 | |
| 50 | 52 | // 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:.*]]) |
| 51 | 53 | #[no_mangle] |
| 52 | pub extern "C" fn test_BigS(_: BigS) -> BigS { loop {} } | |
| 54 | pub extern "C" fn test_BigS(_: BigS) -> BigS { | |
| 55 | loop {} | |
| 56 | } | |
| 53 | 57 | |
| 54 | 58 | // 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:.*]]) |
| 55 | 59 | #[no_mangle] |
| 56 | pub extern "C" fn test_TsBigS(_: TsBigS) -> TsBigS { loop {} } | |
| 60 | pub extern "C" fn test_TsBigS(_: TsBigS) -> TsBigS { | |
| 61 | loop {} | |
| 62 | } | |
| 57 | 63 | |
| 58 | 64 | // 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:.*]]) |
| 59 | 65 | #[no_mangle] |
| 60 | pub extern "C" fn test_TuBigS(_: TuBigS) -> TuBigS { loop {} } | |
| 66 | pub extern "C" fn test_TuBigS(_: TuBigS) -> TuBigS { | |
| 67 | loop {} | |
| 68 | } | |
| 61 | 69 | |
| 62 | 70 | // 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]]) |
| 63 | 71 | #[no_mangle] |
| 64 | pub extern "C" fn test_TeBigS(_: TeBigS) -> TeBigS { loop {} } | |
| 65 | ||
| 72 | pub extern "C" fn test_TeBigS(_: TeBigS) -> TeBigS { | |
| 73 | loop {} | |
| 74 | } | |
| 66 | 75 | |
| 67 | 76 | #[repr(C)] |
| 68 | 77 | pub union BigU { |
| ... | ... | @@ -84,16 +93,24 @@ pub enum TeBigU { |
| 84 | 93 | |
| 85 | 94 | // 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:.*]]) |
| 86 | 95 | #[no_mangle] |
| 87 | pub extern "C" fn test_BigU(_: BigU) -> BigU { loop {} } | |
| 96 | pub extern "C" fn test_BigU(_: BigU) -> BigU { | |
| 97 | loop {} | |
| 98 | } | |
| 88 | 99 | |
| 89 | 100 | // 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]]) |
| 90 | 101 | #[no_mangle] |
| 91 | pub extern "C" fn test_TsBigU(_: TsBigU) -> TsBigU { loop {} } | |
| 102 | pub extern "C" fn test_TsBigU(_: TsBigU) -> TsBigU { | |
| 103 | loop {} | |
| 104 | } | |
| 92 | 105 | |
| 93 | 106 | // 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]]) |
| 94 | 107 | #[no_mangle] |
| 95 | pub extern "C" fn test_TuBigU(_: TuBigU) -> TuBigU { loop {} } | |
| 108 | pub extern "C" fn test_TuBigU(_: TuBigU) -> TuBigU { | |
| 109 | loop {} | |
| 110 | } | |
| 96 | 111 | |
| 97 | 112 | // 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]]) |
| 98 | 113 | #[no_mangle] |
| 99 | pub extern "C" fn test_TeBigU(_: TeBigU) -> TeBigU { loop {} } | |
| 114 | pub extern "C" fn test_TeBigU(_: TeBigU) -> TeBigU { | |
| 115 | loop {} | |
| 116 | } |
tests/codegen/repr/transparent-sysv64.rs+17-6| ... | ... | @@ -13,19 +13,28 @@ |
| 13 | 13 | #![no_std] |
| 14 | 14 | #![no_core] |
| 15 | 15 | |
| 16 | #[lang="sized"] trait Sized { } | |
| 17 | #[lang="freeze"] trait Freeze { } | |
| 18 | #[lang="copy"] trait Copy { } | |
| 16 | #[lang = "sized"] | |
| 17 | trait Sized {} | |
| 18 | #[lang = "freeze"] | |
| 19 | trait Freeze {} | |
| 20 | #[lang = "copy"] | |
| 21 | trait Copy {} | |
| 19 | 22 | |
| 20 | 23 | #[repr(C)] |
| 21 | pub struct Rgb8 { r: u8, g: u8, b: u8 } | |
| 24 | pub struct Rgb8 { | |
| 25 | r: u8, | |
| 26 | g: u8, | |
| 27 | b: u8, | |
| 28 | } | |
| 22 | 29 | |
| 23 | 30 | #[repr(transparent)] |
| 24 | 31 | pub struct Rgb8Wrap(Rgb8); |
| 25 | 32 | |
| 26 | 33 | // CHECK: i24 @test_Rgb8Wrap(i24{{( %0)?}}) |
| 27 | 34 | #[no_mangle] |
| 28 | pub extern "sysv64" fn test_Rgb8Wrap(_: Rgb8Wrap) -> Rgb8Wrap { loop {} } | |
| 35 | pub extern "sysv64" fn test_Rgb8Wrap(_: Rgb8Wrap) -> Rgb8Wrap { | |
| 36 | loop {} | |
| 37 | } | |
| 29 | 38 | |
| 30 | 39 | #[repr(C)] |
| 31 | 40 | pub union FloatBits { |
| ... | ... | @@ -38,4 +47,6 @@ pub struct SmallUnion(FloatBits); |
| 38 | 47 | |
| 39 | 48 | // CHECK: i32 @test_SmallUnion(i32{{( %0)?}}) |
| 40 | 49 | #[no_mangle] |
| 41 | pub extern "sysv64" fn test_SmallUnion(_: SmallUnion) -> SmallUnion { loop {} } | |
| 50 | pub extern "sysv64" fn test_SmallUnion(_: SmallUnion) -> SmallUnion { | |
| 51 | loop {} | |
| 52 | } |
tests/codegen/repr/transparent.rs+69-25| ... | ... | @@ -8,7 +8,7 @@ |
| 8 | 8 | // For RISCV: see codegen/riscv-abi |
| 9 | 9 | // For LoongArch: see codegen/loongarch-abi |
| 10 | 10 | |
| 11 | #![crate_type="lib"] | |
| 11 | #![crate_type = "lib"] | |
| 12 | 12 | #![feature(repr_simd, transparent_unions)] |
| 13 | 13 | |
| 14 | 14 | use std::marker::PhantomData; |
| ... | ... | @@ -24,83 +24,112 @@ pub struct F32(f32); |
| 24 | 24 | |
| 25 | 25 | // CHECK: define{{.*}}float @test_F32(float noundef %_1) |
| 26 | 26 | #[no_mangle] |
| 27 | pub extern "C" fn test_F32(_: F32) -> F32 { loop {} } | |
| 27 | pub extern "C" fn test_F32(_: F32) -> F32 { | |
| 28 | loop {} | |
| 29 | } | |
| 28 | 30 | |
| 29 | 31 | #[repr(transparent)] |
| 30 | 32 | pub struct Ptr(*mut u8); |
| 31 | 33 | |
| 32 | 34 | // CHECK: define{{.*}}ptr @test_Ptr(ptr noundef %_1) |
| 33 | 35 | #[no_mangle] |
| 34 | pub extern "C" fn test_Ptr(_: Ptr) -> Ptr { loop {} } | |
| 36 | pub extern "C" fn test_Ptr(_: Ptr) -> Ptr { | |
| 37 | loop {} | |
| 38 | } | |
| 35 | 39 | |
| 36 | 40 | #[repr(transparent)] |
| 37 | 41 | pub struct WithZst(u64, Zst1); |
| 38 | 42 | |
| 39 | 43 | // CHECK: define{{.*}}i64 @test_WithZst(i64 noundef %_1) |
| 40 | 44 | #[no_mangle] |
| 41 | pub extern "C" fn test_WithZst(_: WithZst) -> WithZst { loop {} } | |
| 45 | pub extern "C" fn test_WithZst(_: WithZst) -> WithZst { | |
| 46 | loop {} | |
| 47 | } | |
| 42 | 48 | |
| 43 | 49 | #[repr(transparent)] |
| 44 | 50 | pub struct WithZeroSizedArray(*const f32, [i8; 0]); |
| 45 | 51 | |
| 46 | 52 | // CHECK: define{{.*}}ptr @test_WithZeroSizedArray(ptr noundef %_1) |
| 47 | 53 | #[no_mangle] |
| 48 | pub extern "C" fn test_WithZeroSizedArray(_: WithZeroSizedArray) -> WithZeroSizedArray { loop {} } | |
| 54 | pub extern "C" fn test_WithZeroSizedArray(_: WithZeroSizedArray) -> WithZeroSizedArray { | |
| 55 | loop {} | |
| 56 | } | |
| 49 | 57 | |
| 50 | 58 | #[repr(transparent)] |
| 51 | 59 | pub struct Generic<T>(T); |
| 52 | 60 | |
| 53 | 61 | // CHECK: define{{.*}}double @test_Generic(double noundef %_1) |
| 54 | 62 | #[no_mangle] |
| 55 | pub extern "C" fn test_Generic(_: Generic<f64>) -> Generic<f64> { loop {} } | |
| 63 | pub extern "C" fn test_Generic(_: Generic<f64>) -> Generic<f64> { | |
| 64 | loop {} | |
| 65 | } | |
| 56 | 66 | |
| 57 | 67 | #[repr(transparent)] |
| 58 | 68 | pub struct GenericPlusZst<T>(T, Zst2); |
| 59 | 69 | |
| 60 | 70 | #[repr(u8)] |
| 61 | pub enum Bool { True, False, FileNotFound } | |
| 71 | pub enum Bool { | |
| 72 | True, | |
| 73 | False, | |
| 74 | FileNotFound, | |
| 75 | } | |
| 62 | 76 | |
| 63 | 77 | // CHECK: define{{( dso_local)?}} noundef{{( zeroext)?}} i8 @test_Gpz(i8 noundef{{( zeroext)?}} %_1) |
| 64 | 78 | #[no_mangle] |
| 65 | pub extern "C" fn test_Gpz(_: GenericPlusZst<Bool>) -> GenericPlusZst<Bool> { loop {} } | |
| 79 | pub extern "C" fn test_Gpz(_: GenericPlusZst<Bool>) -> GenericPlusZst<Bool> { | |
| 80 | loop {} | |
| 81 | } | |
| 66 | 82 | |
| 67 | 83 | #[repr(transparent)] |
| 68 | 84 | pub struct LifetimePhantom<'a, T: 'a>(*const T, PhantomData<&'a T>); |
| 69 | 85 | |
| 70 | 86 | // CHECK: define{{.*}}ptr @test_LifetimePhantom(ptr noundef %_1) |
| 71 | 87 | #[no_mangle] |
| 72 | pub extern "C" fn test_LifetimePhantom(_: LifetimePhantom<i16>) -> LifetimePhantom<i16> { loop {} } | |
| 88 | pub extern "C" fn test_LifetimePhantom(_: LifetimePhantom<i16>) -> LifetimePhantom<i16> { | |
| 89 | loop {} | |
| 90 | } | |
| 73 | 91 | |
| 74 | 92 | // This works despite current alignment resrictions because PhantomData is always align(1) |
| 75 | 93 | #[repr(transparent)] |
| 76 | pub struct UnitPhantom<T, U> { val: T, unit: PhantomData<U> } | |
| 94 | pub struct UnitPhantom<T, U> { | |
| 95 | val: T, | |
| 96 | unit: PhantomData<U>, | |
| 97 | } | |
| 77 | 98 | |
| 78 | 99 | pub struct Px; |
| 79 | 100 | |
| 80 | 101 | // CHECK: define{{.*}}float @test_UnitPhantom(float noundef %_1) |
| 81 | 102 | #[no_mangle] |
| 82 | pub extern "C" fn test_UnitPhantom(_: UnitPhantom<f32, Px>) -> UnitPhantom<f32, Px> { loop {} } | |
| 103 | pub extern "C" fn test_UnitPhantom(_: UnitPhantom<f32, Px>) -> UnitPhantom<f32, Px> { | |
| 104 | loop {} | |
| 105 | } | |
| 83 | 106 | |
| 84 | 107 | #[repr(transparent)] |
| 85 | 108 | pub struct TwoZsts(Zst1, i8, Zst2); |
| 86 | 109 | |
| 87 | 110 | // CHECK: define{{( dso_local)?}} noundef{{( signext)?}} i8 @test_TwoZsts(i8 noundef{{( signext)?}} %_1) |
| 88 | 111 | #[no_mangle] |
| 89 | pub extern "C" fn test_TwoZsts(_: TwoZsts) -> TwoZsts { loop {} } | |
| 112 | pub extern "C" fn test_TwoZsts(_: TwoZsts) -> TwoZsts { | |
| 113 | loop {} | |
| 114 | } | |
| 90 | 115 | |
| 91 | 116 | #[repr(transparent)] |
| 92 | 117 | pub struct Nested1(Zst2, Generic<f64>); |
| 93 | 118 | |
| 94 | 119 | // CHECK: define{{.*}}double @test_Nested1(double noundef %_1) |
| 95 | 120 | #[no_mangle] |
| 96 | pub extern "C" fn test_Nested1(_: Nested1) -> Nested1 { loop {} } | |
| 121 | pub extern "C" fn test_Nested1(_: Nested1) -> Nested1 { | |
| 122 | loop {} | |
| 123 | } | |
| 97 | 124 | |
| 98 | 125 | #[repr(transparent)] |
| 99 | 126 | pub struct Nested2(Nested1, Zst1); |
| 100 | 127 | |
| 101 | 128 | // CHECK: define{{.*}}double @test_Nested2(double noundef %_1) |
| 102 | 129 | #[no_mangle] |
| 103 | pub extern "C" fn test_Nested2(_: Nested2) -> Nested2 { loop {} } | |
| 130 | pub extern "C" fn test_Nested2(_: Nested2) -> Nested2 { | |
| 131 | loop {} | |
| 132 | } | |
| 104 | 133 | |
| 105 | 134 | #[repr(simd)] |
| 106 | 135 | struct f32x4(f32, f32, f32, f32); |
| ... | ... | @@ -110,35 +139,47 @@ pub struct Vector(f32x4); |
| 110 | 139 | |
| 111 | 140 | // CHECK: define{{.*}}<4 x float> @test_Vector(<4 x float> %_1) |
| 112 | 141 | #[no_mangle] |
| 113 | pub extern "C" fn test_Vector(_: Vector) -> Vector { loop {} } | |
| 142 | pub extern "C" fn test_Vector(_: Vector) -> Vector { | |
| 143 | loop {} | |
| 144 | } | |
| 114 | 145 | |
| 115 | trait Mirror { type It: ?Sized; } | |
| 116 | impl<T: ?Sized> Mirror for T { type It = Self; } | |
| 146 | trait Mirror { | |
| 147 | type It: ?Sized; | |
| 148 | } | |
| 149 | impl<T: ?Sized> Mirror for T { | |
| 150 | type It = Self; | |
| 151 | } | |
| 117 | 152 | |
| 118 | 153 | #[repr(transparent)] |
| 119 | 154 | pub struct StructWithProjection(<f32 as Mirror>::It); |
| 120 | 155 | |
| 121 | 156 | // CHECK: define{{.*}}float @test_Projection(float noundef %_1) |
| 122 | 157 | #[no_mangle] |
| 123 | pub extern "C" fn test_Projection(_: StructWithProjection) -> StructWithProjection { loop {} } | |
| 158 | pub extern "C" fn test_Projection(_: StructWithProjection) -> StructWithProjection { | |
| 159 | loop {} | |
| 160 | } | |
| 124 | 161 | |
| 125 | 162 | #[repr(transparent)] |
| 126 | 163 | pub enum EnumF32 { |
| 127 | Variant(F32) | |
| 164 | Variant(F32), | |
| 128 | 165 | } |
| 129 | 166 | |
| 130 | 167 | // CHECK: define{{.*}}float @test_EnumF32(float noundef %_1) |
| 131 | 168 | #[no_mangle] |
| 132 | pub extern "C" fn test_EnumF32(_: EnumF32) -> EnumF32 { loop {} } | |
| 169 | pub extern "C" fn test_EnumF32(_: EnumF32) -> EnumF32 { | |
| 170 | loop {} | |
| 171 | } | |
| 133 | 172 | |
| 134 | 173 | #[repr(transparent)] |
| 135 | 174 | pub enum EnumF32WithZsts { |
| 136 | Variant(Zst1, F32, Zst2) | |
| 175 | Variant(Zst1, F32, Zst2), | |
| 137 | 176 | } |
| 138 | 177 | |
| 139 | 178 | // CHECK: define{{.*}}float @test_EnumF32WithZsts(float noundef %_1) |
| 140 | 179 | #[no_mangle] |
| 141 | pub extern "C" fn test_EnumF32WithZsts(_: EnumF32WithZsts) -> EnumF32WithZsts { loop {} } | |
| 180 | pub extern "C" fn test_EnumF32WithZsts(_: EnumF32WithZsts) -> EnumF32WithZsts { | |
| 181 | loop {} | |
| 182 | } | |
| 142 | 183 | |
| 143 | 184 | #[repr(transparent)] |
| 144 | 185 | pub union UnionF32 { |
| ... | ... | @@ -147,7 +188,9 @@ pub union UnionF32 { |
| 147 | 188 | |
| 148 | 189 | // CHECK: define{{.*}} float @test_UnionF32(float %_1) |
| 149 | 190 | #[no_mangle] |
| 150 | pub extern "C" fn test_UnionF32(_: UnionF32) -> UnionF32 { loop {} } | |
| 191 | pub extern "C" fn test_UnionF32(_: UnionF32) -> UnionF32 { | |
| 192 | loop {} | |
| 193 | } | |
| 151 | 194 | |
| 152 | 195 | #[repr(transparent)] |
| 153 | 196 | pub union UnionF32WithZsts { |
| ... | ... | @@ -158,8 +201,9 @@ pub union UnionF32WithZsts { |
| 158 | 201 | |
| 159 | 202 | // CHECK: define{{.*}}float @test_UnionF32WithZsts(float %_1) |
| 160 | 203 | #[no_mangle] |
| 161 | pub extern "C" fn test_UnionF32WithZsts(_: UnionF32WithZsts) -> UnionF32WithZsts { loop {} } | |
| 162 | ||
| 204 | pub extern "C" fn test_UnionF32WithZsts(_: UnionF32WithZsts) -> UnionF32WithZsts { | |
| 205 | loop {} | |
| 206 | } | |
| 163 | 207 | |
| 164 | 208 | // All that remains to be tested are aggregates. They are tested in separate files called |
| 165 | 209 | // transparent-*.rs with `only-*` or `ignore-*` directives, because the expected LLVM IR |
tests/codegen/riscv-abi/riscv64-lp64-lp64f-lp64d-abi.rs+4-8| ... | ... | @@ -83,8 +83,7 @@ pub struct Tiny { |
| 83 | 83 | |
| 84 | 84 | // CHECK: define void @f_agg_tiny(i64 %0) |
| 85 | 85 | #[no_mangle] |
| 86 | pub extern "C" fn f_agg_tiny(mut e: Tiny) { | |
| 87 | } | |
| 86 | pub extern "C" fn f_agg_tiny(mut e: Tiny) {} | |
| 88 | 87 | |
| 89 | 88 | // CHECK: define i64 @f_agg_tiny_ret() |
| 90 | 89 | #[no_mangle] |
| ... | ... | @@ -100,8 +99,7 @@ pub struct Small { |
| 100 | 99 | |
| 101 | 100 | // CHECK: define void @f_agg_small([2 x i64] %0) |
| 102 | 101 | #[no_mangle] |
| 103 | pub extern "C" fn f_agg_small(mut x: Small) { | |
| 104 | } | |
| 102 | pub extern "C" fn f_agg_small(mut x: Small) {} | |
| 105 | 103 | |
| 106 | 104 | // CHECK: define [2 x i64] @f_agg_small_ret() |
| 107 | 105 | #[no_mangle] |
| ... | ... | @@ -116,8 +114,7 @@ pub struct SmallAligned { |
| 116 | 114 | |
| 117 | 115 | // CHECK: define void @f_agg_small_aligned(i128 %0) |
| 118 | 116 | #[no_mangle] |
| 119 | pub extern "C" fn f_agg_small_aligned(mut x: SmallAligned) { | |
| 120 | } | |
| 117 | pub extern "C" fn f_agg_small_aligned(mut x: SmallAligned) {} | |
| 121 | 118 | |
| 122 | 119 | #[repr(C)] |
| 123 | 120 | pub struct Large { |
| ... | ... | @@ -129,8 +126,7 @@ pub struct Large { |
| 129 | 126 | |
| 130 | 127 | // CHECK: define void @f_agg_large(ptr {{.*}}%x) |
| 131 | 128 | #[no_mangle] |
| 132 | pub extern "C" fn f_agg_large(mut x: Large) { | |
| 133 | } | |
| 129 | pub extern "C" fn f_agg_large(mut x: Large) {} | |
| 134 | 130 | |
| 135 | 131 | // CHECK: define void @f_agg_large_ret(ptr {{.*}}sret{{.*}}, i32 noundef signext %i, i8 noundef signext %j) |
| 136 | 132 | #[no_mangle] |
tests/codegen/sanitizer/address-sanitizer-globals-tracking.rs+1-1| ... | ... | @@ -23,7 +23,7 @@ |
| 23 | 23 | //@[ASAN] compile-flags: |
| 24 | 24 | //@[ASAN-FAT-LTO] compile-flags: -Cprefer-dynamic=false -Clto=fat |
| 25 | 25 | |
| 26 | #![crate_type="staticlib"] | |
| 26 | #![crate_type = "staticlib"] | |
| 27 | 27 | |
| 28 | 28 | // The test below mimics `CACHED_POW10` from `library/core/src/num/flt2dec/strategy/grisu.rs` which |
| 29 | 29 | // (because of incorrect handling of `___asan_globals_registered` during LTO) was incorrectly |
tests/codegen/sanitizer/cfi/add-canonical-jump-tables-flag.rs+2-3| ... | ... | @@ -3,9 +3,8 @@ |
| 3 | 3 | //@ needs-sanitizer-cfi |
| 4 | 4 | //@ compile-flags: -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi |
| 5 | 5 | |
| 6 | #![crate_type="lib"] | |
| 6 | #![crate_type = "lib"] | |
| 7 | 7 | |
| 8 | pub fn foo() { | |
| 9 | } | |
| 8 | pub fn foo() {} | |
| 10 | 9 | |
| 11 | 10 | // CHECK: !{{[0-9]+}} = !{i32 4, !"CFI Canonical Jump Tables", i32 1} |
tests/codegen/sanitizer/cfi/add-enable-split-lto-unit-flag.rs+2-3| ... | ... | @@ -3,9 +3,8 @@ |
| 3 | 3 | //@ needs-sanitizer-cfi |
| 4 | 4 | //@ compile-flags: -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi |
| 5 | 5 | |
| 6 | #![crate_type="lib"] | |
| 6 | #![crate_type = "lib"] | |
| 7 | 7 | |
| 8 | pub fn foo() { | |
| 9 | } | |
| 8 | pub fn foo() {} | |
| 10 | 9 | |
| 11 | 10 | // CHECK: !{{[0-9]+}} = !{i32 4, !"EnableSplitLTOUnit", i32 1} |
tests/codegen/sanitizer/cfi/emit-type-checks-attr-no-sanitize.rs+1-1| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | //@ needs-sanitizer-cfi |
| 4 | 4 | //@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0 |
| 5 | 5 | |
| 6 | #![crate_type="lib"] | |
| 6 | #![crate_type = "lib"] | |
| 7 | 7 | #![feature(no_sanitize)] |
| 8 | 8 | |
| 9 | 9 | #[no_sanitize(cfi)] |
tests/codegen/sanitizer/cfi/emit-type-checks.rs+1-1| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | //@ needs-sanitizer-cfi |
| 4 | 4 | //@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0 |
| 5 | 5 | |
| 6 | #![crate_type="lib"] | |
| 6 | #![crate_type = "lib"] | |
| 7 | 7 | |
| 8 | 8 | pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { |
| 9 | 9 | // CHECK-LABEL: define{{.*}}foo{{.*}}!type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
tests/codegen/sanitizer/cfi/emit-type-metadata-attr-cfi-encoding.rs+17-17| ... | ... | @@ -3,13 +3,13 @@ |
| 3 | 3 | //@ needs-sanitizer-cfi |
| 4 | 4 | //@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0 |
| 5 | 5 | |
| 6 | #![crate_type="lib"] | |
| 6 | #![crate_type = "lib"] | |
| 7 | 7 | #![feature(cfi_encoding, extern_types)] |
| 8 | 8 | |
| 9 | 9 | #[cfi_encoding = "3Foo"] |
| 10 | 10 | pub struct Type1(i32); |
| 11 | 11 | |
| 12 | extern { | |
| 12 | extern "C" { | |
| 13 | 13 | #[cfi_encoding = "3Bar"] |
| 14 | 14 | type Type2; |
| 15 | 15 | } |
| ... | ... | @@ -25,35 +25,35 @@ pub struct Type4(i32); |
| 25 | 25 | #[repr(transparent)] |
| 26 | 26 | pub struct Type5(u32); |
| 27 | 27 | |
| 28 | pub fn foo0(_: Type1) { } | |
| 28 | pub fn foo0(_: Type1) {} | |
| 29 | 29 | // CHECK: define{{.*}}foo0{{.*}}!type ![[TYPE0:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 30 | pub fn foo1(_: Type1, _: Type1) { } | |
| 30 | pub fn foo1(_: Type1, _: Type1) {} | |
| 31 | 31 | // CHECK: define{{.*}}foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 32 | pub fn foo2(_: Type1, _: Type1, _: Type1) { } | |
| 32 | pub fn foo2(_: Type1, _: Type1, _: Type1) {} | |
| 33 | 33 | // CHECK: define{{.*}}foo2{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 34 | pub fn foo3(_: *mut Type2) { } | |
| 34 | pub fn foo3(_: *mut Type2) {} | |
| 35 | 35 | // CHECK: define{{.*}}foo3{{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 36 | pub fn foo4(_: *mut Type2, _: *mut Type2) { } | |
| 36 | pub fn foo4(_: *mut Type2, _: *mut Type2) {} | |
| 37 | 37 | // CHECK: define{{.*}}foo4{{.*}}!type ![[TYPE4:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 38 | pub fn foo5(_: *mut Type2, _: *mut Type2, _: *mut Type2) { } | |
| 38 | pub fn foo5(_: *mut Type2, _: *mut Type2, _: *mut Type2) {} | |
| 39 | 39 | // CHECK: define{{.*}}foo5{{.*}}!type ![[TYPE5:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 40 | pub fn foo6(_: *mut Type3) { } | |
| 40 | pub fn foo6(_: *mut Type3) {} | |
| 41 | 41 | // CHECK: define{{.*}}foo6{{.*}}!type ![[TYPE6:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 42 | pub fn foo7(_: *mut Type3, _: *mut Type3) { } | |
| 42 | pub fn foo7(_: *mut Type3, _: *mut Type3) {} | |
| 43 | 43 | // CHECK: define{{.*}}foo7{{.*}}!type ![[TYPE7:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 44 | pub fn foo8(_: *mut Type3, _: *mut Type3, _: *mut Type3) { } | |
| 44 | pub fn foo8(_: *mut Type3, _: *mut Type3, _: *mut Type3) {} | |
| 45 | 45 | // CHECK: define{{.*}}foo8{{.*}}!type ![[TYPE8:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 46 | pub fn foo9(_: Type4) { } | |
| 46 | pub fn foo9(_: Type4) {} | |
| 47 | 47 | // CHECK: define{{.*}}foo9{{.*}}!type ![[TYPE9:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 48 | pub fn foo10(_: Type4, _: Type4) { } | |
| 48 | pub fn foo10(_: Type4, _: Type4) {} | |
| 49 | 49 | // CHECK: define{{.*}}foo10{{.*}}!type ![[TYPE10:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 50 | pub fn foo11(_: Type4, _: Type4, _: Type4) { } | |
| 50 | pub fn foo11(_: Type4, _: Type4, _: Type4) {} | |
| 51 | 51 | // CHECK: define{{.*}}foo11{{.*}}!type ![[TYPE11:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 52 | pub fn foo12(_: Type5) { } | |
| 52 | pub fn foo12(_: Type5) {} | |
| 53 | 53 | // CHECK: define{{.*}}foo12{{.*}}!type ![[TYPE12:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 54 | pub fn foo13(_: Type5, _: Type5) { } | |
| 54 | pub fn foo13(_: Type5, _: Type5) {} | |
| 55 | 55 | // CHECK: define{{.*}}foo13{{.*}}!type ![[TYPE13:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 56 | pub fn foo14(_: Type5, _: Type5, _: Type5) { } | |
| 56 | pub fn foo14(_: Type5, _: Type5, _: Type5) {} | |
| 57 | 57 | // CHECK: define{{.*}}foo14{{.*}}!type ![[TYPE14:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 58 | 58 | |
| 59 | 59 | // CHECK: ![[TYPE0]] = !{i64 0, !"_ZTSFv3FooE"} |
tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-const-generics.rs+6-5| ... | ... | @@ -4,25 +4,26 @@ |
| 4 | 4 | //@ needs-sanitizer-cfi |
| 5 | 5 | //@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0 |
| 6 | 6 | |
| 7 | #![crate_type="lib"] | |
| 7 | #![crate_type = "lib"] | |
| 8 | 8 | #![feature(type_alias_impl_trait)] |
| 9 | 9 | |
| 10 | 10 | extern crate core; |
| 11 | 11 | |
| 12 | 12 | pub type Type1 = impl Send; |
| 13 | 13 | |
| 14 | pub fn foo() where | |
| 14 | pub fn foo() | |
| 15 | where | |
| 15 | 16 | Type1: 'static, |
| 16 | 17 | { |
| 17 | 18 | pub struct Foo<T, const N: usize>([T; N]); |
| 18 | 19 | let _: Type1 = Foo([0; 32]); |
| 19 | 20 | } |
| 20 | 21 | |
| 21 | pub fn foo1(_: Type1) { } | |
| 22 | pub fn foo1(_: Type1) {} | |
| 22 | 23 | // CHECK: define{{.*}}4foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 23 | pub fn foo2(_: Type1, _: Type1) { } | |
| 24 | pub fn foo2(_: Type1, _: Type1) {} | |
| 24 | 25 | // CHECK: define{{.*}}4foo2{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 25 | pub fn foo3(_: Type1, _: Type1, _: Type1) { } | |
| 26 | pub fn foo3(_: Type1, _: Type1, _: Type1) {} | |
| 26 | 27 | // CHECK: define{{.*}}4foo3{{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 27 | 28 | |
| 28 | 29 | // CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo3FooIu3i32Lu5usize32EEE"} |
tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-drop-in-place.rs+1-1| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | //@ needs-sanitizer-cfi |
| 4 | 4 | //@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static |
| 5 | 5 | |
| 6 | #![crate_type="lib"] | |
| 6 | #![crate_type = "lib"] | |
| 7 | 7 | |
| 8 | 8 | // CHECK-LABEL: define{{.*}}4core3ptr47drop_in_place$LT$dyn$u20$core..marker..Send$GT$ |
| 9 | 9 | // CHECK-SAME: {{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-function-types.rs+12-12| ... | ... | @@ -4,29 +4,29 @@ |
| 4 | 4 | //@ needs-sanitizer-cfi |
| 5 | 5 | //@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static |
| 6 | 6 | |
| 7 | #![crate_type="lib"] | |
| 7 | #![crate_type = "lib"] | |
| 8 | 8 | |
| 9 | pub fn foo1(_: fn(i32) -> i32) { } | |
| 9 | pub fn foo1(_: fn(i32) -> i32) {} | |
| 10 | 10 | // CHECK: define{{.*}}4foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 11 | pub fn foo2(_: fn(i32) -> i32, _: fn(i32) -> i32) { } | |
| 11 | pub fn foo2(_: fn(i32) -> i32, _: fn(i32) -> i32) {} | |
| 12 | 12 | // CHECK: define{{.*}}4foo2{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 13 | pub fn foo3(_: fn(i32) -> i32, _: fn(i32) -> i32, _: fn(i32) -> i32) { } | |
| 13 | pub fn foo3(_: fn(i32) -> i32, _: fn(i32) -> i32, _: fn(i32) -> i32) {} | |
| 14 | 14 | // CHECK: define{{.*}}4foo3{{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 15 | pub fn foo4(_: &dyn Fn(i32) -> i32) { } | |
| 15 | pub fn foo4(_: &dyn Fn(i32) -> i32) {} | |
| 16 | 16 | // CHECK: define{{.*}}4foo4{{.*}}!type ![[TYPE4:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 17 | pub fn foo5(_: &dyn Fn(i32) -> i32, _: &dyn Fn(i32) -> i32) { } | |
| 17 | pub fn foo5(_: &dyn Fn(i32) -> i32, _: &dyn Fn(i32) -> i32) {} | |
| 18 | 18 | // CHECK: define{{.*}}4foo5{{.*}}!type ![[TYPE5:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 19 | pub fn foo6(_: &dyn Fn(i32) -> i32, _: &dyn Fn(i32) -> i32, _: &dyn Fn(i32) -> i32) { } | |
| 19 | pub fn foo6(_: &dyn Fn(i32) -> i32, _: &dyn Fn(i32) -> i32, _: &dyn Fn(i32) -> i32) {} | |
| 20 | 20 | // CHECK: define{{.*}}4foo6{{.*}}!type ![[TYPE6:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 21 | pub fn foo7(_: &dyn FnMut(i32) -> i32) { } | |
| 21 | pub fn foo7(_: &dyn FnMut(i32) -> i32) {} | |
| 22 | 22 | // CHECK: define{{.*}}4foo7{{.*}}!type ![[TYPE7:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 23 | pub fn foo8(_: &dyn FnMut(i32) -> i32, _: &dyn FnMut(i32) -> i32) { } | |
| 23 | pub fn foo8(_: &dyn FnMut(i32) -> i32, _: &dyn FnMut(i32) -> i32) {} | |
| 24 | 24 | // CHECK: define{{.*}}4foo8{{.*}}!type ![[TYPE8:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 25 | pub fn foo9(_: &dyn FnMut(i32) -> i32, _: &dyn FnMut(i32) -> i32, _: &dyn FnMut(i32) -> i32) { } | |
| 25 | pub fn foo9(_: &dyn FnMut(i32) -> i32, _: &dyn FnMut(i32) -> i32, _: &dyn FnMut(i32) -> i32) {} | |
| 26 | 26 | // CHECK: define{{.*}}4foo9{{.*}}!type ![[TYPE9:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 27 | pub fn foo10(_: &dyn FnOnce(i32) -> i32) { } | |
| 27 | pub fn foo10(_: &dyn FnOnce(i32) -> i32) {} | |
| 28 | 28 | // CHECK: define{{.*}}5foo10{{.*}}!type ![[TYPE10:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 29 | pub fn foo11(_: &dyn FnOnce(i32) -> i32, _: &dyn FnOnce(i32) -> i32) { } | |
| 29 | pub fn foo11(_: &dyn FnOnce(i32) -> i32, _: &dyn FnOnce(i32) -> i32) {} | |
| 30 | 30 | // CHECK: define{{.*}}5foo11{{.*}}!type ![[TYPE11:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 31 | 31 | pub fn foo12(_: &dyn FnOnce(i32) -> i32, _: &dyn FnOnce(i32) -> i32, _: &dyn FnOnce(i32) -> i32) {} |
| 32 | 32 | // CHECK: define{{.*}}5foo12{{.*}}!type ![[TYPE12:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-lifetimes.rs+6-5| ... | ... | @@ -4,14 +4,15 @@ |
| 4 | 4 | //@ needs-sanitizer-cfi |
| 5 | 5 | //@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0 |
| 6 | 6 | |
| 7 | #![crate_type="lib"] | |
| 7 | #![crate_type = "lib"] | |
| 8 | 8 | #![feature(type_alias_impl_trait)] |
| 9 | 9 | |
| 10 | 10 | extern crate core; |
| 11 | 11 | |
| 12 | 12 | pub type Type1 = impl Send; |
| 13 | 13 | |
| 14 | pub fn foo<'a>() where | |
| 14 | pub fn foo<'a>() | |
| 15 | where | |
| 15 | 16 | Type1: 'static, |
| 16 | 17 | { |
| 17 | 18 | pub struct Foo<'a>(&'a i32); |
| ... | ... | @@ -19,9 +20,9 @@ pub fn foo<'a>() where |
| 19 | 20 | let _: Type1 = Bar; |
| 20 | 21 | } |
| 21 | 22 | |
| 22 | pub fn foo1(_: Type1) { } | |
| 23 | pub fn foo1(_: Type1) {} | |
| 23 | 24 | // CHECK: define{{.*}}4foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 24 | pub fn foo2(_: Type1, _: Type1) { } | |
| 25 | pub fn foo2(_: Type1, _: Type1) {} | |
| 25 | 26 | // CHECK: define{{.*}}4foo2{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 26 | pub fn foo3(_: Type1, _: Type1, _: Type1) { } | |
| 27 | pub fn foo3(_: Type1, _: Type1, _: Type1) {} | |
| 27 | 28 | // CHECK: define{{.*}}4foo3{{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-method-secondary-typeid.rs+1-2| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | //@ needs-sanitizer-cfi |
| 5 | 5 | //@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static |
| 6 | 6 | |
| 7 | #![crate_type="lib"] | |
| 7 | #![crate_type = "lib"] | |
| 8 | 8 | |
| 9 | 9 | trait Trait1 { |
| 10 | 10 | fn foo(&self); |
| ... | ... | @@ -17,6 +17,5 @@ impl Trait1 for Type1 { |
| 17 | 17 | // CHECK: define{{.*}}3foo{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | ||
| 21 | 20 | // CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}6Trait1u6regionEEE"} |
| 22 | 21 | // CHECK: ![[TYPE2]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}5Type1EE"} |
tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-pointer-types.rs+16-16| ... | ... | @@ -4,37 +4,37 @@ |
| 4 | 4 | //@ needs-sanitizer-cfi |
| 5 | 5 | //@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static |
| 6 | 6 | |
| 7 | #![crate_type="lib"] | |
| 7 | #![crate_type = "lib"] | |
| 8 | 8 | |
| 9 | pub fn foo1(_: &mut i32) { } | |
| 9 | pub fn foo1(_: &mut i32) {} | |
| 10 | 10 | // CHECK: define{{.*}}4foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 11 | pub fn foo2(_: &mut i32, _: &i32) { } | |
| 11 | pub fn foo2(_: &mut i32, _: &i32) {} | |
| 12 | 12 | // CHECK: define{{.*}}4foo2{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 13 | pub fn foo3(_: &mut i32, _: &i32, _: &i32) { } | |
| 13 | pub fn foo3(_: &mut i32, _: &i32, _: &i32) {} | |
| 14 | 14 | // CHECK: define{{.*}}4foo3{{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 15 | pub fn foo4(_: &i32) { } | |
| 15 | pub fn foo4(_: &i32) {} | |
| 16 | 16 | // CHECK: define{{.*}}4foo4{{.*}}!type ![[TYPE4:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 17 | pub fn foo5(_: &i32, _: &mut i32) { } | |
| 17 | pub fn foo5(_: &i32, _: &mut i32) {} | |
| 18 | 18 | // CHECK: define{{.*}}4foo5{{.*}}!type ![[TYPE5:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 19 | pub fn foo6(_: &i32, _: &mut i32, _: &mut i32) { } | |
| 19 | pub fn foo6(_: &i32, _: &mut i32, _: &mut i32) {} | |
| 20 | 20 | // CHECK: define{{.*}}4foo6{{.*}}!type ![[TYPE6:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 21 | pub fn foo7(_: *mut i32) { } | |
| 21 | pub fn foo7(_: *mut i32) {} | |
| 22 | 22 | // CHECK: define{{.*}}4foo7{{.*}}!type ![[TYPE7:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 23 | pub fn foo8(_: *mut i32, _: *const i32) { } | |
| 23 | pub fn foo8(_: *mut i32, _: *const i32) {} | |
| 24 | 24 | // CHECK: define{{.*}}4foo8{{.*}}!type ![[TYPE8:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 25 | pub fn foo9(_: *mut i32, _: *const i32, _: *const i32) { } | |
| 25 | pub fn foo9(_: *mut i32, _: *const i32, _: *const i32) {} | |
| 26 | 26 | // CHECK: define{{.*}}4foo9{{.*}}!type ![[TYPE9:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 27 | pub fn foo10(_: *const i32) { } | |
| 27 | pub fn foo10(_: *const i32) {} | |
| 28 | 28 | // CHECK: define{{.*}}5foo10{{.*}}!type ![[TYPE10:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 29 | pub fn foo11(_: *const i32, _: *mut i32) { } | |
| 29 | pub fn foo11(_: *const i32, _: *mut i32) {} | |
| 30 | 30 | // CHECK: define{{.*}}5foo11{{.*}}!type ![[TYPE11:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 31 | pub fn foo12(_: *const i32, _: *mut i32, _: *mut i32) { } | |
| 31 | pub fn foo12(_: *const i32, _: *mut i32, _: *mut i32) {} | |
| 32 | 32 | // CHECK: define{{.*}}5foo12{{.*}}!type ![[TYPE12:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 33 | pub fn foo13(_: fn(i32) -> i32) { } | |
| 33 | pub fn foo13(_: fn(i32) -> i32) {} | |
| 34 | 34 | // CHECK: define{{.*}}5foo13{{.*}}!type ![[TYPE13:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 35 | pub fn foo14(_: fn(i32) -> i32, _: fn(i32) -> i32) { } | |
| 35 | pub fn foo14(_: fn(i32) -> i32, _: fn(i32) -> i32) {} | |
| 36 | 36 | // CHECK: define{{.*}}5foo14{{.*}}!type ![[TYPE14:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 37 | pub fn foo15(_: fn(i32) -> i32, _: fn(i32) -> i32, _: fn(i32) -> i32) { } | |
| 37 | pub fn foo15(_: fn(i32) -> i32, _: fn(i32) -> i32, _: fn(i32) -> i32) {} | |
| 38 | 38 | // CHECK: define{{.*}}5foo15{{.*}}!type ![[TYPE15:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 39 | 39 | |
| 40 | 40 | // CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFvU3mutu3refIu3i32EE"} |
tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-primitive-types.rs+61-61| ... | ... | @@ -4,130 +4,130 @@ |
| 4 | 4 | //@ needs-sanitizer-cfi |
| 5 | 5 | //@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static |
| 6 | 6 | |
| 7 | #![crate_type="lib"] | |
| 7 | #![crate_type = "lib"] | |
| 8 | 8 | |
| 9 | 9 | extern crate core; |
| 10 | 10 | use core::ffi::*; |
| 11 | 11 | |
| 12 | pub fn foo1(_: ()) { } | |
| 12 | pub fn foo1(_: ()) {} | |
| 13 | 13 | // CHECK: define{{.*}}4foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 14 | pub fn foo2(_: (), _: c_void) { } | |
| 14 | pub fn foo2(_: (), _: c_void) {} | |
| 15 | 15 | // CHECK: define{{.*}}4foo2{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 16 | pub fn foo3(_: (), _: c_void, _: c_void) { } | |
| 16 | pub fn foo3(_: (), _: c_void, _: c_void) {} | |
| 17 | 17 | // CHECK: define{{.*}}4foo3{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 18 | pub fn foo4(_: *mut ()) { } | |
| 18 | pub fn foo4(_: *mut ()) {} | |
| 19 | 19 | // CHECK: define{{.*}}4foo4{{.*}}!type ![[TYPE4:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 20 | pub fn foo5(_: *mut (), _: *mut c_void) { } | |
| 20 | pub fn foo5(_: *mut (), _: *mut c_void) {} | |
| 21 | 21 | // CHECK: define{{.*}}4foo5{{.*}}!type ![[TYPE5:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 22 | pub fn foo6(_: *mut (), _: *mut c_void, _: *mut c_void) { } | |
| 22 | pub fn foo6(_: *mut (), _: *mut c_void, _: *mut c_void) {} | |
| 23 | 23 | // CHECK: define{{.*}}4foo6{{.*}}!type ![[TYPE6:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 24 | pub fn foo7(_: *const ()) { } | |
| 24 | pub fn foo7(_: *const ()) {} | |
| 25 | 25 | // CHECK: define{{.*}}4foo7{{.*}}!type ![[TYPE7:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 26 | pub fn foo8(_: *const (), _: *const c_void) { } | |
| 26 | pub fn foo8(_: *const (), _: *const c_void) {} | |
| 27 | 27 | // CHECK: define{{.*}}4foo8{{.*}}!type ![[TYPE8:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 28 | pub fn foo9(_: *const (), _: *const c_void, _: *const c_void) { } | |
| 28 | pub fn foo9(_: *const (), _: *const c_void, _: *const c_void) {} | |
| 29 | 29 | // CHECK: define{{.*}}4foo9{{.*}}!type ![[TYPE9:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 30 | pub fn foo10(_: bool) { } | |
| 30 | pub fn foo10(_: bool) {} | |
| 31 | 31 | // CHECK: define{{.*}}5foo10{{.*}}!type ![[TYPE10:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 32 | pub fn foo11(_: bool, _: bool) { } | |
| 32 | pub fn foo11(_: bool, _: bool) {} | |
| 33 | 33 | // CHECK: define{{.*}}5foo11{{.*}}!type ![[TYPE11:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 34 | pub fn foo12(_: bool, _: bool, _: bool) { } | |
| 34 | pub fn foo12(_: bool, _: bool, _: bool) {} | |
| 35 | 35 | // CHECK: define{{.*}}5foo12{{.*}}!type ![[TYPE12:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 36 | pub fn foo13(_: i8) { } | |
| 36 | pub fn foo13(_: i8) {} | |
| 37 | 37 | // CHECK: define{{.*}}5foo13{{.*}}!type ![[TYPE13:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 38 | pub fn foo14(_: i8, _: i8) { } | |
| 38 | pub fn foo14(_: i8, _: i8) {} | |
| 39 | 39 | // CHECK: define{{.*}}5foo14{{.*}}!type ![[TYPE14:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 40 | pub fn foo15(_: i8, _: i8, _: i8) { } | |
| 40 | pub fn foo15(_: i8, _: i8, _: i8) {} | |
| 41 | 41 | // CHECK: define{{.*}}5foo15{{.*}}!type ![[TYPE15:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 42 | pub fn foo16(_: i16) { } | |
| 42 | pub fn foo16(_: i16) {} | |
| 43 | 43 | // CHECK: define{{.*}}5foo16{{.*}}!type ![[TYPE16:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 44 | pub fn foo17(_: i16, _: i16) { } | |
| 44 | pub fn foo17(_: i16, _: i16) {} | |
| 45 | 45 | // CHECK: define{{.*}}5foo17{{.*}}!type ![[TYPE17:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 46 | pub fn foo18(_: i16, _: i16, _: i16) { } | |
| 46 | pub fn foo18(_: i16, _: i16, _: i16) {} | |
| 47 | 47 | // CHECK: define{{.*}}5foo18{{.*}}!type ![[TYPE18:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 48 | pub fn foo19(_: i32) { } | |
| 48 | pub fn foo19(_: i32) {} | |
| 49 | 49 | // CHECK: define{{.*}}5foo19{{.*}}!type ![[TYPE19:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 50 | pub fn foo20(_: i32, _: i32) { } | |
| 50 | pub fn foo20(_: i32, _: i32) {} | |
| 51 | 51 | // CHECK: define{{.*}}5foo20{{.*}}!type ![[TYPE20:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 52 | pub fn foo21(_: i32, _: i32, _: i32) { } | |
| 52 | pub fn foo21(_: i32, _: i32, _: i32) {} | |
| 53 | 53 | // CHECK: define{{.*}}5foo21{{.*}}!type ![[TYPE21:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 54 | pub fn foo22(_: i64) { } | |
| 54 | pub fn foo22(_: i64) {} | |
| 55 | 55 | // CHECK: define{{.*}}5foo22{{.*}}!type ![[TYPE22:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 56 | pub fn foo23(_: i64, _: i64) { } | |
| 56 | pub fn foo23(_: i64, _: i64) {} | |
| 57 | 57 | // CHECK: define{{.*}}5foo23{{.*}}!type ![[TYPE23:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 58 | pub fn foo24(_: i64, _: i64, _: i64) { } | |
| 58 | pub fn foo24(_: i64, _: i64, _: i64) {} | |
| 59 | 59 | // CHECK: define{{.*}}5foo24{{.*}}!type ![[TYPE24:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 60 | pub fn foo25(_: i128) { } | |
| 60 | pub fn foo25(_: i128) {} | |
| 61 | 61 | // CHECK: define{{.*}}5foo25{{.*}}!type ![[TYPE25:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 62 | pub fn foo26(_: i128, _: i128) { } | |
| 62 | pub fn foo26(_: i128, _: i128) {} | |
| 63 | 63 | // CHECK: define{{.*}}5foo26{{.*}}!type ![[TYPE26:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 64 | pub fn foo27(_: i128, _: i128, _: i128) { } | |
| 64 | pub fn foo27(_: i128, _: i128, _: i128) {} | |
| 65 | 65 | // CHECK: define{{.*}}5foo27{{.*}}!type ![[TYPE27:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 66 | pub fn foo28(_: isize) { } | |
| 66 | pub fn foo28(_: isize) {} | |
| 67 | 67 | // CHECK: define{{.*}}5foo28{{.*}}!type ![[TYPE28:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 68 | pub fn foo29(_: isize, _: isize) { } | |
| 68 | pub fn foo29(_: isize, _: isize) {} | |
| 69 | 69 | // CHECK: define{{.*}}5foo29{{.*}}!type ![[TYPE29:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 70 | pub fn foo30(_: isize, _: isize, _: isize) { } | |
| 70 | pub fn foo30(_: isize, _: isize, _: isize) {} | |
| 71 | 71 | // CHECK: define{{.*}}5foo30{{.*}}!type ![[TYPE30:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 72 | pub fn foo31(_: u8) { } | |
| 72 | pub fn foo31(_: u8) {} | |
| 73 | 73 | // CHECK: define{{.*}}5foo31{{.*}}!type ![[TYPE31:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 74 | pub fn foo32(_: u8, _: u8) { } | |
| 74 | pub fn foo32(_: u8, _: u8) {} | |
| 75 | 75 | // CHECK: define{{.*}}5foo32{{.*}}!type ![[TYPE32:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 76 | pub fn foo33(_: u8, _: u8, _: u8) { } | |
| 76 | pub fn foo33(_: u8, _: u8, _: u8) {} | |
| 77 | 77 | // CHECK: define{{.*}}5foo33{{.*}}!type ![[TYPE33:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 78 | pub fn foo34(_: u16) { } | |
| 78 | pub fn foo34(_: u16) {} | |
| 79 | 79 | // CHECK: define{{.*}}5foo34{{.*}}!type ![[TYPE34:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 80 | pub fn foo35(_: u16, _: u16) { } | |
| 80 | pub fn foo35(_: u16, _: u16) {} | |
| 81 | 81 | // CHECK: define{{.*}}5foo35{{.*}}!type ![[TYPE35:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 82 | pub fn foo36(_: u16, _: u16, _: u16) { } | |
| 82 | pub fn foo36(_: u16, _: u16, _: u16) {} | |
| 83 | 83 | // CHECK: define{{.*}}5foo36{{.*}}!type ![[TYPE36:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 84 | pub fn foo37(_: u32) { } | |
| 84 | pub fn foo37(_: u32) {} | |
| 85 | 85 | // CHECK: define{{.*}}5foo37{{.*}}!type ![[TYPE37:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 86 | pub fn foo38(_: u32, _: u32) { } | |
| 86 | pub fn foo38(_: u32, _: u32) {} | |
| 87 | 87 | // CHECK: define{{.*}}5foo38{{.*}}!type ![[TYPE38:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 88 | pub fn foo39(_: u32, _: u32, _: u32) { } | |
| 88 | pub fn foo39(_: u32, _: u32, _: u32) {} | |
| 89 | 89 | // CHECK: define{{.*}}5foo39{{.*}}!type ![[TYPE39:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 90 | pub fn foo40(_: u64) { } | |
| 90 | pub fn foo40(_: u64) {} | |
| 91 | 91 | // CHECK: define{{.*}}5foo40{{.*}}!type ![[TYPE40:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 92 | pub fn foo41(_: u64, _: u64) { } | |
| 92 | pub fn foo41(_: u64, _: u64) {} | |
| 93 | 93 | // CHECK: define{{.*}}5foo41{{.*}}!type ![[TYPE41:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 94 | pub fn foo42(_: u64, _: u64, _: u64) { } | |
| 94 | pub fn foo42(_: u64, _: u64, _: u64) {} | |
| 95 | 95 | // CHECK: define{{.*}}5foo42{{.*}}!type ![[TYPE42:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 96 | pub fn foo43(_: u128) { } | |
| 96 | pub fn foo43(_: u128) {} | |
| 97 | 97 | // CHECK: define{{.*}}5foo43{{.*}}!type ![[TYPE43:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 98 | pub fn foo44(_: u128, _: u128) { } | |
| 98 | pub fn foo44(_: u128, _: u128) {} | |
| 99 | 99 | // CHECK: define{{.*}}5foo44{{.*}}!type ![[TYPE44:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 100 | pub fn foo45(_: u128, _: u128, _: u128) { } | |
| 100 | pub fn foo45(_: u128, _: u128, _: u128) {} | |
| 101 | 101 | // CHECK: define{{.*}}5foo45{{.*}}!type ![[TYPE45:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 102 | pub fn foo46(_: usize) { } | |
| 102 | pub fn foo46(_: usize) {} | |
| 103 | 103 | // CHECK: define{{.*}}5foo46{{.*}}!type ![[TYPE46:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 104 | pub fn foo47(_: usize, _: usize) { } | |
| 104 | pub fn foo47(_: usize, _: usize) {} | |
| 105 | 105 | // CHECK: define{{.*}}5foo47{{.*}}!type ![[TYPE47:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 106 | pub fn foo48(_: usize, _: usize, _: usize) { } | |
| 106 | pub fn foo48(_: usize, _: usize, _: usize) {} | |
| 107 | 107 | // CHECK: define{{.*}}5foo48{{.*}}!type ![[TYPE48:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 108 | pub fn foo49(_: f32) { } | |
| 108 | pub fn foo49(_: f32) {} | |
| 109 | 109 | // CHECK: define{{.*}}5foo49{{.*}}!type ![[TYPE49:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 110 | pub fn foo50(_: f32, _: f32) { } | |
| 110 | pub fn foo50(_: f32, _: f32) {} | |
| 111 | 111 | // CHECK: define{{.*}}5foo50{{.*}}!type ![[TYPE50:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 112 | pub fn foo51(_: f32, _: f32, _: f32) { } | |
| 112 | pub fn foo51(_: f32, _: f32, _: f32) {} | |
| 113 | 113 | // CHECK: define{{.*}}5foo51{{.*}}!type ![[TYPE51:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 114 | pub fn foo52(_: f64) { } | |
| 114 | pub fn foo52(_: f64) {} | |
| 115 | 115 | // CHECK: define{{.*}}5foo52{{.*}}!type ![[TYPE52:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 116 | pub fn foo53(_: f64, _: f64) { } | |
| 116 | pub fn foo53(_: f64, _: f64) {} | |
| 117 | 117 | // CHECK: define{{.*}}5foo53{{.*}}!type ![[TYPE53:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 118 | pub fn foo54(_: f64, _: f64, _: f64) { } | |
| 118 | pub fn foo54(_: f64, _: f64, _: f64) {} | |
| 119 | 119 | // CHECK: define{{.*}}5foo54{{.*}}!type ![[TYPE54:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 120 | pub fn foo55(_: char) { } | |
| 120 | pub fn foo55(_: char) {} | |
| 121 | 121 | // CHECK: define{{.*}}5foo55{{.*}}!type ![[TYPE55:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 122 | pub fn foo56(_: char, _: char) { } | |
| 122 | pub fn foo56(_: char, _: char) {} | |
| 123 | 123 | // CHECK: define{{.*}}5foo56{{.*}}!type ![[TYPE56:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 124 | pub fn foo57(_: char, _: char, _: char) { } | |
| 124 | pub fn foo57(_: char, _: char, _: char) {} | |
| 125 | 125 | // CHECK: define{{.*}}5foo57{{.*}}!type ![[TYPE57:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 126 | pub fn foo58(_: &str) { } | |
| 126 | pub fn foo58(_: &str) {} | |
| 127 | 127 | // CHECK: define{{.*}}5foo58{{.*}}!type ![[TYPE58:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 128 | pub fn foo59(_: &str, _: &str) { } | |
| 128 | pub fn foo59(_: &str, _: &str) {} | |
| 129 | 129 | // CHECK: define{{.*}}5foo59{{.*}}!type ![[TYPE59:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 130 | pub fn foo60(_: &str, _: &str, _: &str) { } | |
| 130 | pub fn foo60(_: &str, _: &str, _: &str) {} | |
| 131 | 131 | // CHECK: define{{.*}}5foo60{{.*}}!type ![[TYPE60:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 132 | 132 | |
| 133 | 133 | // CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFvvE"} |
tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-repr-transparent-types.rs+13-14| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | //@ needs-sanitizer-cfi |
| 5 | 5 | //@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static |
| 6 | 6 | |
| 7 | #![crate_type="lib"] | |
| 7 | #![crate_type = "lib"] | |
| 8 | 8 | |
| 9 | 9 | extern crate core; |
| 10 | 10 | use core::ffi::*; |
| ... | ... | @@ -40,32 +40,31 @@ pub struct Type4(Type4Helper<Type4>); |
| 40 | 40 | #[repr(transparent)] |
| 41 | 41 | pub struct Type4Helper<T>(*mut T); |
| 42 | 42 | |
| 43 | pub fn foo1(_: Type1) { } | |
| 43 | pub fn foo1(_: Type1) {} | |
| 44 | 44 | // CHECK: define{{.*}}4foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 45 | pub fn foo2(_: Type1, _: Type1) { } | |
| 45 | pub fn foo2(_: Type1, _: Type1) {} | |
| 46 | 46 | // CHECK: define{{.*}}4foo2{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 47 | pub fn foo3(_: Type1, _: Type1, _: Type1) { } | |
| 47 | pub fn foo3(_: Type1, _: Type1, _: Type1) {} | |
| 48 | 48 | // CHECK: define{{.*}}4foo3{{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 49 | pub fn foo4(_: Type2) { } | |
| 49 | pub fn foo4(_: Type2) {} | |
| 50 | 50 | // CHECK: define{{.*}}4foo4{{.*}}!type ![[TYPE4:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 51 | pub fn foo5(_: Type2, _: Type2) { } | |
| 51 | pub fn foo5(_: Type2, _: Type2) {} | |
| 52 | 52 | // CHECK: define{{.*}}4foo5{{.*}}!type ![[TYPE5:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 53 | pub fn foo6(_: Type2, _: Type2, _: Type2) { } | |
| 53 | pub fn foo6(_: Type2, _: Type2, _: Type2) {} | |
| 54 | 54 | // CHECK: define{{.*}}4foo6{{.*}}!type ![[TYPE6:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 55 | pub fn foo7(_: Type3<Bar>) { } | |
| 55 | pub fn foo7(_: Type3<Bar>) {} | |
| 56 | 56 | // CHECK: define{{.*}}4foo7{{.*}}!type ![[TYPE7:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 57 | pub fn foo8(_: Type3<Bar>, _: Type3<Bar>) { } | |
| 57 | pub fn foo8(_: Type3<Bar>, _: Type3<Bar>) {} | |
| 58 | 58 | // CHECK: define{{.*}}4foo8{{.*}}!type ![[TYPE8:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 59 | pub fn foo9(_: Type3<Bar>, _: Type3<Bar>, _: Type3<Bar>) { } | |
| 59 | pub fn foo9(_: Type3<Bar>, _: Type3<Bar>, _: Type3<Bar>) {} | |
| 60 | 60 | // CHECK: define{{.*}}4foo9{{.*}}!type ![[TYPE9:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 61 | pub fn foo10(_: Type4) { } | |
| 61 | pub fn foo10(_: Type4) {} | |
| 62 | 62 | // CHECK: define{{.*}}5foo10{{.*}}!type ![[TYPE10:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 63 | pub fn foo11(_: Type4, _: Type4) { } | |
| 63 | pub fn foo11(_: Type4, _: Type4) {} | |
| 64 | 64 | // CHECK: define{{.*}}5foo11{{.*}}!type ![[TYPE11:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 65 | pub fn foo12(_: Type4, _: Type4, _: Type4) { } | |
| 65 | pub fn foo12(_: Type4, _: Type4, _: Type4) {} | |
| 66 | 66 | // CHECK: define{{.*}}5foo12{{.*}}!type ![[TYPE12:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 67 | 67 | |
| 68 | ||
| 69 | 68 | // CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}3FooE"} |
| 70 | 69 | // CHECK: ![[TYPE2]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}3FooS_E"} |
| 71 | 70 | // CHECK: ![[TYPE3]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}3FooS_S_E"} |
tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-sequence-types.rs+10-10| ... | ... | @@ -4,25 +4,25 @@ |
| 4 | 4 | //@ needs-sanitizer-cfi |
| 5 | 5 | //@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static |
| 6 | 6 | |
| 7 | #![crate_type="lib"] | |
| 7 | #![crate_type = "lib"] | |
| 8 | 8 | |
| 9 | pub fn foo1(_: (i32, i32)) { } | |
| 9 | pub fn foo1(_: (i32, i32)) {} | |
| 10 | 10 | // CHECK: define{{.*}}4foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 11 | pub fn foo2(_: (i32, i32), _: (i32, i32)) { } | |
| 11 | pub fn foo2(_: (i32, i32), _: (i32, i32)) {} | |
| 12 | 12 | // CHECK: define{{.*}}4foo2{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 13 | pub fn foo3(_: (i32, i32), _: (i32, i32), _: (i32, i32)) { } | |
| 13 | pub fn foo3(_: (i32, i32), _: (i32, i32), _: (i32, i32)) {} | |
| 14 | 14 | // CHECK: define{{.*}}4foo3{{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 15 | pub fn foo4(_: [i32; 32]) { } | |
| 15 | pub fn foo4(_: [i32; 32]) {} | |
| 16 | 16 | // CHECK: define{{.*}}4foo4{{.*}}!type ![[TYPE4:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 17 | pub fn foo5(_: [i32; 32], _: [i32; 32]) { } | |
| 17 | pub fn foo5(_: [i32; 32], _: [i32; 32]) {} | |
| 18 | 18 | // CHECK: define{{.*}}4foo5{{.*}}!type ![[TYPE5:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 19 | pub fn foo6(_: [i32; 32], _: [i32; 32], _: [i32; 32]) { } | |
| 19 | pub fn foo6(_: [i32; 32], _: [i32; 32], _: [i32; 32]) {} | |
| 20 | 20 | // CHECK: define{{.*}}4foo6{{.*}}!type ![[TYPE6:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 21 | pub fn foo7(_: &[i32]) { } | |
| 21 | pub fn foo7(_: &[i32]) {} | |
| 22 | 22 | // CHECK: define{{.*}}4foo7{{.*}}!type ![[TYPE7:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 23 | pub fn foo8(_: &[i32], _: &[i32]) { } | |
| 23 | pub fn foo8(_: &[i32], _: &[i32]) {} | |
| 24 | 24 | // CHECK: define{{.*}}4foo8{{.*}}!type ![[TYPE8:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 25 | pub fn foo9(_: &[i32], _: &[i32], _: &[i32]) { } | |
| 25 | pub fn foo9(_: &[i32], _: &[i32], _: &[i32]) {} | |
| 26 | 26 | // CHECK: define{{.*}}4foo9{{.*}}!type ![[TYPE9:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 27 | 27 | |
| 28 | 28 | // CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFvu5tupleIu3i32S_EE"} |
tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-trait-types.rs+58-44| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | //@ needs-sanitizer-cfi |
| 5 | 5 | //@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static |
| 6 | 6 | |
| 7 | #![crate_type="lib"] | |
| 7 | #![crate_type = "lib"] | |
| 8 | 8 | |
| 9 | 9 | extern crate core; |
| 10 | 10 | |
| ... | ... | @@ -16,8 +16,7 @@ pub trait Trait1 { |
| 16 | 16 | pub struct Type1; |
| 17 | 17 | |
| 18 | 18 | impl Trait1 for Type1 { |
| 19 | fn foo(&self) { | |
| 20 | } | |
| 19 | fn foo(&self) {} | |
| 21 | 20 | } |
| 22 | 21 | |
| 23 | 22 | pub trait Trait2<T> { |
| ... | ... | @@ -27,8 +26,7 @@ pub trait Trait2<T> { |
| 27 | 26 | pub struct Type2; |
| 28 | 27 | |
| 29 | 28 | impl Trait2<i32> for Type2 { |
| 30 | fn bar(&self) { | |
| 31 | } | |
| 29 | fn bar(&self) {} | |
| 32 | 30 | } |
| 33 | 31 | |
| 34 | 32 | pub trait Trait3<T> { |
| ... | ... | @@ -38,8 +36,7 @@ pub trait Trait3<T> { |
| 38 | 36 | pub struct Type3; |
| 39 | 37 | |
| 40 | 38 | impl<T, U> Trait3<U> for T { |
| 41 | fn baz(&self, _: &U) { | |
| 42 | } | |
| 39 | fn baz(&self, _: &U) {} | |
| 43 | 40 | } |
| 44 | 41 | |
| 45 | 42 | pub trait Trait4<'a, T> { |
| ... | ... | @@ -64,71 +61,88 @@ pub trait Trait5<T, const N: usize> { |
| 64 | 61 | pub struct Type5; |
| 65 | 62 | |
| 66 | 63 | impl<T, U, const N: usize> Trait5<U, N> for T { |
| 67 | fn quux(&self, _: &[U; N]) { | |
| 68 | } | |
| 64 | fn quux(&self, _: &[U; N]) {} | |
| 69 | 65 | } |
| 70 | 66 | |
| 71 | pub fn foo1(_: &dyn Send) { } | |
| 67 | pub fn foo1(_: &dyn Send) {} | |
| 72 | 68 | // CHECK: define{{.*}}4foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 73 | pub fn foo2(_: &dyn Send, _: &dyn Send) { } | |
| 69 | pub fn foo2(_: &dyn Send, _: &dyn Send) {} | |
| 74 | 70 | // CHECK: define{{.*}}4foo2{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 75 | pub fn foo3(_: &dyn Send, _: &dyn Send, _: &dyn Send) { } | |
| 71 | pub fn foo3(_: &dyn Send, _: &dyn Send, _: &dyn Send) {} | |
| 76 | 72 | // CHECK: define{{.*}}4foo3{{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 77 | pub fn foo4(_: &(dyn Send + Sync)) { } | |
| 73 | pub fn foo4(_: &(dyn Send + Sync)) {} | |
| 78 | 74 | // CHECK: define{{.*}}4foo4{{.*}}!type ![[TYPE4:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 79 | pub fn foo5(_: &(dyn Send + Sync), _: &(dyn Sync + Send)) { } | |
| 75 | pub fn foo5(_: &(dyn Send + Sync), _: &(dyn Sync + Send)) {} | |
| 80 | 76 | // CHECK: define{{.*}}4foo5{{.*}}!type ![[TYPE5:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 81 | pub fn foo6(_: &(dyn Send + Sync), _: &(dyn Sync + Send), _: &(dyn Sync + Send)) { } | |
| 77 | pub fn foo6(_: &(dyn Send + Sync), _: &(dyn Sync + Send), _: &(dyn Sync + Send)) {} | |
| 82 | 78 | // CHECK: define{{.*}}4foo6{{.*}}!type ![[TYPE6:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 83 | pub fn foo7(_: &(dyn Trait1 + Send)) { } | |
| 79 | pub fn foo7(_: &(dyn Trait1 + Send)) {} | |
| 84 | 80 | // CHECK: define{{.*}}4foo7{{.*}}!type ![[TYPE7:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 85 | pub fn foo8(_: &(dyn Trait1 + Send), _: &(dyn Trait1 + Send)) { } | |
| 81 | pub fn foo8(_: &(dyn Trait1 + Send), _: &(dyn Trait1 + Send)) {} | |
| 86 | 82 | // CHECK: define{{.*}}4foo8{{.*}}!type ![[TYPE8:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 87 | pub fn foo9(_: &(dyn Trait1 + Send), _: &(dyn Trait1 + Send), _: &(dyn Trait1 + Send)) { } | |
| 83 | pub fn foo9(_: &(dyn Trait1 + Send), _: &(dyn Trait1 + Send), _: &(dyn Trait1 + Send)) {} | |
| 88 | 84 | // CHECK: define{{.*}}4foo9{{.*}}!type ![[TYPE9:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 89 | pub fn foo10(_: &(dyn Trait1 + Send + Sync)) { } | |
| 85 | pub fn foo10(_: &(dyn Trait1 + Send + Sync)) {} | |
| 90 | 86 | // CHECK: define{{.*}}5foo10{{.*}}!type ![[TYPE10:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 91 | pub fn foo11(_: &(dyn Trait1 + Send + Sync), _: &(dyn Trait1 + Sync + Send)) { } | |
| 87 | pub fn foo11(_: &(dyn Trait1 + Send + Sync), _: &(dyn Trait1 + Sync + Send)) {} | |
| 92 | 88 | // CHECK: define{{.*}}5foo11{{.*}}!type ![[TYPE11:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 93 | pub fn foo12(_: &(dyn Trait1 + Send + Sync), | |
| 94 | _: &(dyn Trait1 + Sync + Send), | |
| 95 | _: &(dyn Trait1 + Sync + Send)) { } | |
| 89 | pub fn foo12( | |
| 90 | _: &(dyn Trait1 + Send + Sync), | |
| 91 | _: &(dyn Trait1 + Sync + Send), | |
| 92 | _: &(dyn Trait1 + Sync + Send), | |
| 93 | ) { | |
| 94 | } | |
| 96 | 95 | // CHECK: define{{.*}}5foo12{{.*}}!type ![[TYPE12:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 97 | pub fn foo13(_: &dyn Trait1) { } | |
| 96 | pub fn foo13(_: &dyn Trait1) {} | |
| 98 | 97 | // CHECK: define{{.*}}5foo13{{.*}}!type ![[TYPE13:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 99 | pub fn foo14(_: &dyn Trait1, _: &dyn Trait1) { } | |
| 98 | pub fn foo14(_: &dyn Trait1, _: &dyn Trait1) {} | |
| 100 | 99 | // CHECK: define{{.*}}5foo14{{.*}}!type ![[TYPE14:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 101 | pub fn foo15(_: &dyn Trait1, _: &dyn Trait1, _: &dyn Trait1) { } | |
| 100 | pub fn foo15(_: &dyn Trait1, _: &dyn Trait1, _: &dyn Trait1) {} | |
| 102 | 101 | // CHECK: define{{.*}}5foo15{{.*}}!type ![[TYPE15:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 103 | pub fn foo16<T>(_: &dyn Trait2<T>) { } | |
| 104 | pub fn bar16() { let a = Type2; foo16(&a); } | |
| 102 | pub fn foo16<T>(_: &dyn Trait2<T>) {} | |
| 103 | pub fn bar16() { | |
| 104 | let a = Type2; | |
| 105 | foo16(&a); | |
| 106 | } | |
| 105 | 107 | // CHECK: define{{.*}}5foo16{{.*}}!type ![[TYPE16:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 106 | pub fn foo17<T>(_: &dyn Trait2<T>, _: &dyn Trait2<T>) { } | |
| 107 | pub fn bar17() { let a = Type2; foo17(&a, &a); } | |
| 108 | pub fn foo17<T>(_: &dyn Trait2<T>, _: &dyn Trait2<T>) {} | |
| 109 | pub fn bar17() { | |
| 110 | let a = Type2; | |
| 111 | foo17(&a, &a); | |
| 112 | } | |
| 108 | 113 | // CHECK: define{{.*}}5foo17{{.*}}!type ![[TYPE17:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 109 | pub fn foo18<T>(_: &dyn Trait2<T>, _: &dyn Trait2<T>, _: &dyn Trait2<T>) { } | |
| 110 | pub fn bar18() { let a = Type2; foo18(&a, &a, &a); } | |
| 114 | pub fn foo18<T>(_: &dyn Trait2<T>, _: &dyn Trait2<T>, _: &dyn Trait2<T>) {} | |
| 115 | pub fn bar18() { | |
| 116 | let a = Type2; | |
| 117 | foo18(&a, &a, &a); | |
| 118 | } | |
| 111 | 119 | // CHECK: define{{.*}}5foo18{{.*}}!type ![[TYPE18:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 112 | pub fn foo19(_: &dyn Trait3<Type3>) { } | |
| 120 | pub fn foo19(_: &dyn Trait3<Type3>) {} | |
| 113 | 121 | // CHECK: define{{.*}}5foo19{{.*}}!type ![[TYPE19:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 114 | pub fn foo20(_: &dyn Trait3<Type3>, _: &dyn Trait3<Type3>) { } | |
| 122 | pub fn foo20(_: &dyn Trait3<Type3>, _: &dyn Trait3<Type3>) {} | |
| 115 | 123 | // CHECK: define{{.*}}5foo20{{.*}}!type ![[TYPE20:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 116 | pub fn foo21(_: &dyn Trait3<Type3>, _: &dyn Trait3<Type3>, _: &dyn Trait3<Type3>) { } | |
| 124 | pub fn foo21(_: &dyn Trait3<Type3>, _: &dyn Trait3<Type3>, _: &dyn Trait3<Type3>) {} | |
| 117 | 125 | // CHECK: define{{.*}}5foo21{{.*}}!type ![[TYPE21:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 118 | pub fn foo22<'a>(_: &dyn Trait4<'a, Type4, Output = &'a i32>) { } | |
| 126 | pub fn foo22<'a>(_: &dyn Trait4<'a, Type4, Output = &'a i32>) {} | |
| 119 | 127 | // CHECK: define{{.*}}5foo22{{.*}}!type ![[TYPE22:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 120 | pub fn foo23<'a>(_: &dyn Trait4<'a, Type4, Output = &'a i32>, | |
| 121 | _: &dyn Trait4<'a, Type4, Output = &'a i32>) { } | |
| 128 | pub fn foo23<'a>( | |
| 129 | _: &dyn Trait4<'a, Type4, Output = &'a i32>, | |
| 130 | _: &dyn Trait4<'a, Type4, Output = &'a i32>, | |
| 131 | ) { | |
| 132 | } | |
| 122 | 133 | // CHECK: define{{.*}}5foo23{{.*}}!type ![[TYPE23:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 123 | pub fn foo24<'a>(_: &dyn Trait4<'a, Type4, Output = &'a i32>, | |
| 124 | _: &dyn Trait4<'a, Type4, Output = &'a i32>, | |
| 125 | _: &dyn Trait4<'a, Type4, Output = &'a i32>) { } | |
| 134 | pub fn foo24<'a>( | |
| 135 | _: &dyn Trait4<'a, Type4, Output = &'a i32>, | |
| 136 | _: &dyn Trait4<'a, Type4, Output = &'a i32>, | |
| 137 | _: &dyn Trait4<'a, Type4, Output = &'a i32>, | |
| 138 | ) { | |
| 139 | } | |
| 126 | 140 | // CHECK: define{{.*}}5foo24{{.*}}!type ![[TYPE24:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 127 | pub fn foo25(_: &dyn Trait5<Type5, 32>) { } | |
| 141 | pub fn foo25(_: &dyn Trait5<Type5, 32>) {} | |
| 128 | 142 | // CHECK: define{{.*}}5foo25{{.*}}!type ![[TYPE25:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 129 | pub fn foo26(_: &dyn Trait5<Type5, 32>, _: &dyn Trait5<Type5, 32>) { } | |
| 143 | pub fn foo26(_: &dyn Trait5<Type5, 32>, _: &dyn Trait5<Type5, 32>) {} | |
| 130 | 144 | // CHECK: define{{.*}}5foo26{{.*}}!type ![[TYPE26:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 131 | pub fn foo27(_: &dyn Trait5<Type5, 32>, _: &dyn Trait5<Type5, 32>, _: &dyn Trait5<Type5, 32>) { } | |
| 145 | pub fn foo27(_: &dyn Trait5<Type5, 32>, _: &dyn Trait5<Type5, 32>, _: &dyn Trait5<Type5, 32>) {} | |
| 132 | 146 | // CHECK: define{{.*}}5foo27{{.*}}!type ![[TYPE27:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 133 | 147 | |
| 134 | 148 | // CHECK: ![[TYPE13]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}6Trait1u6regionEEE"} |
tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-user-defined-types.rs+14-14| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | //@ needs-sanitizer-cfi |
| 5 | 5 | //@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static |
| 6 | 6 | |
| 7 | #![crate_type="lib"] | |
| 7 | #![crate_type = "lib"] | |
| 8 | 8 | #![feature(extern_types)] |
| 9 | 9 | |
| 10 | 10 | pub struct Struct1<T> { |
| ... | ... | @@ -19,33 +19,33 @@ pub union Union1<T> { |
| 19 | 19 | member1: std::mem::ManuallyDrop<T>, |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | extern { | |
| 22 | extern "C" { | |
| 23 | 23 | pub type type1; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | pub fn foo1(_: &Struct1::<i32>) { } | |
| 26 | pub fn foo1(_: &Struct1<i32>) {} | |
| 27 | 27 | // CHECK: define{{.*}}4foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 28 | pub fn foo2(_: &Struct1::<i32>, _: &Struct1::<i32>) { } | |
| 28 | pub fn foo2(_: &Struct1<i32>, _: &Struct1<i32>) {} | |
| 29 | 29 | // CHECK: define{{.*}}4foo2{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 30 | pub fn foo3(_: &Struct1::<i32>, _: &Struct1::<i32>, _: &Struct1::<i32>) { } | |
| 30 | pub fn foo3(_: &Struct1<i32>, _: &Struct1<i32>, _: &Struct1<i32>) {} | |
| 31 | 31 | // CHECK: define{{.*}}4foo3{{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 32 | pub fn foo4(_: &Enum1::<i32>) { } | |
| 32 | pub fn foo4(_: &Enum1<i32>) {} | |
| 33 | 33 | // CHECK: define{{.*}}4foo4{{.*}}!type ![[TYPE4:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 34 | pub fn foo5(_: &Enum1::<i32>, _: &Enum1::<i32>) { } | |
| 34 | pub fn foo5(_: &Enum1<i32>, _: &Enum1<i32>) {} | |
| 35 | 35 | // CHECK: define{{.*}}4foo5{{.*}}!type ![[TYPE5:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 36 | pub fn foo6(_: &Enum1::<i32>, _: &Enum1::<i32>, _: &Enum1::<i32>) { } | |
| 36 | pub fn foo6(_: &Enum1<i32>, _: &Enum1<i32>, _: &Enum1<i32>) {} | |
| 37 | 37 | // CHECK: define{{.*}}4foo6{{.*}}!type ![[TYPE6:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 38 | pub fn foo7(_: &Union1::<i32>) { } | |
| 38 | pub fn foo7(_: &Union1<i32>) {} | |
| 39 | 39 | // CHECK: define{{.*}}4foo7{{.*}}!type ![[TYPE7:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 40 | pub fn foo8(_: &Union1::<i32>, _: &Union1::<i32>) { } | |
| 40 | pub fn foo8(_: &Union1<i32>, _: &Union1<i32>) {} | |
| 41 | 41 | // CHECK: define{{.*}}4foo8{{.*}}!type ![[TYPE8:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 42 | pub fn foo9(_: &Union1::<i32>, _: &Union1::<i32>, _: &Union1::<i32>) { } | |
| 42 | pub fn foo9(_: &Union1<i32>, _: &Union1<i32>, _: &Union1<i32>) {} | |
| 43 | 43 | // CHECK: define{{.*}}4foo9{{.*}}!type ![[TYPE9:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 44 | pub fn foo10(_: *mut type1) { } | |
| 44 | pub fn foo10(_: *mut type1) {} | |
| 45 | 45 | // CHECK: define{{.*}}5foo10{{.*}}!type ![[TYPE10:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 46 | pub fn foo11(_: *mut type1, _: *mut type1) { } | |
| 46 | pub fn foo11(_: *mut type1, _: *mut type1) {} | |
| 47 | 47 | // CHECK: define{{.*}}5foo11{{.*}}!type ![[TYPE11:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 48 | pub fn foo12(_: *mut type1, _: *mut type1, _: *mut type1) { } | |
| 48 | pub fn foo12(_: *mut type1, _: *mut type1, _: *mut type1) {} | |
| 49 | 49 | // CHECK: define{{.*}}5foo12{{.*}}!type ![[TYPE12:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 50 | 50 | |
| 51 | 51 | // CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}7Struct1Iu3i32EEE"} |
tests/codegen/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-generalized.rs+1-1| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | //@ needs-sanitizer-cfi |
| 4 | 4 | //@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-generalize-pointers |
| 5 | 5 | |
| 6 | #![crate_type="lib"] | |
| 6 | #![crate_type = "lib"] | |
| 7 | 7 | |
| 8 | 8 | pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { |
| 9 | 9 | // CHECK-LABEL: define{{.*}}foo |
tests/codegen/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized-generalized.rs+1-1| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | //@ needs-sanitizer-cfi |
| 4 | 4 | //@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers -Zsanitizer-cfi-generalize-pointers |
| 5 | 5 | |
| 6 | #![crate_type="lib"] | |
| 6 | #![crate_type = "lib"] | |
| 7 | 7 | |
| 8 | 8 | pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { |
| 9 | 9 | // CHECK-LABEL: define{{.*}}foo |
tests/codegen/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized.rs+1-1| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | //@ needs-sanitizer-cfi |
| 4 | 4 | //@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers |
| 5 | 5 | |
| 6 | #![crate_type="lib"] | |
| 6 | #![crate_type = "lib"] | |
| 7 | 7 | |
| 8 | 8 | pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { |
| 9 | 9 | // CHECK-LABEL: define{{.*}}foo |
tests/codegen/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi.rs+1-1| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | //@ needs-sanitizer-cfi |
| 4 | 4 | //@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi |
| 5 | 5 | |
| 6 | #![crate_type="lib"] | |
| 6 | #![crate_type = "lib"] | |
| 7 | 7 | |
| 8 | 8 | pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { |
| 9 | 9 | // CHECK-LABEL: define{{.*}}foo |
tests/codegen/sanitizer/cfi/emit-type-metadata-trait-objects.rs+5-9| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | //@ needs-sanitizer-cfi |
| 4 | 4 | //@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Ctarget-feature=-crt-static -Zsanitizer=cfi |
| 5 | 5 | |
| 6 | #![crate_type="lib"] | |
| 6 | #![crate_type = "lib"] | |
| 7 | 7 | |
| 8 | 8 | pub trait Trait1 { |
| 9 | 9 | fn foo(&self); |
| ... | ... | @@ -13,8 +13,7 @@ pub trait Trait1 { |
| 13 | 13 | pub struct Type1; |
| 14 | 14 | |
| 15 | 15 | impl Trait1 for Type1 { |
| 16 | fn foo(&self) { | |
| 17 | } | |
| 16 | fn foo(&self) {} | |
| 18 | 17 | } |
| 19 | 18 | |
| 20 | 19 | pub trait Trait2<T> { |
| ... | ... | @@ -24,8 +23,7 @@ pub trait Trait2<T> { |
| 24 | 23 | pub struct Type2; |
| 25 | 24 | |
| 26 | 25 | impl Trait2<i32> for Type2 { |
| 27 | fn bar(&self) { | |
| 28 | } | |
| 26 | fn bar(&self) {} | |
| 29 | 27 | } |
| 30 | 28 | |
| 31 | 29 | pub trait Trait3<T> { |
| ... | ... | @@ -35,8 +33,7 @@ pub trait Trait3<T> { |
| 35 | 33 | pub struct Type3; |
| 36 | 34 | |
| 37 | 35 | impl<T, U> Trait3<U> for T { |
| 38 | fn baz(&self, _: &U) { | |
| 39 | } | |
| 36 | fn baz(&self, _: &U) {} | |
| 40 | 37 | } |
| 41 | 38 | |
| 42 | 39 | pub trait Trait4<'a, T> { |
| ... | ... | @@ -61,8 +58,7 @@ pub trait Trait5<T, const N: usize> { |
| 61 | 58 | pub struct Type5; |
| 62 | 59 | |
| 63 | 60 | impl<T, U, const N: usize> Trait5<U, N> for T { |
| 64 | fn quux(&self, _: &[U; N]) { | |
| 65 | } | |
| 61 | fn quux(&self, _: &[U; N]) {} | |
| 66 | 62 | } |
| 67 | 63 | |
| 68 | 64 | pub fn foo1(a: &dyn Trait1) { |
tests/codegen/sanitizer/cfi/generalize-pointers.rs+13-13| ... | ... | @@ -3,33 +3,33 @@ |
| 3 | 3 | //@ needs-sanitizer-cfi |
| 4 | 4 | //@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-generalize-pointers -Copt-level=0 |
| 5 | 5 | |
| 6 | #![crate_type="lib"] | |
| 6 | #![crate_type = "lib"] | |
| 7 | 7 | |
| 8 | 8 | extern crate core; |
| 9 | 9 | |
| 10 | pub fn foo0(_: &mut i32) { } | |
| 10 | pub fn foo0(_: &mut i32) {} | |
| 11 | 11 | // CHECK: define{{.*}}foo0{{.*}}!type ![[TYPE0:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 12 | pub fn foo1(_: &mut i32, _: &mut i32) { } | |
| 12 | pub fn foo1(_: &mut i32, _: &mut i32) {} | |
| 13 | 13 | // CHECK: define{{.*}}foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 14 | pub fn foo2(_: &mut i32, _: &mut i32, _: &mut i32) { } | |
| 14 | pub fn foo2(_: &mut i32, _: &mut i32, _: &mut i32) {} | |
| 15 | 15 | // CHECK: define{{.*}}foo2{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 16 | pub fn foo3(_: &i32) { } | |
| 16 | pub fn foo3(_: &i32) {} | |
| 17 | 17 | // CHECK: define{{.*}}foo3{{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 18 | pub fn foo4(_: &i32, _: &i32) { } | |
| 18 | pub fn foo4(_: &i32, _: &i32) {} | |
| 19 | 19 | // CHECK: define{{.*}}foo4{{.*}}!type ![[TYPE4:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 20 | pub fn foo5(_: &i32, _: &i32, _: &i32) { } | |
| 20 | pub fn foo5(_: &i32, _: &i32, _: &i32) {} | |
| 21 | 21 | // CHECK: define{{.*}}foo5{{.*}}!type ![[TYPE5:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 22 | pub fn foo6(_: *mut i32) { } | |
| 22 | pub fn foo6(_: *mut i32) {} | |
| 23 | 23 | // CHECK: define{{.*}}foo6{{.*}}!type ![[TYPE6:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 24 | pub fn foo7(_: *mut i32, _: *mut i32) { } | |
| 24 | pub fn foo7(_: *mut i32, _: *mut i32) {} | |
| 25 | 25 | // CHECK: define{{.*}}foo7{{.*}}!type ![[TYPE7:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 26 | pub fn foo8(_: *mut i32, _: *mut i32, _: *mut i32) { } | |
| 26 | pub fn foo8(_: *mut i32, _: *mut i32, _: *mut i32) {} | |
| 27 | 27 | // CHECK: define{{.*}}foo8{{.*}}!type ![[TYPE8:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 28 | pub fn foo9(_: *const i32) { } | |
| 28 | pub fn foo9(_: *const i32) {} | |
| 29 | 29 | // CHECK: define{{.*}}foo9{{.*}}!type ![[TYPE9:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 30 | pub fn foo10(_: *const i32, _: *const i32) { } | |
| 30 | pub fn foo10(_: *const i32, _: *const i32) {} | |
| 31 | 31 | // CHECK: define{{.*}}foo10{{.*}}!type ![[TYPE10:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 32 | pub fn foo11(_: *const i32, _: *const i32, _: *const i32) { } | |
| 32 | pub fn foo11(_: *const i32, _: *const i32, _: *const i32) {} | |
| 33 | 33 | // CHECK: define{{.*}}foo11{{.*}}!type ![[TYPE11:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} |
| 34 | 34 | |
| 35 | 35 | // CHECK: ![[TYPE0]] = !{i64 0, !"_ZTSFvU3mutu3refIvEE.generalized"} |
tests/codegen/sanitizer/cfi/normalize-integers.rs+13-13| ... | ... | @@ -3,33 +3,33 @@ |
| 3 | 3 | //@ needs-sanitizer-cfi |
| 4 | 4 | //@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers -Copt-level=0 |
| 5 | 5 | |
| 6 | #![crate_type="lib"] | |
| 6 | #![crate_type = "lib"] | |
| 7 | 7 | |
| 8 | 8 | extern crate core; |
| 9 | 9 | |
| 10 | pub fn foo0(_: bool) { } | |
| 10 | pub fn foo0(_: bool) {} | |
| 11 | 11 | // CHECK: define{{.*}}foo0{{.*}}!type ![[TYPE0:[0-9]+]] !type !{{[0-9]+}} |
| 12 | pub fn foo1(_: bool, _: bool) { } | |
| 12 | pub fn foo1(_: bool, _: bool) {} | |
| 13 | 13 | // CHECK: define{{.*}}foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} |
| 14 | pub fn foo2(_: bool, _: bool, _: bool) { } | |
| 14 | pub fn foo2(_: bool, _: bool, _: bool) {} | |
| 15 | 15 | // CHECK: define{{.*}}foo2{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} |
| 16 | pub fn foo3(_: char) { } | |
| 16 | pub fn foo3(_: char) {} | |
| 17 | 17 | // CHECK: define{{.*}}foo3{{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} |
| 18 | pub fn foo4(_: char, _: char) { } | |
| 18 | pub fn foo4(_: char, _: char) {} | |
| 19 | 19 | // CHECK: define{{.*}}foo4{{.*}}!type ![[TYPE4:[0-9]+]] !type !{{[0-9]+}} |
| 20 | pub fn foo5(_: char, _: char, _: char) { } | |
| 20 | pub fn foo5(_: char, _: char, _: char) {} | |
| 21 | 21 | // CHECK: define{{.*}}foo5{{.*}}!type ![[TYPE5:[0-9]+]] !type !{{[0-9]+}} |
| 22 | pub fn foo6(_: isize) { } | |
| 22 | pub fn foo6(_: isize) {} | |
| 23 | 23 | // CHECK: define{{.*}}foo6{{.*}}!type ![[TYPE6:[0-9]+]] !type !{{[0-9]+}} |
| 24 | pub fn foo7(_: isize, _: isize) { } | |
| 24 | pub fn foo7(_: isize, _: isize) {} | |
| 25 | 25 | // CHECK: define{{.*}}foo7{{.*}}!type ![[TYPE7:[0-9]+]] !type !{{[0-9]+}} |
| 26 | pub fn foo8(_: isize, _: isize, _: isize) { } | |
| 26 | pub fn foo8(_: isize, _: isize, _: isize) {} | |
| 27 | 27 | // CHECK: define{{.*}}foo8{{.*}}!type ![[TYPE8:[0-9]+]] !type !{{[0-9]+}} |
| 28 | pub fn foo9(_: (), _: usize) { } | |
| 28 | pub fn foo9(_: (), _: usize) {} | |
| 29 | 29 | // CHECK: define{{.*}}foo9{{.*}}!type ![[TYPE9:[0-9]+]] !type !{{[0-9]+}} |
| 30 | pub fn foo10(_: (), _: usize, _: usize) { } | |
| 30 | pub fn foo10(_: (), _: usize, _: usize) {} | |
| 31 | 31 | // CHECK: define{{.*}}foo10{{.*}}!type ![[TYPE10:[0-9]+]] !type !{{[0-9]+}} |
| 32 | pub fn foo11(_: (), _: usize, _: usize, _: usize) { } | |
| 32 | pub fn foo11(_: (), _: usize, _: usize, _: usize) {} | |
| 33 | 33 | // CHECK: define{{.*}}foo11{{.*}}!type ![[TYPE11:[0-9]+]] !type !{{[0-9]+}} |
| 34 | 34 | |
| 35 | 35 | // CHECK: ![[TYPE0]] = !{i64 0, !"_ZTSFvu2u8E.normalized"} |
tests/codegen/sanitizer/dataflow-instrument-functions.rs+2-3| ... | ... | @@ -3,8 +3,7 @@ |
| 3 | 3 | //@ needs-sanitizer-dataflow |
| 4 | 4 | //@ compile-flags: -Copt-level=0 -Zsanitizer=dataflow |
| 5 | 5 | |
| 6 | #![crate_type="lib"] | |
| 6 | #![crate_type = "lib"] | |
| 7 | 7 | |
| 8 | pub fn foo() { | |
| 9 | } | |
| 8 | pub fn foo() {} | |
| 10 | 9 | // CHECK: define{{.*}}foo{{.*}}.dfsan |
tests/codegen/sanitizer/kcfi/add-kcfi-flag.rs+6-7| ... | ... | @@ -8,15 +8,14 @@ |
| 8 | 8 | //@ compile-flags: -Ctarget-feature=-crt-static -Zsanitizer=kcfi |
| 9 | 9 | |
| 10 | 10 | #![feature(no_core, lang_items)] |
| 11 | #![crate_type="lib"] | |
| 11 | #![crate_type = "lib"] | |
| 12 | 12 | #![no_core] |
| 13 | 13 | |
| 14 | #[lang="sized"] | |
| 15 | trait Sized { } | |
| 16 | #[lang="copy"] | |
| 17 | trait Copy { } | |
| 14 | #[lang = "sized"] | |
| 15 | trait Sized {} | |
| 16 | #[lang = "copy"] | |
| 17 | trait Copy {} | |
| 18 | 18 | |
| 19 | pub fn foo() { | |
| 20 | } | |
| 19 | pub fn foo() {} | |
| 21 | 20 | |
| 22 | 21 | // CHECK: !{{[0-9]+}} = !{i32 4, !"kcfi", i32 1} |
tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-attr-no-sanitize.rs+5-5| ... | ... | @@ -7,14 +7,14 @@ |
| 7 | 7 | //@ [x86_64] needs-llvm-components: |
| 8 | 8 | //@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Copt-level=0 |
| 9 | 9 | |
| 10 | #![crate_type="lib"] | |
| 10 | #![crate_type = "lib"] | |
| 11 | 11 | #![feature(no_core, no_sanitize, lang_items)] |
| 12 | 12 | #![no_core] |
| 13 | 13 | |
| 14 | #[lang="sized"] | |
| 15 | trait Sized { } | |
| 16 | #[lang="copy"] | |
| 17 | trait Copy { } | |
| 14 | #[lang = "sized"] | |
| 15 | trait Sized {} | |
| 16 | #[lang = "copy"] | |
| 17 | trait Copy {} | |
| 18 | 18 | |
| 19 | 19 | impl Copy for i32 {} |
| 20 | 20 |
tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-generalized.rs+5-5| ... | ... | @@ -7,14 +7,14 @@ |
| 7 | 7 | //@ [x86_64] needs-llvm-components: |
| 8 | 8 | //@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Zsanitizer-cfi-generalize-pointers |
| 9 | 9 | |
| 10 | #![crate_type="lib"] | |
| 10 | #![crate_type = "lib"] | |
| 11 | 11 | #![feature(no_core, lang_items)] |
| 12 | 12 | #![no_core] |
| 13 | 13 | |
| 14 | #[lang="sized"] | |
| 15 | trait Sized { } | |
| 16 | #[lang="copy"] | |
| 17 | trait Copy { } | |
| 14 | #[lang = "sized"] | |
| 15 | trait Sized {} | |
| 16 | #[lang = "copy"] | |
| 17 | trait Copy {} | |
| 18 | 18 | |
| 19 | 19 | impl Copy for i32 {} |
| 20 | 20 |
tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized-generalized.rs+5-5| ... | ... | @@ -7,14 +7,14 @@ |
| 7 | 7 | //@ [x86_64] needs-llvm-components: |
| 8 | 8 | //@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Zsanitizer-cfi-normalize-integers -Zsanitizer-cfi-generalize-pointers |
| 9 | 9 | |
| 10 | #![crate_type="lib"] | |
| 10 | #![crate_type = "lib"] | |
| 11 | 11 | #![feature(no_core, lang_items)] |
| 12 | 12 | #![no_core] |
| 13 | 13 | |
| 14 | #[lang="sized"] | |
| 15 | trait Sized { } | |
| 16 | #[lang="copy"] | |
| 17 | trait Copy { } | |
| 14 | #[lang = "sized"] | |
| 15 | trait Sized {} | |
| 16 | #[lang = "copy"] | |
| 17 | trait Copy {} | |
| 18 | 18 | |
| 19 | 19 | impl Copy for i32 {} |
| 20 | 20 |
tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized.rs+5-5| ... | ... | @@ -7,14 +7,14 @@ |
| 7 | 7 | //@ [x86_64] needs-llvm-components: |
| 8 | 8 | //@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Zsanitizer-cfi-normalize-integers |
| 9 | 9 | |
| 10 | #![crate_type="lib"] | |
| 10 | #![crate_type = "lib"] | |
| 11 | 11 | #![feature(no_core, lang_items)] |
| 12 | 12 | #![no_core] |
| 13 | 13 | |
| 14 | #[lang="sized"] | |
| 15 | trait Sized { } | |
| 16 | #[lang="copy"] | |
| 17 | trait Copy { } | |
| 14 | #[lang = "sized"] | |
| 15 | trait Sized {} | |
| 16 | #[lang = "copy"] | |
| 17 | trait Copy {} | |
| 18 | 18 | |
| 19 | 19 | impl Copy for i32 {} |
| 20 | 20 |
tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi.rs+5-5| ... | ... | @@ -7,14 +7,14 @@ |
| 7 | 7 | //@ [x86_64] needs-llvm-components: |
| 8 | 8 | //@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Copt-level=0 |
| 9 | 9 | |
| 10 | #![crate_type="lib"] | |
| 10 | #![crate_type = "lib"] | |
| 11 | 11 | #![feature(no_core, lang_items)] |
| 12 | 12 | #![no_core] |
| 13 | 13 | |
| 14 | #[lang="sized"] | |
| 15 | trait Sized { } | |
| 16 | #[lang="copy"] | |
| 17 | trait Copy { } | |
| 14 | #[lang = "sized"] | |
| 15 | trait Sized {} | |
| 16 | #[lang = "copy"] | |
| 17 | trait Copy {} | |
| 18 | 18 | |
| 19 | 19 | impl Copy for i32 {} |
| 20 | 20 |
tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle.rs+5-5| ... | ... | @@ -7,14 +7,14 @@ |
| 7 | 7 | //@ [x86_64] needs-llvm-components: |
| 8 | 8 | //@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Copt-level=0 |
| 9 | 9 | |
| 10 | #![crate_type="lib"] | |
| 10 | #![crate_type = "lib"] | |
| 11 | 11 | #![feature(no_core, lang_items)] |
| 12 | 12 | #![no_core] |
| 13 | 13 | |
| 14 | #[lang="sized"] | |
| 15 | trait Sized { } | |
| 16 | #[lang="copy"] | |
| 17 | trait Copy { } | |
| 14 | #[lang = "sized"] | |
| 15 | trait Sized {} | |
| 16 | #[lang = "copy"] | |
| 17 | trait Copy {} | |
| 18 | 18 | |
| 19 | 19 | impl Copy for i32 {} |
| 20 | 20 |
tests/codegen/sanitizer/kcfi/emit-type-metadata-trait-objects.rs+23-25| ... | ... | @@ -7,30 +7,32 @@ |
| 7 | 7 | //@ [x86_64] needs-llvm-components: |
| 8 | 8 | //@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Copt-level=0 |
| 9 | 9 | |
| 10 | #![crate_type="lib"] | |
| 10 | #![crate_type = "lib"] | |
| 11 | 11 | #![feature(arbitrary_self_types, no_core, lang_items)] |
| 12 | 12 | #![no_core] |
| 13 | 13 | |
| 14 | #[lang="sized"] | |
| 15 | trait Sized { } | |
| 16 | #[lang="copy"] | |
| 17 | trait Copy { } | |
| 18 | #[lang="receiver"] | |
| 19 | trait Receiver { } | |
| 20 | #[lang="dispatch_from_dyn"] | |
| 21 | trait DispatchFromDyn<T> { } | |
| 14 | #[lang = "sized"] | |
| 15 | trait Sized {} | |
| 16 | #[lang = "copy"] | |
| 17 | trait Copy {} | |
| 18 | #[lang = "receiver"] | |
| 19 | trait Receiver {} | |
| 20 | #[lang = "dispatch_from_dyn"] | |
| 21 | trait DispatchFromDyn<T> {} | |
| 22 | 22 | impl<'a, T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<&'a U> for &'a T {} |
| 23 | 23 | #[lang = "unsize"] |
| 24 | trait Unsize<T: ?Sized> { } | |
| 24 | trait Unsize<T: ?Sized> {} | |
| 25 | 25 | #[lang = "coerce_unsized"] |
| 26 | pub trait CoerceUnsized<T: ?Sized> { } | |
| 26 | pub trait CoerceUnsized<T: ?Sized> {} | |
| 27 | 27 | impl<'a, 'b: 'a, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<&'a U> for &'b T {} |
| 28 | #[lang="freeze"] | |
| 29 | trait Freeze { } | |
| 30 | #[lang="drop_in_place"] | |
| 31 | fn drop_in_place_fn<T>() { } | |
| 32 | #[lang="drop"] | |
| 33 | trait Drop { fn drop(&mut self); } | |
| 28 | #[lang = "freeze"] | |
| 29 | trait Freeze {} | |
| 30 | #[lang = "drop_in_place"] | |
| 31 | fn drop_in_place_fn<T>() {} | |
| 32 | #[lang = "drop"] | |
| 33 | trait Drop { | |
| 34 | fn drop(&mut self); | |
| 35 | } | |
| 34 | 36 | |
| 35 | 37 | pub trait Trait1 { |
| 36 | 38 | fn foo(&self); |
| ... | ... | @@ -39,8 +41,7 @@ pub trait Trait1 { |
| 39 | 41 | pub struct Type1; |
| 40 | 42 | |
| 41 | 43 | impl Trait1 for Type1 { |
| 42 | fn foo(&self) { | |
| 43 | } | |
| 44 | fn foo(&self) {} | |
| 44 | 45 | } |
| 45 | 46 | |
| 46 | 47 | pub trait Trait2<T> { |
| ... | ... | @@ -50,8 +51,7 @@ pub trait Trait2<T> { |
| 50 | 51 | pub struct Type2; |
| 51 | 52 | |
| 52 | 53 | impl Trait2<i32> for Type2 { |
| 53 | fn bar(&self) { | |
| 54 | } | |
| 54 | fn bar(&self) {} | |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | pub trait Trait3<T> { |
| ... | ... | @@ -61,8 +61,7 @@ pub trait Trait3<T> { |
| 61 | 61 | pub struct Type3; |
| 62 | 62 | |
| 63 | 63 | impl<T, U> Trait3<U> for T { |
| 64 | fn baz(&self, _: &U) { | |
| 65 | } | |
| 64 | fn baz(&self, _: &U) {} | |
| 66 | 65 | } |
| 67 | 66 | |
| 68 | 67 | pub trait Trait4<'a, T> { |
| ... | ... | @@ -88,8 +87,7 @@ pub struct Type5; |
| 88 | 87 | impl Copy for Type5 {} |
| 89 | 88 | |
| 90 | 89 | impl<T, U, const N: usize> Trait5<U, N> for T { |
| 91 | fn quux(&self, _: &[U; N]) { | |
| 92 | } | |
| 90 | fn quux(&self, _: &[U; N]) {} | |
| 93 | 91 | } |
| 94 | 92 | |
| 95 | 93 | pub fn foo1(a: &dyn Trait1) { |
tests/codegen/sanitizer/memory-track-origins.rs+1-1| ... | ... | @@ -11,7 +11,7 @@ |
| 11 | 11 | //@[MSAN-1-LTO] compile-flags: -Zsanitizer-memory-track-origins=1 -C lto=fat |
| 12 | 12 | //@[MSAN-2-LTO] compile-flags: -Zsanitizer-memory-track-origins -C lto=fat |
| 13 | 13 | |
| 14 | #![crate_type="lib"] | |
| 14 | #![crate_type = "lib"] | |
| 15 | 15 | |
| 16 | 16 | // MSAN-0-NOT: @__msan_track_origins |
| 17 | 17 | // MSAN-1: @__msan_track_origins = weak_odr {{.*}}constant i32 1 |
tests/codegen/sanitizer/no-sanitize-inlining.rs+1-1| ... | ... | @@ -8,7 +8,7 @@ |
| 8 | 8 | //@[ASAN] compile-flags: -Zsanitizer=address |
| 9 | 9 | //@[LSAN] compile-flags: -Zsanitizer=leak |
| 10 | 10 | |
| 11 | #![crate_type="lib"] | |
| 11 | #![crate_type = "lib"] | |
| 12 | 12 | #![feature(no_sanitize)] |
| 13 | 13 | |
| 14 | 14 | // ASAN-LABEL: define void @test |
tests/codegen/sanitizer/no-sanitize.rs+1-1| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | //@ needs-sanitizer-address |
| 5 | 5 | //@ compile-flags: -Zsanitizer=address -Ctarget-feature=-crt-static -Copt-level=0 |
| 6 | 6 | |
| 7 | #![crate_type="lib"] | |
| 7 | #![crate_type = "lib"] | |
| 8 | 8 | #![feature(no_sanitize)] |
| 9 | 9 | |
| 10 | 10 | // CHECK-LABEL: ; no_sanitize::unsanitized |
tests/codegen/set-discriminant-invalid.rs+5-13| ... | ... | @@ -7,17 +7,12 @@ pub struct TokioError { |
| 7 | 7 | b: bool, |
| 8 | 8 | } |
| 9 | 9 | pub enum Error { |
| 10 | Api { | |
| 11 | source: ApiError, | |
| 12 | }, | |
| 10 | Api { source: ApiError }, | |
| 13 | 11 | Ethereum, |
| 14 | Tokio { | |
| 15 | source: TokioError, | |
| 16 | }, | |
| 12 | Tokio { source: TokioError }, | |
| 17 | 13 | } |
| 18 | 14 | struct Api; |
| 19 | impl IntoError<Error> for Api | |
| 20 | { | |
| 15 | impl IntoError<Error> for Api { | |
| 21 | 16 | type Source = ApiError; |
| 22 | 17 | // CHECK-LABEL: @into_error |
| 23 | 18 | // CHECK: llvm.trap() |
| ... | ... | @@ -27,14 +22,11 @@ impl IntoError<Error> for Api |
| 27 | 22 | // CHECK-NEXT: ret |
| 28 | 23 | #[no_mangle] |
| 29 | 24 | fn into_error(self, error: Self::Source) -> Error { |
| 30 | Error::Api { | |
| 31 | source: error, | |
| 32 | } | |
| 25 | Error::Api { source: error } | |
| 33 | 26 | } |
| 34 | 27 | } |
| 35 | 28 | |
| 36 | pub trait IntoError<E> | |
| 37 | { | |
| 29 | pub trait IntoError<E> { | |
| 38 | 30 | /// The underlying error |
| 39 | 31 | type Source; |
| 40 | 32 |
tests/codegen/simd/issue-120720-reduce-nan.rs+2-3| ... | ... | @@ -15,8 +15,7 @@ pub unsafe fn demo() -> bool { |
| 15 | 15 | // CHECK: %0 = tail call reassoc double @llvm.vector.reduce.fadd.v8f64( |
| 16 | 16 | // CHECK: %_0.i = fcmp uno double %0, 0.000000e+00 |
| 17 | 17 | // CHECK: ret i1 %_0.i |
| 18 | let res = unsafe { | |
| 19 | _mm512_reduce_add_pd(_mm512_set_pd(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, f64::NAN)) | |
| 20 | }; | |
| 18 | let res = | |
| 19 | unsafe { _mm512_reduce_add_pd(_mm512_set_pd(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, f64::NAN)) }; | |
| 21 | 20 | res.is_nan() |
| 22 | 21 | } |
tests/codegen/simd/swap-simd-types.rs+9-9| ... | ... | @@ -13,18 +13,18 @@ use core::arch::x86_64::__m256; |
| 13 | 13 | // CHECK-LABEL: @swap_single_m256 |
| 14 | 14 | #[no_mangle] |
| 15 | 15 | pub fn swap_single_m256(x: &mut __m256, y: &mut __m256) { |
| 16 | // CHECK-NOT: alloca | |
| 17 | // CHECK: load <8 x float>{{.+}}align 32 | |
| 18 | // CHECK: store <8 x float>{{.+}}align 32 | |
| 16 | // CHECK-NOT: alloca | |
| 17 | // CHECK: load <8 x float>{{.+}}align 32 | |
| 18 | // CHECK: store <8 x float>{{.+}}align 32 | |
| 19 | 19 | swap(x, y) |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | // CHECK-LABEL: @swap_m256_slice |
| 23 | 23 | #[no_mangle] |
| 24 | 24 | pub fn swap_m256_slice(x: &mut [__m256], y: &mut [__m256]) { |
| 25 | // CHECK-NOT: alloca | |
| 26 | // CHECK: load <8 x float>{{.+}}align 32 | |
| 27 | // CHECK: store <8 x float>{{.+}}align 32 | |
| 25 | // CHECK-NOT: alloca | |
| 26 | // CHECK: load <8 x float>{{.+}}align 32 | |
| 27 | // CHECK: store <8 x float>{{.+}}align 32 | |
| 28 | 28 | if x.len() == y.len() { |
| 29 | 29 | x.swap_with_slice(y); |
| 30 | 30 | } |
| ... | ... | @@ -33,8 +33,8 @@ pub fn swap_m256_slice(x: &mut [__m256], y: &mut [__m256]) { |
| 33 | 33 | // CHECK-LABEL: @swap_bytes32 |
| 34 | 34 | #[no_mangle] |
| 35 | 35 | pub fn swap_bytes32(x: &mut [u8; 32], y: &mut [u8; 32]) { |
| 36 | // CHECK-NOT: alloca | |
| 37 | // CHECK: load <32 x i8>{{.+}}align 1 | |
| 38 | // CHECK: store <32 x i8>{{.+}}align 1 | |
| 36 | // CHECK-NOT: alloca | |
| 37 | // CHECK: load <32 x i8>{{.+}}align 1 | |
| 38 | // CHECK: store <32 x i8>{{.+}}align 1 | |
| 39 | 39 | swap(x, y) |
| 40 | 40 | } |
tests/codegen/slice-position-bounds-check.rs+2-8| ... | ... | @@ -3,9 +3,7 @@ |
| 3 | 3 | |
| 4 | 4 | fn search<T: Ord + Eq>(arr: &mut [T], a: &T) -> Result<usize, ()> { |
| 5 | 5 | match arr.iter().position(|x| x == a) { |
| 6 | Some(p) => { | |
| 7 | Ok(p) | |
| 8 | }, | |
| 6 | Some(p) => Ok(p), | |
| 9 | 7 | None => Err(()), |
| 10 | 8 | } |
| 11 | 9 | } |
| ... | ... | @@ -15,11 +13,7 @@ fn search<T: Ord + Eq>(arr: &mut [T], a: &T) -> Result<usize, ()> { |
| 15 | 13 | pub fn position_no_bounds_check(y: &mut [u32], x: &u32, z: &u32) -> bool { |
| 16 | 14 | // This contains "call assume" so we cannot just rule out all calls |
| 17 | 15 | // CHECK-NOT: panic_bounds_check |
| 18 | if let Ok(p) = search(y, x) { | |
| 19 | y[p] == *z | |
| 20 | } else { | |
| 21 | false | |
| 22 | } | |
| 16 | if let Ok(p) = search(y, x) { y[p] == *z } else { false } | |
| 23 | 17 | } |
| 24 | 18 | |
| 25 | 19 | // just to make sure that panicking really emits "panic_bounds_check" somewhere in the IR |
tests/codegen/slice-windows-no-bounds-check.rs+1-4| ... | ... | @@ -12,10 +12,7 @@ pub fn naive_string_search(haystack: &str, needle: &str) -> Option<usize> { |
| 12 | 12 | } |
| 13 | 13 | // CHECK-NOT: panic |
| 14 | 14 | // CHECK-NOT: fail |
| 15 | haystack | |
| 16 | .as_bytes() | |
| 17 | .windows(needle.len()) | |
| 18 | .position(|sub| sub == needle.as_bytes()) | |
| 15 | haystack.as_bytes().windows(needle.len()).position(|sub| sub == needle.as_bytes()) | |
| 19 | 16 | } |
| 20 | 17 | |
| 21 | 18 | // CHECK-LABEL: @next |
tests/codegen/some-abis-do-extend-params-to-32-bits.rs+54-19| ... | ... | @@ -24,9 +24,12 @@ |
| 24 | 24 | #![no_std] |
| 25 | 25 | #![no_core] |
| 26 | 26 | |
| 27 | #[lang="sized"] trait Sized { } | |
| 28 | #[lang="freeze"] trait Freeze { } | |
| 29 | #[lang="copy"] trait Copy { } | |
| 27 | #[lang = "sized"] | |
| 28 | trait Sized {} | |
| 29 | #[lang = "freeze"] | |
| 30 | trait Freeze {} | |
| 31 | #[lang = "copy"] | |
| 32 | trait Copy {} | |
| 30 | 33 | |
| 31 | 34 | // The patterns in this file are written in the style of a table to make the |
| 32 | 35 | // uniformities and distinctions more apparent. |
| ... | ... | @@ -40,7 +43,8 @@ |
| 40 | 43 | // aarch64-linux: void @c_arg_u8(i8 %_a) |
| 41 | 44 | // arm: void @c_arg_u8(i8 zeroext %_a) |
| 42 | 45 | // riscv: void @c_arg_u8(i8 zeroext %_a) |
| 43 | #[no_mangle] pub extern "C" fn c_arg_u8(_a: u8) { } | |
| 46 | #[no_mangle] | |
| 47 | pub extern "C" fn c_arg_u8(_a: u8) {} | |
| 44 | 48 | |
| 45 | 49 | // x86_64: void @c_arg_u16(i16 zeroext %_a) |
| 46 | 50 | // i686: void @c_arg_u16(i16 zeroext %_a) |
| ... | ... | @@ -49,7 +53,8 @@ |
| 49 | 53 | // aarch64-linux: void @c_arg_u16(i16 %_a) |
| 50 | 54 | // arm: void @c_arg_u16(i16 zeroext %_a) |
| 51 | 55 | // riscv: void @c_arg_u16(i16 zeroext %_a) |
| 52 | #[no_mangle] pub extern "C" fn c_arg_u16(_a: u16) { } | |
| 56 | #[no_mangle] | |
| 57 | pub extern "C" fn c_arg_u16(_a: u16) {} | |
| 53 | 58 | |
| 54 | 59 | // x86_64: void @c_arg_u32(i32 %_a) |
| 55 | 60 | // i686: void @c_arg_u32(i32 %_a) |
| ... | ... | @@ -58,7 +63,8 @@ |
| 58 | 63 | // aarch64-linux: void @c_arg_u32(i32 %_a) |
| 59 | 64 | // arm: void @c_arg_u32(i32 %_a) |
| 60 | 65 | // riscv: void @c_arg_u32(i32 signext %_a) |
| 61 | #[no_mangle] pub extern "C" fn c_arg_u32(_a: u32) { } | |
| 66 | #[no_mangle] | |
| 67 | pub extern "C" fn c_arg_u32(_a: u32) {} | |
| 62 | 68 | |
| 63 | 69 | // x86_64: void @c_arg_u64(i64 %_a) |
| 64 | 70 | // i686: void @c_arg_u64(i64 %_a) |
| ... | ... | @@ -67,7 +73,8 @@ |
| 67 | 73 | // aarch64-linux: void @c_arg_u64(i64 %_a) |
| 68 | 74 | // arm: void @c_arg_u64(i64 %_a) |
| 69 | 75 | // riscv: void @c_arg_u64(i64 %_a) |
| 70 | #[no_mangle] pub extern "C" fn c_arg_u64(_a: u64) { } | |
| 76 | #[no_mangle] | |
| 77 | pub extern "C" fn c_arg_u64(_a: u64) {} | |
| 71 | 78 | |
| 72 | 79 | // x86_64: void @c_arg_i8(i8 signext %_a) |
| 73 | 80 | // i686: void @c_arg_i8(i8 signext %_a) |
| ... | ... | @@ -76,7 +83,8 @@ |
| 76 | 83 | // aarch64-linux: void @c_arg_i8(i8 %_a) |
| 77 | 84 | // arm: void @c_arg_i8(i8 signext %_a) |
| 78 | 85 | // riscv: void @c_arg_i8(i8 signext %_a) |
| 79 | #[no_mangle] pub extern "C" fn c_arg_i8(_a: i8) { } | |
| 86 | #[no_mangle] | |
| 87 | pub extern "C" fn c_arg_i8(_a: i8) {} | |
| 80 | 88 | |
| 81 | 89 | // x86_64: void @c_arg_i16(i16 signext %_a) |
| 82 | 90 | // i686: void @c_arg_i16(i16 signext %_a) |
| ... | ... | @@ -85,7 +93,8 @@ |
| 85 | 93 | // aarch64-linux: void @c_arg_i16(i16 %_a) |
| 86 | 94 | // arm: void @c_arg_i16(i16 signext %_a) |
| 87 | 95 | // riscv: void @c_arg_i16(i16 signext %_a) |
| 88 | #[no_mangle] pub extern "C" fn c_arg_i16(_a: i16) { } | |
| 96 | #[no_mangle] | |
| 97 | pub extern "C" fn c_arg_i16(_a: i16) {} | |
| 89 | 98 | |
| 90 | 99 | // x86_64: void @c_arg_i32(i32 %_a) |
| 91 | 100 | // i686: void @c_arg_i32(i32 %_a) |
| ... | ... | @@ -94,7 +103,8 @@ |
| 94 | 103 | // aarch64-linux: void @c_arg_i32(i32 %_a) |
| 95 | 104 | // arm: void @c_arg_i32(i32 %_a) |
| 96 | 105 | // riscv: void @c_arg_i32(i32 signext %_a) |
| 97 | #[no_mangle] pub extern "C" fn c_arg_i32(_a: i32) { } | |
| 106 | #[no_mangle] | |
| 107 | pub extern "C" fn c_arg_i32(_a: i32) {} | |
| 98 | 108 | |
| 99 | 109 | // x86_64: void @c_arg_i64(i64 %_a) |
| 100 | 110 | // i686: void @c_arg_i64(i64 %_a) |
| ... | ... | @@ -103,7 +113,8 @@ |
| 103 | 113 | // aarch64-linux: void @c_arg_i64(i64 %_a) |
| 104 | 114 | // arm: void @c_arg_i64(i64 %_a) |
| 105 | 115 | // riscv: void @c_arg_i64(i64 %_a) |
| 106 | #[no_mangle] pub extern "C" fn c_arg_i64(_a: i64) { } | |
| 116 | #[no_mangle] | |
| 117 | pub extern "C" fn c_arg_i64(_a: i64) {} | |
| 107 | 118 | |
| 108 | 119 | // x86_64: zeroext i8 @c_ret_u8() |
| 109 | 120 | // i686: zeroext i8 @c_ret_u8() |
| ... | ... | @@ -112,7 +123,10 @@ |
| 112 | 123 | // aarch64-linux: i8 @c_ret_u8() |
| 113 | 124 | // arm: zeroext i8 @c_ret_u8() |
| 114 | 125 | // riscv: zeroext i8 @c_ret_u8() |
| 115 | #[no_mangle] pub extern "C" fn c_ret_u8() -> u8 { 0 } | |
| 126 | #[no_mangle] | |
| 127 | pub extern "C" fn c_ret_u8() -> u8 { | |
| 128 | 0 | |
| 129 | } | |
| 116 | 130 | |
| 117 | 131 | // x86_64: zeroext i16 @c_ret_u16() |
| 118 | 132 | // i686: zeroext i16 @c_ret_u16() |
| ... | ... | @@ -121,7 +135,10 @@ |
| 121 | 135 | // aarch64-linux: i16 @c_ret_u16() |
| 122 | 136 | // arm: zeroext i16 @c_ret_u16() |
| 123 | 137 | // riscv: zeroext i16 @c_ret_u16() |
| 124 | #[no_mangle] pub extern "C" fn c_ret_u16() -> u16 { 0 } | |
| 138 | #[no_mangle] | |
| 139 | pub extern "C" fn c_ret_u16() -> u16 { | |
| 140 | 0 | |
| 141 | } | |
| 125 | 142 | |
| 126 | 143 | // x86_64: i32 @c_ret_u32() |
| 127 | 144 | // i686: i32 @c_ret_u32() |
| ... | ... | @@ -130,7 +147,10 @@ |
| 130 | 147 | // aarch64-linux: i32 @c_ret_u32() |
| 131 | 148 | // arm: i32 @c_ret_u32() |
| 132 | 149 | // riscv: signext i32 @c_ret_u32() |
| 133 | #[no_mangle] pub extern "C" fn c_ret_u32() -> u32 { 0 } | |
| 150 | #[no_mangle] | |
| 151 | pub extern "C" fn c_ret_u32() -> u32 { | |
| 152 | 0 | |
| 153 | } | |
| 134 | 154 | |
| 135 | 155 | // x86_64: i64 @c_ret_u64() |
| 136 | 156 | // i686: i64 @c_ret_u64() |
| ... | ... | @@ -139,7 +159,10 @@ |
| 139 | 159 | // aarch64-linux: i64 @c_ret_u64() |
| 140 | 160 | // arm: i64 @c_ret_u64() |
| 141 | 161 | // riscv: i64 @c_ret_u64() |
| 142 | #[no_mangle] pub extern "C" fn c_ret_u64() -> u64 { 0 } | |
| 162 | #[no_mangle] | |
| 163 | pub extern "C" fn c_ret_u64() -> u64 { | |
| 164 | 0 | |
| 165 | } | |
| 143 | 166 | |
| 144 | 167 | // x86_64: signext i8 @c_ret_i8() |
| 145 | 168 | // i686: signext i8 @c_ret_i8() |
| ... | ... | @@ -148,7 +171,10 @@ |
| 148 | 171 | // aarch64-linux: i8 @c_ret_i8() |
| 149 | 172 | // arm: signext i8 @c_ret_i8() |
| 150 | 173 | // riscv: signext i8 @c_ret_i8() |
| 151 | #[no_mangle] pub extern "C" fn c_ret_i8() -> i8 { 0 } | |
| 174 | #[no_mangle] | |
| 175 | pub extern "C" fn c_ret_i8() -> i8 { | |
| 176 | 0 | |
| 177 | } | |
| 152 | 178 | |
| 153 | 179 | // x86_64: signext i16 @c_ret_i16() |
| 154 | 180 | // i686: signext i16 @c_ret_i16() |
| ... | ... | @@ -157,7 +183,10 @@ |
| 157 | 183 | // aarch64-linux: i16 @c_ret_i16() |
| 158 | 184 | // arm: signext i16 @c_ret_i16() |
| 159 | 185 | // riscv: signext i16 @c_ret_i16() |
| 160 | #[no_mangle] pub extern "C" fn c_ret_i16() -> i16 { 0 } | |
| 186 | #[no_mangle] | |
| 187 | pub extern "C" fn c_ret_i16() -> i16 { | |
| 188 | 0 | |
| 189 | } | |
| 161 | 190 | |
| 162 | 191 | // x86_64: i32 @c_ret_i32() |
| 163 | 192 | // i686: i32 @c_ret_i32() |
| ... | ... | @@ -166,7 +195,10 @@ |
| 166 | 195 | // aarch64-linux: i32 @c_ret_i32() |
| 167 | 196 | // arm: i32 @c_ret_i32() |
| 168 | 197 | // riscv: signext i32 @c_ret_i32() |
| 169 | #[no_mangle] pub extern "C" fn c_ret_i32() -> i32 { 0 } | |
| 198 | #[no_mangle] | |
| 199 | pub extern "C" fn c_ret_i32() -> i32 { | |
| 200 | 0 | |
| 201 | } | |
| 170 | 202 | |
| 171 | 203 | // x86_64: i64 @c_ret_i64() |
| 172 | 204 | // i686: i64 @c_ret_i64() |
| ... | ... | @@ -175,7 +207,10 @@ |
| 175 | 207 | // aarch64-linux: i64 @c_ret_i64() |
| 176 | 208 | // arm: i64 @c_ret_i64() |
| 177 | 209 | // riscv: i64 @c_ret_i64() |
| 178 | #[no_mangle] pub extern "C" fn c_ret_i64() -> i64 { 0 } | |
| 210 | #[no_mangle] | |
| 211 | pub extern "C" fn c_ret_i64() -> i64 { | |
| 212 | 0 | |
| 213 | } | |
| 179 | 214 | |
| 180 | 215 | const C_SOURCE_FILE: &'static str = r##" |
| 181 | 216 | #include <stdlib.h> |
tests/codegen/sparc-struct-abi.rs+8-11| ... | ... | @@ -6,12 +6,12 @@ |
| 6 | 6 | #![feature(no_core, lang_items)] |
| 7 | 7 | #![no_core] |
| 8 | 8 | |
| 9 | #[lang="sized"] | |
| 10 | trait Sized { } | |
| 11 | #[lang="freeze"] | |
| 12 | trait Freeze { } | |
| 13 | #[lang="copy"] | |
| 14 | trait Copy { } | |
| 9 | #[lang = "sized"] | |
| 10 | trait Sized {} | |
| 11 | #[lang = "freeze"] | |
| 12 | trait Freeze {} | |
| 13 | #[lang = "copy"] | |
| 14 | trait Copy {} | |
| 15 | 15 | |
| 16 | 16 | #[repr(C)] |
| 17 | 17 | pub struct Bool { |
| ... | ... | @@ -26,7 +26,6 @@ pub extern "C" fn structbool() -> Bool { |
| 26 | 26 | Bool { b: true } |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | ||
| 30 | 29 | #[repr(C)] |
| 31 | 30 | pub struct BoolFloat { |
| 32 | 31 | b: bool, |
| ... | ... | @@ -44,8 +43,7 @@ pub extern "C" fn structboolfloat() -> BoolFloat { |
| 44 | 43 | // CHECK: define void @structboolfloat_input({ i32, float } inreg %0) |
| 45 | 44 | // CHECK-NEXT: start: |
| 46 | 45 | #[no_mangle] |
| 47 | pub extern "C" fn structboolfloat_input(a: BoolFloat) { } | |
| 48 | ||
| 46 | pub extern "C" fn structboolfloat_input(a: BoolFloat) {} | |
| 49 | 47 | |
| 50 | 48 | #[repr(C)] |
| 51 | 49 | pub struct ShortDouble { |
| ... | ... | @@ -64,8 +62,7 @@ pub extern "C" fn structshortdouble() -> ShortDouble { |
| 64 | 62 | // CHECK: define void @structshortdouble_input({ i64, double } %0) |
| 65 | 63 | // CHECK-NEXT: start: |
| 66 | 64 | #[no_mangle] |
| 67 | pub extern "C" fn structshortdouble_input(a: ShortDouble) { } | |
| 68 | ||
| 65 | pub extern "C" fn structshortdouble_input(a: ShortDouble) {} | |
| 69 | 66 | |
| 70 | 67 | #[repr(C)] |
| 71 | 68 | pub struct FloatLongFloat { |
tests/codegen/split-lto-unit.rs+2-3| ... | ... | @@ -3,9 +3,8 @@ |
| 3 | 3 | //@ needs-sanitizer-cfi |
| 4 | 4 | //@ compile-flags: -Clto -Ctarget-feature=-crt-static -Zsplit-lto-unit |
| 5 | 5 | |
| 6 | #![crate_type="lib"] | |
| 6 | #![crate_type = "lib"] | |
| 7 | 7 | |
| 8 | pub fn foo() { | |
| 9 | } | |
| 8 | pub fn foo() {} | |
| 10 | 9 | |
| 11 | 10 | // CHECK: !{{[0-9]+}} = !{i32 4, !"EnableSplitLTOUnit", i32 1} |
tests/codegen/sroa-fragment-debuginfo.rs+11-11| ... | ... | @@ -13,13 +13,13 @@ pub struct ExtraSlice<'input> { |
| 13 | 13 | |
| 14 | 14 | #[no_mangle] |
| 15 | 15 | pub fn extra(s: &[u8]) { |
| 16 | // CHECK: void @extra( | |
| 17 | // CHECK: %slice.dbg.spill1 = alloca [4 x i8], | |
| 18 | // CHECK: %slice.dbg.spill = alloca [16 x i8], | |
| 19 | // CHECK: %s.dbg.spill = alloca [16 x i8], | |
| 20 | // CHECK: dbg{{.}}declare({{(metadata )?}}ptr %s.dbg.spill, {{(metadata )?}}![[S_EXTRA:.*]], {{(metadata )?}}!DIExpression() | |
| 21 | // CHECK: dbg{{.}}declare({{(metadata )?}}ptr %slice.dbg.spill, {{(metadata )?}}![[SLICE_EXTRA:.*]], {{(metadata )?}}!DIExpression(DW_OP_LLVM_fragment, 0, 128) | |
| 22 | // CHECK: dbg{{.}}declare({{(metadata )?}}ptr %slice.dbg.spill1, {{(metadata )?}}![[SLICE_EXTRA]], {{(metadata )?}}!DIExpression(DW_OP_LLVM_fragment, 128, 32) | |
| 16 | // CHECK: void @extra( | |
| 17 | // CHECK: %slice.dbg.spill1 = alloca [4 x i8], | |
| 18 | // CHECK: %slice.dbg.spill = alloca [16 x i8], | |
| 19 | // CHECK: %s.dbg.spill = alloca [16 x i8], | |
| 20 | // CHECK: dbg{{.}}declare({{(metadata )?}}ptr %s.dbg.spill, {{(metadata )?}}![[S_EXTRA:.*]], {{(metadata )?}}!DIExpression() | |
| 21 | // CHECK: dbg{{.}}declare({{(metadata )?}}ptr %slice.dbg.spill, {{(metadata )?}}![[SLICE_EXTRA:.*]], {{(metadata )?}}!DIExpression(DW_OP_LLVM_fragment, 0, 128) | |
| 22 | // CHECK: dbg{{.}}declare({{(metadata )?}}ptr %slice.dbg.spill1, {{(metadata )?}}![[SLICE_EXTRA]], {{(metadata )?}}!DIExpression(DW_OP_LLVM_fragment, 128, 32) | |
| 23 | 23 | let slice = ExtraSlice { slice: s, extra: s.len() as u32 }; |
| 24 | 24 | } |
| 25 | 25 | |
| ... | ... | @@ -35,10 +35,10 @@ pub fn zst(s: &[u8]) { |
| 35 | 35 | // The field `extra` is a ZST. The fragment for the field `slice` encompasses the whole |
| 36 | 36 | // variable, so is not a fragment. In that case, the variable must have no fragment. |
| 37 | 37 | |
| 38 | // CHECK: void @zst( | |
| 39 | // CHECK-NOT: dbg{{.}}declare({{(metadata )?}}ptr %slice.dbg.spill, {{(metadata )?}}!{}, {{(metadata )?}}!DIExpression(DW_OP_LLVM_fragment, | |
| 40 | // CHECK: dbg{{.}}declare({{(metadata )?}}ptr %{{.*}}, {{(metadata )?}}![[SLICE_ZST:.*]], {{(metadata )?}}!DIExpression() | |
| 41 | // CHECK-NOT: dbg{{.}}declare({{(metadata )?}}ptr %{{.*}}, {{(metadata )?}}![[SLICE_ZST]], | |
| 38 | // CHECK: void @zst( | |
| 39 | // CHECK-NOT: dbg{{.}}declare({{(metadata )?}}ptr %slice.dbg.spill, {{(metadata )?}}!{}, {{(metadata )?}}!DIExpression(DW_OP_LLVM_fragment, | |
| 40 | // CHECK: dbg{{.}}declare({{(metadata )?}}ptr %{{.*}}, {{(metadata )?}}![[SLICE_ZST:.*]], {{(metadata )?}}!DIExpression() | |
| 41 | // CHECK-NOT: dbg{{.}}declare({{(metadata )?}}ptr %{{.*}}, {{(metadata )?}}![[SLICE_ZST]], | |
| 42 | 42 | let slice = ZstSlice { slice: s, extra: Zst }; |
| 43 | 43 | } |
| 44 | 44 |
tests/codegen/stack-probes-inline.rs+2-2| ... | ... | @@ -27,6 +27,6 @@ trait Sized {} |
| 27 | 27 | |
| 28 | 28 | #[no_mangle] |
| 29 | 29 | pub fn foo() { |
| 30 | // CHECK: @foo() unnamed_addr #0 | |
| 31 | // CHECK: attributes #0 = { {{.*}}"probe-stack"="inline-asm"{{.*}} } | |
| 30 | // CHECK: @foo() unnamed_addr #0 | |
| 31 | // CHECK: attributes #0 = { {{.*}}"probe-stack"="inline-asm"{{.*}} } | |
| 32 | 32 | } |
tests/codegen/static-relocation-model-msvc.rs+1-3| ... | ... | @@ -20,7 +20,5 @@ extern crate extern_decl; |
| 20 | 20 | |
| 21 | 21 | #[no_mangle] |
| 22 | 22 | pub fn access_extern() -> u8 { |
| 23 | unsafe { | |
| 24 | extern_decl::extern_fn() + extern_decl::extern_static | |
| 25 | } | |
| 23 | unsafe { extern_decl::extern_fn() + extern_decl::extern_static } | |
| 26 | 24 | } |
tests/codegen/stores.rs+12-12| ... | ... | @@ -4,10 +4,10 @@ |
| 4 | 4 | #![crate_type = "lib"] |
| 5 | 5 | |
| 6 | 6 | pub struct Bytes { |
| 7 | a: u8, | |
| 8 | b: u8, | |
| 9 | c: u8, | |
| 10 | d: u8, | |
| 7 | a: u8, | |
| 8 | b: u8, | |
| 9 | c: u8, | |
| 10 | d: u8, | |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | // CHECK-LABEL: small_array_alignment |
| ... | ... | @@ -15,10 +15,10 @@ pub struct Bytes { |
| 15 | 15 | // dependent alignment |
| 16 | 16 | #[no_mangle] |
| 17 | 17 | pub fn small_array_alignment(x: &mut [i8; 4], y: [i8; 4]) { |
| 18 | // CHECK: [[TMP:%.+]] = alloca [4 x i8], align 4 | |
| 19 | // CHECK: %y = alloca [4 x i8], align 1 | |
| 20 | // CHECK: store i32 %0, ptr [[TMP]] | |
| 21 | // CHECK: call void @llvm.memcpy.{{.*}}(ptr align 1 {{.+}}, ptr align 4 {{.+}}, i{{[0-9]+}} 4, i1 false) | |
| 18 | // CHECK: [[TMP:%.+]] = alloca [4 x i8], align 4 | |
| 19 | // CHECK: %y = alloca [4 x i8], align 1 | |
| 20 | // CHECK: store i32 %0, ptr [[TMP]] | |
| 21 | // CHECK: call void @llvm.memcpy.{{.*}}(ptr align 1 {{.+}}, ptr align 4 {{.+}}, i{{[0-9]+}} 4, i1 false) | |
| 22 | 22 | *x = y; |
| 23 | 23 | } |
| 24 | 24 | |
| ... | ... | @@ -27,9 +27,9 @@ pub fn small_array_alignment(x: &mut [i8; 4], y: [i8; 4]) { |
| 27 | 27 | // dependent alignment |
| 28 | 28 | #[no_mangle] |
| 29 | 29 | pub fn small_struct_alignment(x: &mut Bytes, y: Bytes) { |
| 30 | // CHECK: [[TMP:%.+]] = alloca [4 x i8], align 4 | |
| 31 | // CHECK: %y = alloca [4 x i8], align 1 | |
| 32 | // CHECK: store i32 %0, ptr [[TMP]] | |
| 33 | // CHECK: call void @llvm.memcpy.{{.*}}(ptr align 1 {{.+}}, ptr align 4 {{.+}}, i{{[0-9]+}} 4, i1 false) | |
| 30 | // CHECK: [[TMP:%.+]] = alloca [4 x i8], align 4 | |
| 31 | // CHECK: %y = alloca [4 x i8], align 1 | |
| 32 | // CHECK: store i32 %0, ptr [[TMP]] | |
| 33 | // CHECK: call void @llvm.memcpy.{{.*}}(ptr align 1 {{.+}}, ptr align 4 {{.+}}, i{{[0-9]+}} 4, i1 false) | |
| 34 | 34 | *x = y; |
| 35 | 35 | } |
tests/codegen/swap-large-types.rs+16-16| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | #![crate_type = "lib"] |
| 5 | 5 | |
| 6 | 6 | use std::mem::swap; |
| 7 | use std::ptr::{read, copy_nonoverlapping, write}; | |
| 7 | use std::ptr::{copy_nonoverlapping, read, write}; | |
| 8 | 8 | |
| 9 | 9 | type KeccakBuffer = [[u64; 5]; 5]; |
| 10 | 10 | |
| ... | ... | @@ -15,7 +15,7 @@ type KeccakBuffer = [[u64; 5]; 5]; |
| 15 | 15 | // CHECK-LABEL: @swap_basic |
| 16 | 16 | #[no_mangle] |
| 17 | 17 | pub fn swap_basic(x: &mut KeccakBuffer, y: &mut KeccakBuffer) { |
| 18 | // CHECK: alloca [200 x i8] | |
| 18 | // CHECK: alloca [200 x i8] | |
| 19 | 19 | |
| 20 | 20 | // SAFETY: exclusive references are always valid to read/write, |
| 21 | 21 | // 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) { |
| 32 | 32 | // CHECK-LABEL: @swap_std |
| 33 | 33 | #[no_mangle] |
| 34 | 34 | pub fn swap_std(x: &mut KeccakBuffer, y: &mut KeccakBuffer) { |
| 35 | // CHECK-NOT: alloca | |
| 36 | // CHECK: load <{{[0-9]+}} x i64> | |
| 37 | // CHECK: store <{{[0-9]+}} x i64> | |
| 35 | // CHECK-NOT: alloca | |
| 36 | // CHECK: load <{{[0-9]+}} x i64> | |
| 37 | // CHECK: store <{{[0-9]+}} x i64> | |
| 38 | 38 | swap(x, y) |
| 39 | 39 | } |
| 40 | 40 | |
| ... | ... | @@ -44,9 +44,9 @@ pub fn swap_std(x: &mut KeccakBuffer, y: &mut KeccakBuffer) { |
| 44 | 44 | // CHECK-LABEL: @swap_slice |
| 45 | 45 | #[no_mangle] |
| 46 | 46 | pub fn swap_slice(x: &mut [KeccakBuffer], y: &mut [KeccakBuffer]) { |
| 47 | // CHECK-NOT: alloca | |
| 48 | // CHECK: load <{{[0-9]+}} x i64> | |
| 49 | // CHECK: store <{{[0-9]+}} x i64> | |
| 47 | // CHECK-NOT: alloca | |
| 48 | // CHECK: load <{{[0-9]+}} x i64> | |
| 49 | // CHECK: store <{{[0-9]+}} x i64> | |
| 50 | 50 | if x.len() == y.len() { |
| 51 | 51 | x.swap_with_slice(y); |
| 52 | 52 | } |
| ... | ... | @@ -59,9 +59,9 @@ type OneKilobyteBuffer = [u8; 1024]; |
| 59 | 59 | // CHECK-LABEL: @swap_1kb_slices |
| 60 | 60 | #[no_mangle] |
| 61 | 61 | pub fn swap_1kb_slices(x: &mut [OneKilobyteBuffer], y: &mut [OneKilobyteBuffer]) { |
| 62 | // CHECK-NOT: alloca | |
| 63 | // CHECK: load <{{[0-9]+}} x i8> | |
| 64 | // CHECK: store <{{[0-9]+}} x i8> | |
| 62 | // CHECK-NOT: alloca | |
| 63 | // CHECK: load <{{[0-9]+}} x i8> | |
| 64 | // CHECK: store <{{[0-9]+}} x i8> | |
| 65 | 65 | if x.len() == y.len() { |
| 66 | 66 | x.swap_with_slice(y); |
| 67 | 67 | } |
| ... | ... | @@ -81,10 +81,10 @@ pub struct BigButHighlyAligned([u8; 64 * 3]); |
| 81 | 81 | // CHECK-LABEL: @swap_big_aligned |
| 82 | 82 | #[no_mangle] |
| 83 | 83 | pub fn swap_big_aligned(x: &mut BigButHighlyAligned, y: &mut BigButHighlyAligned) { |
| 84 | // CHECK-NOT: call void @llvm.memcpy | |
| 85 | // CHECK: call void @llvm.memcpy.{{.+}}(ptr noundef nonnull align 64 dereferenceable(192) | |
| 86 | // CHECK: call void @llvm.memcpy.{{.+}}(ptr noundef nonnull align 64 dereferenceable(192) | |
| 87 | // CHECK: call void @llvm.memcpy.{{.+}}(ptr noundef nonnull align 64 dereferenceable(192) | |
| 88 | // CHECK-NOT: call void @llvm.memcpy | |
| 84 | // CHECK-NOT: call void @llvm.memcpy | |
| 85 | // CHECK: call void @llvm.memcpy.{{.+}}(ptr noundef nonnull align 64 dereferenceable(192) | |
| 86 | // CHECK: call void @llvm.memcpy.{{.+}}(ptr noundef nonnull align 64 dereferenceable(192) | |
| 87 | // CHECK: call void @llvm.memcpy.{{.+}}(ptr noundef nonnull align 64 dereferenceable(192) | |
| 88 | // CHECK-NOT: call void @llvm.memcpy | |
| 89 | 89 | swap(x, y) |
| 90 | 90 | } |
tests/codegen/target-feature-overrides.rs+7-8| ... | ... | @@ -9,7 +9,6 @@ |
| 9 | 9 | #![crate_type = "lib"] |
| 10 | 10 | #![no_core] |
| 11 | 11 | |
| 12 | ||
| 13 | 12 | #[lang = "sized"] |
| 14 | 13 | trait Sized {} |
| 15 | 14 | #[lang = "copy"] |
| ... | ... | @@ -23,19 +22,19 @@ extern "C" { |
| 23 | 22 | #[target_feature(enable = "avx")] |
| 24 | 23 | #[no_mangle] |
| 25 | 24 | pub unsafe fn apple() -> u32 { |
| 26 | // CHECK-LABEL: @apple() | |
| 27 | // CHECK-SAME: [[APPLEATTRS:#[0-9]+]] { | |
| 28 | // CHECK: {{.*}}call{{.*}}@peach | |
| 25 | // CHECK-LABEL: @apple() | |
| 26 | // CHECK-SAME: [[APPLEATTRS:#[0-9]+]] { | |
| 27 | // CHECK: {{.*}}call{{.*}}@peach | |
| 29 | 28 | peach() |
| 30 | 29 | } |
| 31 | 30 | |
| 32 | 31 | // target features same as global |
| 33 | 32 | #[no_mangle] |
| 34 | 33 | pub unsafe fn banana() -> u32 { |
| 35 | // CHECK-LABEL: @banana() | |
| 36 | // CHECK-SAME: [[BANANAATTRS:#[0-9]+]] { | |
| 37 | // COMPAT: {{.*}}call{{.*}}@peach | |
| 38 | // INCOMPAT: {{.*}}call{{.*}}@apple | |
| 34 | // CHECK-LABEL: @banana() | |
| 35 | // CHECK-SAME: [[BANANAATTRS:#[0-9]+]] { | |
| 36 | // COMPAT: {{.*}}call{{.*}}@peach | |
| 37 | // INCOMPAT: {{.*}}call{{.*}}@apple | |
| 39 | 38 | apple() // Compatible for inline in COMPAT revision and can't be inlined in INCOMPAT |
| 40 | 39 | } |
| 41 | 40 |
tests/codegen/thin-lto.rs+1-2| ... | ... | @@ -3,5 +3,4 @@ |
| 3 | 3 | |
| 4 | 4 | // CHECK: main |
| 5 | 5 | |
| 6 | pub fn main() { | |
| 7 | } | |
| 6 | pub fn main() {} |
tests/codegen/tied-features-strength.rs-1| ... | ... | @@ -19,7 +19,6 @@ |
| 19 | 19 | //@ [ENABLE_NEON] compile-flags: -C target-feature=+neon -Copt-level=0 |
| 20 | 20 | // ENABLE_NEON: attributes #0 = { {{.*}} "target-features"="{{((\+outline-atomics,?)|(\+v8a,?)?|(\+fp-armv8,?)|(\+neon,?))*}}" } |
| 21 | 21 | |
| 22 | ||
| 23 | 22 | #![feature(no_core, lang_items)] |
| 24 | 23 | #![no_core] |
| 25 | 24 |
tests/codegen/to_vec.rs+2-2| ... | ... | @@ -5,6 +5,6 @@ |
| 5 | 5 | // CHECK-LABEL: @copy_to_vec |
| 6 | 6 | #[no_mangle] |
| 7 | 7 | fn copy_to_vec(s: &[u64]) -> Vec<u64> { |
| 8 | s.to_vec() | |
| 9 | // CHECK: call void @llvm.memcpy | |
| 8 | s.to_vec() | |
| 9 | // CHECK: call void @llvm.memcpy | |
| 10 | 10 | } |
tests/codegen/transmute-optimized.rs+8-2| ... | ... | @@ -5,7 +5,9 @@ |
| 5 | 5 | // destination types for transmutes. |
| 6 | 6 | |
| 7 | 7 | #[repr(u32)] |
| 8 | pub enum AlwaysZero32 { X = 0 } | |
| 8 | pub enum AlwaysZero32 { | |
| 9 | X = 0, | |
| 10 | } | |
| 9 | 11 | |
| 10 | 12 | // CHECK-LABEL: i32 @issue_109958(i32 |
| 11 | 13 | #[no_mangle] |
| ... | ... | @@ -81,7 +83,11 @@ pub fn div_transmute_nonzero(a: u32, b: std::num::NonZero<i32>) -> u32 { |
| 81 | 83 | } |
| 82 | 84 | |
| 83 | 85 | #[repr(i8)] |
| 84 | pub enum OneTwoThree { One = 1, Two = 2, Three = 3 } | |
| 86 | pub enum OneTwoThree { | |
| 87 | One = 1, | |
| 88 | Two = 2, | |
| 89 | Three = 3, | |
| 90 | } | |
| 85 | 91 | |
| 86 | 92 | // CHECK-LABEL: i8 @ordering_transmute_onetwothree(i8 |
| 87 | 93 | #[no_mangle] |
tests/codegen/try_identity.rs+3-3| ... | ... | @@ -13,9 +13,9 @@ type R = Result<u64, i32>; |
| 13 | 13 | // optimization that picks up the `?` desugaring, as `SimplifyArmIdentity` does not. |
| 14 | 14 | #[no_mangle] |
| 15 | 15 | pub fn try_identity(x: R) -> R { |
| 16 | // CHECK: start: | |
| 17 | // FIXME(JakobDegen): Broken by deaggregation change CHECK-NOT\: br {{.*}} | |
| 18 | // CHECK ret void | |
| 16 | // CHECK: start: | |
| 17 | // FIXME(JakobDegen): Broken by deaggregation change CHECK-NOT\: br {{.*}} | |
| 18 | // CHECK ret void | |
| 19 | 19 | let y = match into_result(x) { |
| 20 | 20 | Err(e) => return from_error(From::from(e)), |
| 21 | 21 | Ok(v) => v, |
tests/codegen/try_question_mark_nop.rs+6-16| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | #![crate_type = "lib"] |
| 5 | 5 | #![feature(try_blocks)] |
| 6 | 6 | |
| 7 | use std::ops::ControlFlow::{self, Continue, Break}; | |
| 7 | use std::ops::ControlFlow::{self, Break, Continue}; | |
| 8 | 8 | use std::ptr::NonNull; |
| 9 | 9 | |
| 10 | 10 | // CHECK-LABEL: @option_nop_match_32 |
| ... | ... | @@ -27,9 +27,7 @@ pub fn option_nop_traits_32(x: Option<u32>) -> Option<u32> { |
| 27 | 27 | // CHECK-NEXT: insertvalue { i32, i32 } |
| 28 | 28 | // CHECK-NEXT: insertvalue { i32, i32 } |
| 29 | 29 | // CHECK-NEXT: ret { i32, i32 } |
| 30 | try { | |
| 31 | x? | |
| 32 | } | |
| 30 | try { x? } | |
| 33 | 31 | } |
| 34 | 32 | |
| 35 | 33 | // CHECK-LABEL: @result_nop_match_32 |
| ... | ... | @@ -52,9 +50,7 @@ pub fn result_nop_traits_32(x: Result<i32, u32>) -> Result<i32, u32> { |
| 52 | 50 | // CHECK-NEXT: insertvalue { i32, i32 } |
| 53 | 51 | // CHECK-NEXT: insertvalue { i32, i32 } |
| 54 | 52 | // CHECK-NEXT: ret { i32, i32 } |
| 55 | try { | |
| 56 | x? | |
| 57 | } | |
| 53 | try { x? } | |
| 58 | 54 | } |
| 59 | 55 | |
| 60 | 56 | // CHECK-LABEL: @result_nop_match_64 |
| ... | ... | @@ -77,9 +73,7 @@ pub fn result_nop_traits_64(x: Result<i64, u64>) -> Result<i64, u64> { |
| 77 | 73 | // CHECK-NEXT: insertvalue { i64, i64 } |
| 78 | 74 | // CHECK-NEXT: insertvalue { i64, i64 } |
| 79 | 75 | // CHECK-NEXT: ret { i64, i64 } |
| 80 | try { | |
| 81 | x? | |
| 82 | } | |
| 76 | try { x? } | |
| 83 | 77 | } |
| 84 | 78 | |
| 85 | 79 | // CHECK-LABEL: @result_nop_match_ptr |
| ... | ... | @@ -102,9 +96,7 @@ pub fn result_nop_traits_ptr(x: Result<u64, NonNull<()>>) -> Result<u64, NonNull |
| 102 | 96 | // CHECK-NEXT: insertvalue { i{{[0-9]+}}, ptr } |
| 103 | 97 | // CHECK-NEXT: insertvalue { i{{[0-9]+}}, ptr } |
| 104 | 98 | // CHECK-NEXT: ret |
| 105 | try { | |
| 106 | x? | |
| 107 | } | |
| 99 | try { x? } | |
| 108 | 100 | } |
| 109 | 101 | |
| 110 | 102 | // CHECK-LABEL: @control_flow_nop_match_32 |
| ... | ... | @@ -127,7 +119,5 @@ pub fn control_flow_nop_traits_32(x: ControlFlow<i32, u32>) -> ControlFlow<i32, |
| 127 | 119 | // CHECK-NEXT: insertvalue { i32, i32 } |
| 128 | 120 | // CHECK-NEXT: insertvalue { i32, i32 } |
| 129 | 121 | // CHECK-NEXT: ret { i32, i32 } |
| 130 | try { | |
| 131 | x? | |
| 132 | } | |
| 122 | try { x? } | |
| 133 | 123 | } |
tests/codegen/tune-cpu-on-functions.rs+1-1| ... | ... | @@ -9,7 +9,7 @@ |
| 9 | 9 | |
| 10 | 10 | // CHECK-LABEL: define {{.*}} @exported() {{.*}} #0 |
| 11 | 11 | #[no_mangle] |
| 12 | pub extern fn exported() { | |
| 12 | pub extern "C" fn exported() { | |
| 13 | 13 | not_exported(); |
| 14 | 14 | } |
| 15 | 15 |
tests/codegen/tuple-layout-opt.rs+19-7| ... | ... | @@ -2,34 +2,46 @@ |
| 2 | 2 | |
| 3 | 3 | // Test that tuples get optimized layout, in particular with a ZST in the last field (#63244) |
| 4 | 4 | |
| 5 | #![crate_type="lib"] | |
| 5 | #![crate_type = "lib"] | |
| 6 | 6 | |
| 7 | 7 | type ScalarZstLast = (u128, ()); |
| 8 | 8 | // CHECK: define {{(dso_local )?}}i128 @test_ScalarZstLast(i128 %_1) |
| 9 | 9 | #[no_mangle] |
| 10 | pub fn test_ScalarZstLast(_: ScalarZstLast) -> ScalarZstLast { loop {} } | |
| 10 | pub fn test_ScalarZstLast(_: ScalarZstLast) -> ScalarZstLast { | |
| 11 | loop {} | |
| 12 | } | |
| 11 | 13 | |
| 12 | 14 | type ScalarZstFirst = ((), u128); |
| 13 | 15 | // CHECK: define {{(dso_local )?}}i128 @test_ScalarZstFirst(i128 %_1) |
| 14 | 16 | #[no_mangle] |
| 15 | pub fn test_ScalarZstFirst(_: ScalarZstFirst) -> ScalarZstFirst { loop {} } | |
| 17 | pub fn test_ScalarZstFirst(_: ScalarZstFirst) -> ScalarZstFirst { | |
| 18 | loop {} | |
| 19 | } | |
| 16 | 20 | |
| 17 | 21 | type ScalarPairZstLast = (u8, u128, ()); |
| 18 | 22 | // CHECK: define {{(dso_local )?}}{ i128, i8 } @test_ScalarPairZstLast(i128 %_1.0, i8 %_1.1) |
| 19 | 23 | #[no_mangle] |
| 20 | pub fn test_ScalarPairZstLast(_: ScalarPairZstLast) -> ScalarPairZstLast { loop {} } | |
| 24 | pub fn test_ScalarPairZstLast(_: ScalarPairZstLast) -> ScalarPairZstLast { | |
| 25 | loop {} | |
| 26 | } | |
| 21 | 27 | |
| 22 | 28 | type ScalarPairZstFirst = ((), u8, u128); |
| 23 | 29 | // CHECK: define {{(dso_local )?}}{ i8, i128 } @test_ScalarPairZstFirst(i8 %_1.0, i128 %_1.1) |
| 24 | 30 | #[no_mangle] |
| 25 | pub fn test_ScalarPairZstFirst(_: ScalarPairZstFirst) -> ScalarPairZstFirst { loop {} } | |
| 31 | pub fn test_ScalarPairZstFirst(_: ScalarPairZstFirst) -> ScalarPairZstFirst { | |
| 32 | loop {} | |
| 33 | } | |
| 26 | 34 | |
| 27 | 35 | type ScalarPairLotsOfZsts = ((), u8, (), u128, ()); |
| 28 | 36 | // CHECK: define {{(dso_local )?}}{ i128, i8 } @test_ScalarPairLotsOfZsts(i128 %_1.0, i8 %_1.1) |
| 29 | 37 | #[no_mangle] |
| 30 | pub fn test_ScalarPairLotsOfZsts(_: ScalarPairLotsOfZsts) -> ScalarPairLotsOfZsts { loop {} } | |
| 38 | pub fn test_ScalarPairLotsOfZsts(_: ScalarPairLotsOfZsts) -> ScalarPairLotsOfZsts { | |
| 39 | loop {} | |
| 40 | } | |
| 31 | 41 | |
| 32 | 42 | type ScalarPairLottaNesting = (((), ((), u8, (), u128, ())), ()); |
| 33 | 43 | // CHECK: define {{(dso_local )?}}{ i128, i8 } @test_ScalarPairLottaNesting(i128 %_1.0, i8 %_1.1) |
| 34 | 44 | #[no_mangle] |
| 35 | pub fn test_ScalarPairLottaNesting(_: ScalarPairLottaNesting) -> ScalarPairLottaNesting { loop {} } | |
| 45 | pub fn test_ScalarPairLottaNesting(_: ScalarPairLottaNesting) -> ScalarPairLottaNesting { | |
| 46 | loop {} | |
| 47 | } |
tests/codegen/union-abi.rs+72-23| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | // This test that using union forward the abi of the inner type, as |
| 5 | 5 | // discussed in #54668 |
| 6 | 6 | |
| 7 | #![crate_type="lib"] | |
| 7 | #![crate_type = "lib"] | |
| 8 | 8 | #![feature(repr_simd)] |
| 9 | 9 | |
| 10 | 10 | #[derive(Copy, Clone)] |
| ... | ... | @@ -15,62 +15,111 @@ pub enum Unhab {} |
| 15 | 15 | pub struct i64x4(i64, i64, i64, i64); |
| 16 | 16 | |
| 17 | 17 | #[derive(Copy, Clone)] |
| 18 | pub union UnionI64x4{ a:(), b: i64x4 } | |
| 18 | pub union UnionI64x4 { | |
| 19 | a: (), | |
| 20 | b: i64x4, | |
| 21 | } | |
| 19 | 22 | |
| 20 | 23 | // CHECK: define {{(dso_local )?}}void @test_UnionI64x4(ptr {{.*}} %_1) |
| 21 | 24 | #[no_mangle] |
| 22 | pub fn test_UnionI64x4(_: UnionI64x4) { loop {} } | |
| 23 | ||
| 24 | pub union UnionI64x4_{ a: i64x4, b: (), c:i64x4, d: Unhab, e: ((),()), f: UnionI64x4 } | |
| 25 | pub fn test_UnionI64x4(_: UnionI64x4) { | |
| 26 | loop {} | |
| 27 | } | |
| 28 | ||
| 29 | pub union UnionI64x4_ { | |
| 30 | a: i64x4, | |
| 31 | b: (), | |
| 32 | c: i64x4, | |
| 33 | d: Unhab, | |
| 34 | e: ((), ()), | |
| 35 | f: UnionI64x4, | |
| 36 | } | |
| 25 | 37 | |
| 26 | 38 | // CHECK: define {{(dso_local )?}}void @test_UnionI64x4_(ptr {{.*}} %_1) |
| 27 | 39 | #[no_mangle] |
| 28 | pub fn test_UnionI64x4_(_: UnionI64x4_) { loop {} } | |
| 40 | pub fn test_UnionI64x4_(_: UnionI64x4_) { | |
| 41 | loop {} | |
| 42 | } | |
| 29 | 43 | |
| 30 | pub union UnionI64x4I64{ a: i64x4, b: i64 } | |
| 44 | pub union UnionI64x4I64 { | |
| 45 | a: i64x4, | |
| 46 | b: i64, | |
| 47 | } | |
| 31 | 48 | |
| 32 | 49 | // CHECK: define {{(dso_local )?}}void @test_UnionI64x4I64(ptr {{.*}} %_1) |
| 33 | 50 | #[no_mangle] |
| 34 | pub fn test_UnionI64x4I64(_: UnionI64x4I64) { loop {} } | |
| 51 | pub fn test_UnionI64x4I64(_: UnionI64x4I64) { | |
| 52 | loop {} | |
| 53 | } | |
| 35 | 54 | |
| 36 | pub union UnionI64x4Tuple{ a: i64x4, b: (i64, i64, i64, i64) } | |
| 55 | pub union UnionI64x4Tuple { | |
| 56 | a: i64x4, | |
| 57 | b: (i64, i64, i64, i64), | |
| 58 | } | |
| 37 | 59 | |
| 38 | 60 | // CHECK: define {{(dso_local )?}}void @test_UnionI64x4Tuple(ptr {{.*}} %_1) |
| 39 | 61 | #[no_mangle] |
| 40 | pub fn test_UnionI64x4Tuple(_: UnionI64x4Tuple) { loop {} } | |
| 41 | ||
| 62 | pub fn test_UnionI64x4Tuple(_: UnionI64x4Tuple) { | |
| 63 | loop {} | |
| 64 | } | |
| 42 | 65 | |
| 43 | pub union UnionF32{a:f32} | |
| 66 | pub union UnionF32 { | |
| 67 | a: f32, | |
| 68 | } | |
| 44 | 69 | |
| 45 | 70 | // CHECK: define {{(dso_local )?}}float @test_UnionF32(float %_1) |
| 46 | 71 | #[no_mangle] |
| 47 | pub fn test_UnionF32(_: UnionF32) -> UnionF32 { loop {} } | |
| 72 | pub fn test_UnionF32(_: UnionF32) -> UnionF32 { | |
| 73 | loop {} | |
| 74 | } | |
| 48 | 75 | |
| 49 | pub union UnionF32F32{a:f32, b:f32} | |
| 76 | pub union UnionF32F32 { | |
| 77 | a: f32, | |
| 78 | b: f32, | |
| 79 | } | |
| 50 | 80 | |
| 51 | 81 | // CHECK: define {{(dso_local )?}}float @test_UnionF32F32(float %_1) |
| 52 | 82 | #[no_mangle] |
| 53 | pub fn test_UnionF32F32(_: UnionF32F32) -> UnionF32F32 { loop {} } | |
| 83 | pub fn test_UnionF32F32(_: UnionF32F32) -> UnionF32F32 { | |
| 84 | loop {} | |
| 85 | } | |
| 54 | 86 | |
| 55 | pub union UnionF32U32{a:f32, b:u32} | |
| 87 | pub union UnionF32U32 { | |
| 88 | a: f32, | |
| 89 | b: u32, | |
| 90 | } | |
| 56 | 91 | |
| 57 | 92 | // CHECK: define {{(dso_local )?}}i32 @test_UnionF32U32(i32{{( %0)?}}) |
| 58 | 93 | #[no_mangle] |
| 59 | pub fn test_UnionF32U32(_: UnionF32U32) -> UnionF32U32 { loop {} } | |
| 94 | pub fn test_UnionF32U32(_: UnionF32U32) -> UnionF32U32 { | |
| 95 | loop {} | |
| 96 | } | |
| 60 | 97 | |
| 61 | pub union UnionU128{a:u128} | |
| 98 | pub union UnionU128 { | |
| 99 | a: u128, | |
| 100 | } | |
| 62 | 101 | // CHECK: define {{(dso_local )?}}i128 @test_UnionU128(i128 %_1) |
| 63 | 102 | #[no_mangle] |
| 64 | pub fn test_UnionU128(_: UnionU128) -> UnionU128 { loop {} } | |
| 103 | pub fn test_UnionU128(_: UnionU128) -> UnionU128 { | |
| 104 | loop {} | |
| 105 | } | |
| 65 | 106 | |
| 66 | 107 | #[repr(C)] |
| 67 | pub union CUnionU128{a:u128} | |
| 108 | pub union CUnionU128 { | |
| 109 | a: u128, | |
| 110 | } | |
| 68 | 111 | // CHECK: define {{(dso_local )?}}void @test_CUnionU128(ptr {{.*}} %_1) |
| 69 | 112 | #[no_mangle] |
| 70 | pub fn test_CUnionU128(_: CUnionU128) { loop {} } | |
| 113 | pub fn test_CUnionU128(_: CUnionU128) { | |
| 114 | loop {} | |
| 115 | } | |
| 71 | 116 | |
| 72 | pub union UnionBool { b:bool } | |
| 117 | pub union UnionBool { | |
| 118 | b: bool, | |
| 119 | } | |
| 73 | 120 | // CHECK: define {{(dso_local )?}}noundef zeroext i1 @test_UnionBool(i8 %b) |
| 74 | 121 | #[no_mangle] |
| 75 | pub fn test_UnionBool(b: UnionBool) -> bool { unsafe { b.b } } | |
| 122 | pub fn test_UnionBool(b: UnionBool) -> bool { | |
| 123 | unsafe { b.b } | |
| 124 | } | |
| 76 | 125 | // CHECK: %_0 = trunc i8 %b to i1 |
tests/codegen/unwind-abis/aapcs-unwind-abi.rs+4-6| ... | ... | @@ -2,8 +2,8 @@ |
| 2 | 2 | //@ compile-flags: --target=armv7-unknown-linux-gnueabihf --crate-type=rlib -Cno-prepopulate-passes |
| 3 | 3 | #![no_core] |
| 4 | 4 | #![feature(no_core, lang_items, c_unwind)] |
| 5 | #[lang="sized"] | |
| 6 | trait Sized { } | |
| 5 | #[lang = "sized"] | |
| 6 | trait Sized {} | |
| 7 | 7 | |
| 8 | 8 | // Test that `nounwind` attributes are correctly applied to exported `aapcs` and |
| 9 | 9 | // `aapcs-unwind` extern functions. `aapcs-unwind` functions MUST NOT have this attribute. We |
| ... | ... | @@ -11,13 +11,11 @@ trait Sized { } |
| 11 | 11 | |
| 12 | 12 | // CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 { |
| 13 | 13 | #[no_mangle] |
| 14 | pub extern "aapcs" fn rust_item_that_cannot_unwind() { | |
| 15 | } | |
| 14 | pub extern "aapcs" fn rust_item_that_cannot_unwind() {} | |
| 16 | 15 | |
| 17 | 16 | // CHECK: @rust_item_that_can_unwind() unnamed_addr #1 { |
| 18 | 17 | #[no_mangle] |
| 19 | pub extern "aapcs-unwind" fn rust_item_that_can_unwind() { | |
| 20 | } | |
| 18 | pub extern "aapcs-unwind" fn rust_item_that_can_unwind() {} | |
| 21 | 19 | |
| 22 | 20 | // Now, make some assertions that the LLVM attributes for these functions are correct. First, make |
| 23 | 21 | // sure that the first item is correctly marked with the `nounwind` attribute: |
tests/codegen/unwind-abis/c-unwind-abi.rs+2-4| ... | ... | @@ -10,13 +10,11 @@ |
| 10 | 10 | |
| 11 | 11 | // CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 { |
| 12 | 12 | #[no_mangle] |
| 13 | pub extern "C" fn rust_item_that_cannot_unwind() { | |
| 14 | } | |
| 13 | pub extern "C" fn rust_item_that_cannot_unwind() {} | |
| 15 | 14 | |
| 16 | 15 | // CHECK: @rust_item_that_can_unwind() unnamed_addr #1 { |
| 17 | 16 | #[no_mangle] |
| 18 | pub extern "C-unwind" fn rust_item_that_can_unwind() { | |
| 19 | } | |
| 17 | pub extern "C-unwind" fn rust_item_that_can_unwind() {} | |
| 20 | 18 | |
| 21 | 19 | // Now, make some assertions that the LLVM attributes for these functions are correct. First, make |
| 22 | 20 | // sure that the first item is correctly marked with the `nounwind` attribute: |
tests/codegen/unwind-abis/cdecl-unwind-abi.rs+2-4| ... | ... | @@ -10,13 +10,11 @@ |
| 10 | 10 | |
| 11 | 11 | // CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 { |
| 12 | 12 | #[no_mangle] |
| 13 | pub extern "cdecl" fn rust_item_that_cannot_unwind() { | |
| 14 | } | |
| 13 | pub extern "cdecl" fn rust_item_that_cannot_unwind() {} | |
| 15 | 14 | |
| 16 | 15 | // CHECK: @rust_item_that_can_unwind() unnamed_addr #1 { |
| 17 | 16 | #[no_mangle] |
| 18 | pub extern "cdecl-unwind" fn rust_item_that_can_unwind() { | |
| 19 | } | |
| 17 | pub extern "cdecl-unwind" fn rust_item_that_can_unwind() {} | |
| 20 | 18 | |
| 21 | 19 | // Now, make some assertions that the LLVM attributes for these functions are correct. First, make |
| 22 | 20 | // sure that the first item is correctly marked with the `nounwind` attribute: |
tests/codegen/unwind-abis/fastcall-unwind-abi.rs+4-6| ... | ... | @@ -2,8 +2,8 @@ |
| 2 | 2 | //@ compile-flags: --target=i686-pc-windows-msvc --crate-type=rlib -Cno-prepopulate-passes |
| 3 | 3 | #![no_core] |
| 4 | 4 | #![feature(no_core, lang_items, c_unwind)] |
| 5 | #[lang="sized"] | |
| 6 | trait Sized { } | |
| 5 | #[lang = "sized"] | |
| 6 | trait Sized {} | |
| 7 | 7 | |
| 8 | 8 | // Test that `nounwind` attributes are correctly applied to exported `fastcall` and |
| 9 | 9 | // `fastcall-unwind` extern functions. `fastcall-unwind` functions MUST NOT have this attribute. We |
| ... | ... | @@ -11,13 +11,11 @@ trait Sized { } |
| 11 | 11 | |
| 12 | 12 | // CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 { |
| 13 | 13 | #[no_mangle] |
| 14 | pub extern "fastcall" fn rust_item_that_cannot_unwind() { | |
| 15 | } | |
| 14 | pub extern "fastcall" fn rust_item_that_cannot_unwind() {} | |
| 16 | 15 | |
| 17 | 16 | // CHECK: @rust_item_that_can_unwind() unnamed_addr #1 { |
| 18 | 17 | #[no_mangle] |
| 19 | pub extern "fastcall-unwind" fn rust_item_that_can_unwind() { | |
| 20 | } | |
| 18 | pub extern "fastcall-unwind" fn rust_item_that_can_unwind() {} | |
| 21 | 19 | |
| 22 | 20 | // Now, make some assertions that the LLVM attributes for these functions are correct. First, make |
| 23 | 21 | // sure that the first item is correctly marked with the `nounwind` attribute: |
tests/codegen/unwind-abis/stdcall-unwind-abi.rs+4-6| ... | ... | @@ -2,8 +2,8 @@ |
| 2 | 2 | //@ compile-flags: --target=i686-pc-windows-msvc --crate-type=rlib -Cno-prepopulate-passes |
| 3 | 3 | #![no_core] |
| 4 | 4 | #![feature(no_core, lang_items, c_unwind)] |
| 5 | #[lang="sized"] | |
| 6 | trait Sized { } | |
| 5 | #[lang = "sized"] | |
| 6 | trait Sized {} | |
| 7 | 7 | |
| 8 | 8 | // Test that `nounwind` attributes are correctly applied to exported `stdcall` and `stdcall-unwind` |
| 9 | 9 | // extern functions. `stdcall-unwind` functions MUST NOT have this attribute. We disable |
| ... | ... | @@ -11,13 +11,11 @@ trait Sized { } |
| 11 | 11 | |
| 12 | 12 | // CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 { |
| 13 | 13 | #[no_mangle] |
| 14 | pub extern "stdcall" fn rust_item_that_cannot_unwind() { | |
| 15 | } | |
| 14 | pub extern "stdcall" fn rust_item_that_cannot_unwind() {} | |
| 16 | 15 | |
| 17 | 16 | // CHECK: @rust_item_that_can_unwind() unnamed_addr #1 { |
| 18 | 17 | #[no_mangle] |
| 19 | pub extern "stdcall-unwind" fn rust_item_that_can_unwind() { | |
| 20 | } | |
| 18 | pub extern "stdcall-unwind" fn rust_item_that_can_unwind() {} | |
| 21 | 19 | |
| 22 | 20 | // Now, make some assertions that the LLVM attributes for these functions are correct. First, make |
| 23 | 21 | // sure that the first item is correctly marked with the `nounwind` attribute: |
tests/codegen/unwind-abis/system-unwind-abi.rs+2-4| ... | ... | @@ -10,13 +10,11 @@ |
| 10 | 10 | |
| 11 | 11 | // CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 { |
| 12 | 12 | #[no_mangle] |
| 13 | pub extern "system" fn rust_item_that_cannot_unwind() { | |
| 14 | } | |
| 13 | pub extern "system" fn rust_item_that_cannot_unwind() {} | |
| 15 | 14 | |
| 16 | 15 | // CHECK: @rust_item_that_can_unwind() unnamed_addr #1 { |
| 17 | 16 | #[no_mangle] |
| 18 | pub extern "system-unwind" fn rust_item_that_can_unwind() { | |
| 19 | } | |
| 17 | pub extern "system-unwind" fn rust_item_that_can_unwind() {} | |
| 20 | 18 | |
| 21 | 19 | // Now, make some assertions that the LLVM attributes for these functions are correct. First, make |
| 22 | 20 | // sure that the first item is correctly marked with the `nounwind` attribute: |
tests/codegen/unwind-abis/sysv64-unwind-abi.rs+4-6| ... | ... | @@ -2,8 +2,8 @@ |
| 2 | 2 | //@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=rlib -Cno-prepopulate-passes |
| 3 | 3 | #![no_core] |
| 4 | 4 | #![feature(no_core, lang_items, c_unwind)] |
| 5 | #[lang="sized"] | |
| 6 | trait Sized { } | |
| 5 | #[lang = "sized"] | |
| 6 | trait Sized {} | |
| 7 | 7 | |
| 8 | 8 | // Test that `nounwind` attributes are correctly applied to exported `sysv64` and |
| 9 | 9 | // `sysv64-unwind` extern functions. `sysv64-unwind` functions MUST NOT have this attribute. We |
| ... | ... | @@ -11,13 +11,11 @@ trait Sized { } |
| 11 | 11 | |
| 12 | 12 | // CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 { |
| 13 | 13 | #[no_mangle] |
| 14 | pub extern "sysv64" fn rust_item_that_cannot_unwind() { | |
| 15 | } | |
| 14 | pub extern "sysv64" fn rust_item_that_cannot_unwind() {} | |
| 16 | 15 | |
| 17 | 16 | // CHECK: @rust_item_that_can_unwind() unnamed_addr #1 { |
| 18 | 17 | #[no_mangle] |
| 19 | pub extern "sysv64-unwind" fn rust_item_that_can_unwind() { | |
| 20 | } | |
| 18 | pub extern "sysv64-unwind" fn rust_item_that_can_unwind() {} | |
| 21 | 19 | |
| 22 | 20 | // Now, make some assertions that the LLVM attributes for these functions are correct. First, make |
| 23 | 21 | // sure that the first item is correctly marked with the `nounwind` attribute: |
tests/codegen/unwind-abis/thiscall-unwind-abi.rs+4-6| ... | ... | @@ -2,8 +2,8 @@ |
| 2 | 2 | //@ compile-flags: --target=i686-pc-windows-msvc --crate-type=rlib -Cno-prepopulate-passes |
| 3 | 3 | #![no_core] |
| 4 | 4 | #![feature(no_core, lang_items, c_unwind)] |
| 5 | #[lang="sized"] | |
| 6 | trait Sized { } | |
| 5 | #[lang = "sized"] | |
| 6 | trait Sized {} | |
| 7 | 7 | |
| 8 | 8 | // Test that `nounwind` attributes are correctly applied to exported `thiscall` and |
| 9 | 9 | // `thiscall-unwind` extern functions. `thiscall-unwind` functions MUST NOT have this attribute. We |
| ... | ... | @@ -11,13 +11,11 @@ trait Sized { } |
| 11 | 11 | |
| 12 | 12 | // CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 { |
| 13 | 13 | #[no_mangle] |
| 14 | pub extern "thiscall" fn rust_item_that_cannot_unwind() { | |
| 15 | } | |
| 14 | pub extern "thiscall" fn rust_item_that_cannot_unwind() {} | |
| 16 | 15 | |
| 17 | 16 | // CHECK: @rust_item_that_can_unwind() unnamed_addr #1 { |
| 18 | 17 | #[no_mangle] |
| 19 | pub extern "thiscall-unwind" fn rust_item_that_can_unwind() { | |
| 20 | } | |
| 18 | pub extern "thiscall-unwind" fn rust_item_that_can_unwind() {} | |
| 21 | 19 | |
| 22 | 20 | // Now, make some assertions that the LLVM attributes for these functions are correct. First, make |
| 23 | 21 | // sure that the first item is correctly marked with the `nounwind` attribute: |
tests/codegen/unwind-abis/vectorcall-unwind-abi.rs+4-6| ... | ... | @@ -2,8 +2,8 @@ |
| 2 | 2 | //@ compile-flags: --target=i686-pc-windows-msvc --crate-type=rlib -Cno-prepopulate-passes |
| 3 | 3 | #![no_core] |
| 4 | 4 | #![feature(no_core, lang_items, c_unwind, abi_vectorcall)] |
| 5 | #[lang="sized"] | |
| 6 | trait Sized { } | |
| 5 | #[lang = "sized"] | |
| 6 | trait Sized {} | |
| 7 | 7 | |
| 8 | 8 | // Test that `nounwind` attributes are correctly applied to exported `vectorcall` and |
| 9 | 9 | // `vectorcall-unwind` extern functions. `vectorcall-unwind` functions MUST NOT have this attribute. |
| ... | ... | @@ -11,13 +11,11 @@ trait Sized { } |
| 11 | 11 | |
| 12 | 12 | // CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 { |
| 13 | 13 | #[no_mangle] |
| 14 | pub extern "vectorcall" fn rust_item_that_cannot_unwind() { | |
| 15 | } | |
| 14 | pub extern "vectorcall" fn rust_item_that_cannot_unwind() {} | |
| 16 | 15 | |
| 17 | 16 | // CHECK: @rust_item_that_can_unwind() unnamed_addr #1 { |
| 18 | 17 | #[no_mangle] |
| 19 | pub extern "vectorcall-unwind" fn rust_item_that_can_unwind() { | |
| 20 | } | |
| 18 | pub extern "vectorcall-unwind" fn rust_item_that_can_unwind() {} | |
| 21 | 19 | |
| 22 | 20 | // Now, make some assertions that the LLVM attributes for these functions are correct. First, make |
| 23 | 21 | // sure that the first item is correctly marked with the `nounwind` attribute: |
tests/codegen/unwind-abis/win64-unwind-abi.rs+4-6| ... | ... | @@ -2,8 +2,8 @@ |
| 2 | 2 | //@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=rlib -Cno-prepopulate-passes |
| 3 | 3 | #![no_core] |
| 4 | 4 | #![feature(no_core, lang_items, c_unwind)] |
| 5 | #[lang="sized"] | |
| 6 | trait Sized { } | |
| 5 | #[lang = "sized"] | |
| 6 | trait Sized {} | |
| 7 | 7 | |
| 8 | 8 | // Test that `nounwind` attributes are correctly applied to exported `win64` and |
| 9 | 9 | // `win64-unwind` extern functions. `win64-unwind` functions MUST NOT have this attribute. We |
| ... | ... | @@ -11,13 +11,11 @@ trait Sized { } |
| 11 | 11 | |
| 12 | 12 | // CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 { |
| 13 | 13 | #[no_mangle] |
| 14 | pub extern "win64" fn rust_item_that_cannot_unwind() { | |
| 15 | } | |
| 14 | pub extern "win64" fn rust_item_that_cannot_unwind() {} | |
| 16 | 15 | |
| 17 | 16 | // CHECK: @rust_item_that_can_unwind() unnamed_addr #1 { |
| 18 | 17 | #[no_mangle] |
| 19 | pub extern "win64-unwind" fn rust_item_that_can_unwind() { | |
| 20 | } | |
| 18 | pub extern "win64-unwind" fn rust_item_that_can_unwind() {} | |
| 21 | 19 | |
| 22 | 20 | // Now, make some assertions that the LLVM attributes for these functions are correct. First, make |
| 23 | 21 | // sure that the first item is correctly marked with the `nounwind` attribute: |
tests/codegen/vec-iter-collect-len.rs+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | //@ compile-flags: -O |
| 2 | #![crate_type="lib"] | |
| 2 | #![crate_type = "lib"] | |
| 3 | 3 | |
| 4 | 4 | #[no_mangle] |
| 5 | 5 | pub fn get_len() -> usize { |
tests/codegen/vtable-upcast.rs+3-3| ... | ... | @@ -8,15 +8,15 @@ pub trait Base { |
| 8 | 8 | fn base(&self); |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | pub trait A : Base { | |
| 11 | pub trait A: Base { | |
| 12 | 12 | fn a(&self); |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | pub trait B : Base { | |
| 15 | pub trait B: Base { | |
| 16 | 16 | fn b(&self); |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | pub trait Diamond : A + B { | |
| 19 | pub trait Diamond: A + B { | |
| 20 | 20 | fn diamond(&self); |
| 21 | 21 | } |
| 22 | 22 |
tests/codegen/wasm_exceptions.rs+17-9| ... | ... | @@ -5,7 +5,7 @@ |
| 5 | 5 | #![feature(core_intrinsics)] |
| 6 | 6 | #![feature(rustc_attrs)] |
| 7 | 7 | |
| 8 | extern { | |
| 8 | extern "C" { | |
| 9 | 9 | fn may_panic(); |
| 10 | 10 | |
| 11 | 11 | #[rustc_nounwind] |
| ... | ... | @@ -16,7 +16,9 @@ struct LogOnDrop; |
| 16 | 16 | |
| 17 | 17 | impl Drop for LogOnDrop { |
| 18 | 18 | fn drop(&mut self) { |
| 19 | unsafe { log_number(0); } | |
| 19 | unsafe { | |
| 20 | log_number(0); | |
| 21 | } | |
| 20 | 22 | } |
| 21 | 23 | } |
| 22 | 24 | |
| ... | ... | @@ -24,7 +26,9 @@ impl Drop for LogOnDrop { |
| 24 | 26 | #[no_mangle] |
| 25 | 27 | pub fn test_cleanup() { |
| 26 | 28 | let _log_on_drop = LogOnDrop; |
| 27 | unsafe { may_panic(); } | |
| 29 | unsafe { | |
| 30 | may_panic(); | |
| 31 | } | |
| 28 | 32 | |
| 29 | 33 | // CHECK-NOT: call |
| 30 | 34 | // CHECK: invoke void @may_panic() |
| ... | ... | @@ -35,12 +39,16 @@ pub fn test_cleanup() { |
| 35 | 39 | #[no_mangle] |
| 36 | 40 | pub fn test_rtry() { |
| 37 | 41 | unsafe { |
| 38 | core::intrinsics::catch_unwind(|_| { | |
| 39 | may_panic(); | |
| 40 | }, core::ptr::null_mut(), |data, exception| { | |
| 41 | log_number(data as usize); | |
| 42 | log_number(exception as usize); | |
| 43 | }); | |
| 42 | core::intrinsics::catch_unwind( | |
| 43 | |_| { | |
| 44 | may_panic(); | |
| 45 | }, | |
| 46 | core::ptr::null_mut(), | |
| 47 | |data, exception| { | |
| 48 | log_number(data as usize); | |
| 49 | log_number(exception as usize); | |
| 50 | }, | |
| 51 | ); | |
| 44 | 52 | } |
| 45 | 53 | |
| 46 | 54 | // CHECK-NOT: call |
tests/codegen/zip.rs+2-2| ... | ... | @@ -5,7 +5,7 @@ |
| 5 | 5 | // CHECK-LABEL: @zip_copy |
| 6 | 6 | #[no_mangle] |
| 7 | 7 | pub fn zip_copy(xs: &[u8], ys: &mut [u8]) { |
| 8 | // CHECK: memcpy | |
| 8 | // CHECK: memcpy | |
| 9 | 9 | for (x, y) in xs.iter().zip(ys) { |
| 10 | 10 | *y = *x; |
| 11 | 11 | } |
| ... | ... | @@ -14,7 +14,7 @@ pub fn zip_copy(xs: &[u8], ys: &mut [u8]) { |
| 14 | 14 | // CHECK-LABEL: @zip_copy_mapped |
| 15 | 15 | #[no_mangle] |
| 16 | 16 | pub fn zip_copy_mapped(xs: &[u8], ys: &mut [u8]) { |
| 17 | // CHECK: memcpy | |
| 17 | // CHECK: memcpy | |
| 18 | 18 | for (x, y) in xs.iter().map(|&x| x).zip(ys) { |
| 19 | 19 | *y = x; |
| 20 | 20 | } |
tests/codegen/zst-offset.rs+4-5| ... | ... | @@ -6,14 +6,13 @@ |
| 6 | 6 | // Hack to get the correct size for the length part in slices |
| 7 | 7 | // CHECK: @helper([[USIZE:i[0-9]+]] %_1) |
| 8 | 8 | #[no_mangle] |
| 9 | pub fn helper(_: usize) { | |
| 10 | } | |
| 9 | pub fn helper(_: usize) {} | |
| 11 | 10 | |
| 12 | 11 | // Check that we correctly generate a GEP for a ZST that is not included in Scalar layout |
| 13 | 12 | // CHECK-LABEL: @scalar_layout |
| 14 | 13 | #[no_mangle] |
| 15 | 14 | pub fn scalar_layout(s: &(u64, ())) { |
| 16 | // CHECK: getelementptr inbounds i8, {{.+}}, [[USIZE]] 8 | |
| 15 | // CHECK: getelementptr inbounds i8, {{.+}}, [[USIZE]] 8 | |
| 17 | 16 | let x = &s.1; |
| 18 | 17 | witness(&x); // keep variable in an alloca |
| 19 | 18 | } |
| ... | ... | @@ -22,7 +21,7 @@ pub fn scalar_layout(s: &(u64, ())) { |
| 22 | 21 | // CHECK-LABEL: @scalarpair_layout |
| 23 | 22 | #[no_mangle] |
| 24 | 23 | pub fn scalarpair_layout(s: &(u64, u32, ())) { |
| 25 | // CHECK: getelementptr inbounds i8, {{.+}}, [[USIZE]] 12 | |
| 24 | // CHECK: getelementptr inbounds i8, {{.+}}, [[USIZE]] 12 | |
| 26 | 25 | let x = &s.2; |
| 27 | 26 | witness(&x); // keep variable in an alloca |
| 28 | 27 | } |
| ... | ... | @@ -34,7 +33,7 @@ pub struct U64x4(u64, u64, u64, u64); |
| 34 | 33 | // CHECK-LABEL: @vector_layout |
| 35 | 34 | #[no_mangle] |
| 36 | 35 | pub fn vector_layout(s: &(U64x4, ())) { |
| 37 | // CHECK: getelementptr inbounds i8, {{.+}}, [[USIZE]] 32 | |
| 36 | // CHECK: getelementptr inbounds i8, {{.+}}, [[USIZE]] 32 | |
| 38 | 37 | let x = &s.1; |
| 39 | 38 | witness(&x); // keep variable in an alloca |
| 40 | 39 | } |
tests/run-make/a-b-a-linker-guard/a.rs+2-2| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | #![crate_type = "dylib"] |
| 3 | 3 | |
| 4 | 4 | #[cfg(x)] |
| 5 | pub fn foo(x: u32) { } | |
| 5 | pub fn foo(x: u32) {} | |
| 6 | 6 | |
| 7 | 7 | #[cfg(y)] |
| 8 | pub fn foo(x: i32) { } | |
| 8 | pub fn foo(x: i32) {} |
tests/run-make/allow-non-lint-warnings-cmdline/foo.rs+1-1| ... | ... | @@ -2,4 +2,4 @@ |
| 2 | 2 | #[derive(Copy, Clone)] |
| 3 | 3 | pub struct Foo; |
| 4 | 4 | |
| 5 | pub fn main() { } | |
| 5 | pub fn main() {} |
tests/run-make/allow-warnings-cmdline-stability/foo.rs+3-1| ... | ... | @@ -2,4 +2,6 @@ |
| 2 | 2 | |
| 3 | 3 | extern crate bar; |
| 4 | 4 | |
| 5 | pub fn main() { bar::baz() } | |
| 5 | pub fn main() { | |
| 6 | bar::baz() | |
| 7 | } |
tests/run-make/atomic-lock-free/atomic_lock_free.rs+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | #![feature(no_core, intrinsics, lang_items)] |
| 2 | #![crate_type="rlib"] | |
| 2 | #![crate_type = "rlib"] | |
| 3 | 3 | #![no_core] |
| 4 | 4 | |
| 5 | 5 | extern "rust-intrinsic" { |
tests/run-make/bare-outfile/foo.rs+1-2| ... | ... | @@ -1,2 +1 @@ |
| 1 | fn main() { | |
| 2 | } | |
| 1 | fn main() {} |
tests/run-make/box-struct-no-segfault/foo.rs+4-4| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | #![crate_type="lib"] | |
| 1 | #![crate_type = "lib"] | |
| 2 | 2 | pub struct Foo(()); |
| 3 | 3 | |
| 4 | 4 | impl Foo { |
| 5 | pub fn new() -> Foo { | |
| 6 | Foo(()) | |
| 7 | } | |
| 5 | pub fn new() -> Foo { | |
| 6 | Foo(()) | |
| 7 | } | |
| 8 | 8 | } |
tests/run-make/box-struct-no-segfault/main.rs+2-2| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | #![crate_type="lib"] | |
| 1 | #![crate_type = "lib"] | |
| 2 | 2 | extern crate foo; |
| 3 | 3 | use foo::Foo; |
| 4 | 4 | |
| 5 | 5 | pub fn crash() -> Box<Foo> { |
| 6 | Box::new(Foo::new()) | |
| 6 | Box::new(Foo::new()) | |
| 7 | 7 | } |
tests/run-make/c-link-to-rust-va-list-fn/checkrust.rs+8-10| ... | ... | @@ -1,16 +1,16 @@ |
| 1 | 1 | #![crate_type = "staticlib"] |
| 2 | 2 | #![feature(c_variadic)] |
| 3 | 3 | |
| 4 | use std::ffi::{c_char, c_double, c_int, c_long, c_longlong}; | |
| 5 | 4 | use std::ffi::VaList; |
| 6 | use std::ffi::{CString, CStr}; | |
| 5 | use std::ffi::{c_char, c_double, c_int, c_long, c_longlong}; | |
| 6 | use std::ffi::{CStr, CString}; | |
| 7 | 7 | |
| 8 | 8 | macro_rules! continue_if { |
| 9 | 9 | ($cond:expr) => { |
| 10 | 10 | if !($cond) { |
| 11 | 11 | return 0xff; |
| 12 | 12 | } |
| 13 | } | |
| 13 | }; | |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | unsafe fn compare_c_str(ptr: *const c_char, val: &str) -> bool { |
| ... | ... | @@ -59,13 +59,11 @@ pub unsafe extern "C" fn check_list_copy_0(mut ap: VaList) -> usize { |
| 59 | 59 | continue_if!(ap.arg::<c_int>() == 16); |
| 60 | 60 | continue_if!(ap.arg::<c_char>() == 'A' as c_char); |
| 61 | 61 | continue_if!(compare_c_str(ap.arg::<*const c_char>(), "Skip Me!")); |
| 62 | ap.with_copy(|mut ap| { | |
| 63 | if compare_c_str(ap.arg::<*const c_char>(), "Correct") { | |
| 64 | 0 | |
| 65 | } else { | |
| 66 | 0xff | |
| 67 | } | |
| 68 | }) | |
| 62 | ap.with_copy( | |
| 63 | |mut ap| { | |
| 64 | if compare_c_str(ap.arg::<*const c_char>(), "Correct") { 0 } else { 0xff } | |
| 65 | }, | |
| 66 | ) | |
| 69 | 67 | } |
| 70 | 68 | |
| 71 | 69 | #[no_mangle] |
tests/run-make/compiler-lookup-paths-2/c.rs+1-1| ... | ... | @@ -1,3 +1,3 @@ |
| 1 | 1 | #![crate_type = "lib"] |
| 2 | extern crate b; | |
| 3 | 2 | extern crate a; |
| 3 | extern crate b; |
tests/run-make/crate-data-smoke/rmake.rs+6-27| ... | ... | @@ -3,41 +3,20 @@ use std::process::Output; |
| 3 | 3 | use run_make_support::{bin_name, rust_lib_name, rustc}; |
| 4 | 4 | |
| 5 | 5 | fn compare_stdout<S: AsRef<str>>(output: Output, expected: S) { |
| 6 | assert_eq!( | |
| 7 | String::from_utf8(output.stdout).unwrap().trim(), | |
| 8 | expected.as_ref() | |
| 9 | ); | |
| 6 | assert_eq!(String::from_utf8(output.stdout).unwrap().trim(), expected.as_ref()); | |
| 10 | 7 | } |
| 11 | 8 | |
| 12 | 9 | fn main() { |
| 13 | 10 | compare_stdout(rustc().print("crate-name").input("crate.rs").run(), "foo"); |
| 11 | compare_stdout(rustc().print("file-names").input("crate.rs").run(), bin_name("foo")); | |
| 14 | 12 | compare_stdout( |
| 15 | rustc().print("file-names").input("crate.rs").run(), | |
| 16 | bin_name("foo"), | |
| 17 | ); | |
| 18 | compare_stdout( | |
| 19 | rustc() | |
| 20 | .print("file-names") | |
| 21 | .crate_type("lib") | |
| 22 | .arg("--test") | |
| 23 | .input("crate.rs") | |
| 24 | .run(), | |
| 13 | rustc().print("file-names").crate_type("lib").arg("--test").input("crate.rs").run(), | |
| 25 | 14 | bin_name("foo"), |
| 26 | 15 | ); |
| 27 | 16 | compare_stdout( |
| 28 | rustc() | |
| 29 | .print("file-names") | |
| 30 | .arg("--test") | |
| 31 | .input("lib.rs") | |
| 32 | .run(), | |
| 17 | rustc().print("file-names").arg("--test").input("lib.rs").run(), | |
| 33 | 18 | bin_name("mylib"), |
| 34 | 19 | ); |
| 35 | compare_stdout( | |
| 36 | rustc().print("file-names").input("lib.rs").run(), | |
| 37 | rust_lib_name("mylib"), | |
| 38 | ); | |
| 39 | compare_stdout( | |
| 40 | rustc().print("file-names").input("rlib.rs").run(), | |
| 41 | rust_lib_name("mylib"), | |
| 42 | ); | |
| 20 | compare_stdout(rustc().print("file-names").input("lib.rs").run(), rust_lib_name("mylib")); | |
| 21 | compare_stdout(rustc().print("file-names").input("rlib.rs").run(), rust_lib_name("mylib")); | |
| 43 | 22 | } |
tests/run-make/cross-lang-lto-clang/rustlib.rs+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | #![crate_type="staticlib"] | |
| 1 | #![crate_type = "staticlib"] | |
| 2 | 2 | |
| 3 | 3 | #[no_mangle] |
| 4 | 4 | pub extern "C" fn rust_always_inlined() -> u32 { |
tests/run-make/cross-lang-lto-pgo-smoketest/rustlib.rs+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | #![crate_type="staticlib"] | |
| 1 | #![crate_type = "staticlib"] | |
| 2 | 2 | |
| 3 | 3 | #[no_mangle] |
| 4 | 4 | pub extern "C" fn rust_always_inlined() -> u32 { |
tests/run-make/cross-lang-lto-upstream-rlibs/staticlib.rs+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | #![crate_type="staticlib"] | |
| 1 | #![crate_type = "staticlib"] | |
| 2 | 2 | |
| 3 | 3 | extern crate upstream; |
| 4 | 4 |
tests/run-make/debug-assertions/debug.rs+17-3| ... | ... | @@ -15,19 +15,33 @@ fn main() { |
| 15 | 15 | fn debug_assert_eq() { |
| 16 | 16 | let mut hit1 = false; |
| 17 | 17 | let mut hit2 = false; |
| 18 | debug_assert_eq!({ hit1 = true; 1 }, { hit2 = true; 2 }); | |
| 18 | debug_assert_eq!( | |
| 19 | { | |
| 20 | hit1 = true; | |
| 21 | 1 | |
| 22 | }, | |
| 23 | { | |
| 24 | hit2 = true; | |
| 25 | 2 | |
| 26 | } | |
| 27 | ); | |
| 19 | 28 | assert!(!hit1); |
| 20 | 29 | assert!(!hit2); |
| 21 | 30 | } |
| 22 | 31 | |
| 23 | 32 | fn debug_assert() { |
| 24 | 33 | let mut hit = false; |
| 25 | debug_assert!({ hit = true; false }); | |
| 34 | debug_assert!({ | |
| 35 | hit = true; | |
| 36 | false | |
| 37 | }); | |
| 26 | 38 | assert!(!hit); |
| 27 | 39 | } |
| 28 | 40 | |
| 29 | 41 | fn overflow() { |
| 30 | fn add(a: u8, b: u8) -> u8 { a + b } | |
| 42 | fn add(a: u8, b: u8) -> u8 { | |
| 43 | a + b | |
| 44 | } | |
| 31 | 45 | |
| 32 | 46 | add(200u8, 200u8); |
| 33 | 47 | } |
tests/run-make/dep-info-spaces/lib.rs+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | #[path="foo foo.rs"] | |
| 1 | #[path = "foo foo.rs"] | |
| 2 | 2 | pub mod foo; |
| 3 | 3 | |
| 4 | 4 | pub mod bar; |
tests/run-make/dep-info/lib.rs+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | 1 | #![crate_name = "foo"] |
| 2 | 2 | |
| 3 | pub mod foo; | |
| 4 | 3 | pub mod bar; |
| 4 | pub mod foo; |
tests/run-make/deref-impl-rustdoc-ice/baz.rs+4-2| ... | ... | @@ -1,8 +1,10 @@ |
| 1 | extern crate foo; | |
| 2 | 1 | extern crate bar; |
| 2 | extern crate foo; | |
| 3 | 3 | |
| 4 | 4 | pub struct Bar; |
| 5 | 5 | impl ::std::ops::Deref for Bar { |
| 6 | 6 | type Target = bar::S; |
| 7 | fn deref(&self) -> &Self::Target { unimplemented!() } | |
| 7 | fn deref(&self) -> &Self::Target { | |
| 8 | unimplemented!() | |
| 9 | } | |
| 8 | 10 | } |
tests/run-make/deref-impl-rustdoc-ice/foo.rs+3-1| ... | ... | @@ -3,7 +3,9 @@ |
| 3 | 3 | extern crate proc_macro; |
| 4 | 4 | |
| 5 | 5 | #[proc_macro_derive(A)] |
| 6 | pub fn derive(ts: proc_macro::TokenStream) -> proc_macro::TokenStream { ts } | |
| 6 | pub fn derive(ts: proc_macro::TokenStream) -> proc_macro::TokenStream { | |
| 7 | ts | |
| 8 | } | |
| 7 | 9 | |
| 8 | 10 | #[derive(Debug)] |
| 9 | 11 | struct S; |
tests/run-make/dylib-chain/m2.rs+3-1| ... | ... | @@ -1,4 +1,6 @@ |
| 1 | 1 | #![crate_type = "dylib"] |
| 2 | 2 | extern crate m1; |
| 3 | 3 | |
| 4 | pub fn m2() { m1::m1() } | |
| 4 | pub fn m2() { | |
| 5 | m1::m1() | |
| 6 | } |
tests/run-make/dylib-chain/m3.rs+3-1| ... | ... | @@ -1,4 +1,6 @@ |
| 1 | 1 | #![crate_type = "dylib"] |
| 2 | 2 | extern crate m2; |
| 3 | 3 | |
| 4 | pub fn m3() { m2::m2() } | |
| 4 | pub fn m3() { | |
| 5 | m2::m2() | |
| 6 | } |
tests/run-make/dylib-chain/m4.rs+3-1| ... | ... | @@ -1,3 +1,5 @@ |
| 1 | 1 | extern crate m3; |
| 2 | 2 | |
| 3 | fn main() { m3::m3() } | |
| 3 | fn main() { | |
| 4 | m3::m3() | |
| 5 | } |
tests/run-make/emit/test-26235.rs+17-8| ... | ... | @@ -6,16 +6,22 @@ fn main() { |
| 6 | 6 | type Key = u32; |
| 7 | 7 | const NUM_THREADS: usize = 2; |
| 8 | 8 | |
| 9 | #[derive(Clone,Copy)] | |
| 9 | #[derive(Clone, Copy)] | |
| 10 | 10 | struct Stats<S> { |
| 11 | 11 | upsert: S, |
| 12 | 12 | delete: S, |
| 13 | 13 | insert: S, |
| 14 | update: S | |
| 14 | update: S, | |
| 15 | 15 | }; |
| 16 | 16 | |
| 17 | impl<S> Stats<S> where S: Copy { | |
| 18 | fn dot<B, F, T>(self, s: Stats<T>, f: F) -> Stats<B> where F: Fn(S, T) -> B { | |
| 17 | impl<S> Stats<S> | |
| 18 | where | |
| 19 | S: Copy, | |
| 20 | { | |
| 21 | fn dot<B, F, T>(self, s: Stats<T>, f: F) -> Stats<B> | |
| 22 | where | |
| 23 | F: Fn(S, T) -> B, | |
| 24 | { | |
| 19 | 25 | let Stats { upsert: u1, delete: d1, insert: i1, update: p1 } = self; |
| 20 | 26 | let Stats { upsert: u2, delete: d2, insert: i2, update: p2 } = s; |
| 21 | 27 | Stats { upsert: f(u1, u2), delete: f(d1, d2), insert: f(i1, i2), update: f(p1, p2) } |
| ... | ... | @@ -38,9 +44,12 @@ fn main() { |
| 38 | 44 | make_threads(); |
| 39 | 45 | |
| 40 | 46 | { |
| 41 | let Stats { ref upsert, ref delete, ref insert, ref update } = stats.iter().fold( | |
| 42 | Stats::new(0), |res, &s| res.dot(s, |x: Key, y: Key| x.wrapping_add(y))); | |
| 43 | println!("upserts: {}, deletes: {}, inserts: {}, updates: {}", | |
| 44 | upsert, delete, insert, update); | |
| 47 | let Stats { ref upsert, ref delete, ref insert, ref update } = stats | |
| 48 | .iter() | |
| 49 | .fold(Stats::new(0), |res, &s| res.dot(s, |x: Key, y: Key| x.wrapping_add(y))); | |
| 50 | println!( | |
| 51 | "upserts: {}, deletes: {}, inserts: {}, updates: {}", | |
| 52 | upsert, delete, insert, update | |
| 53 | ); | |
| 45 | 54 | } |
| 46 | 55 | } |
tests/run-make/extern-diff-internal-name/test.rs+1-2| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | #[macro_use] |
| 2 | 2 | extern crate foo; |
| 3 | 3 | |
| 4 | fn main() { | |
| 5 | } | |
| 4 | fn main() {} |
tests/run-make/extern-flag-disambiguates/a.rs+3-1| ... | ... | @@ -3,4 +3,6 @@ |
| 3 | 3 | |
| 4 | 4 | static FOO: usize = 3; |
| 5 | 5 | |
| 6 | pub fn token() -> &'static usize { &FOO } | |
| 6 | pub fn token() -> &'static usize { | |
| 7 | &FOO | |
| 8 | } |
tests/run-make/extern-flag-disambiguates/b.rs+6-2| ... | ... | @@ -5,5 +5,9 @@ extern crate a; |
| 5 | 5 | |
| 6 | 6 | static FOO: usize = 3; |
| 7 | 7 | |
| 8 | pub fn token() -> &'static usize { &FOO } | |
| 9 | pub fn a_token() -> &'static usize { a::token() } | |
| 8 | pub fn token() -> &'static usize { | |
| 9 | &FOO | |
| 10 | } | |
| 11 | pub fn a_token() -> &'static usize { | |
| 12 | a::token() | |
| 13 | } |
tests/run-make/extern-flag-disambiguates/c.rs+6-2| ... | ... | @@ -5,5 +5,9 @@ extern crate a; |
| 5 | 5 | |
| 6 | 6 | static FOO: usize = 3; |
| 7 | 7 | |
| 8 | pub fn token() -> &'static usize { &FOO } | |
| 9 | pub fn a_token() -> &'static usize { a::token() } | |
| 8 | pub fn token() -> &'static usize { | |
| 9 | &FOO | |
| 10 | } | |
| 11 | pub fn a_token() -> &'static usize { | |
| 12 | a::token() | |
| 13 | } |
tests/run-make/extern-flag-disambiguates/d.rs+7-3| ... | ... | @@ -1,9 +1,13 @@ |
| 1 | #[cfg(before)] extern crate a; | |
| 1 | #[cfg(before)] | |
| 2 | extern crate a; | |
| 3 | #[cfg(after)] | |
| 4 | extern crate a; | |
| 2 | 5 | extern crate b; |
| 3 | 6 | extern crate c; |
| 4 | #[cfg(after)] extern crate a; | |
| 5 | 7 | |
| 6 | fn t(a: &'static usize) -> usize { a as *const _ as usize } | |
| 8 | fn t(a: &'static usize) -> usize { | |
| 9 | a as *const _ as usize | |
| 10 | } | |
| 7 | 11 | |
| 8 | 12 | fn main() { |
| 9 | 13 | assert_eq!(t(a::token()), t(b::a_token())); |
tests/run-make/extern-fn-explicit-align/test.rs+2-2| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | // Issue #80127: Passing structs via FFI should work with explicit alignment. |
| 2 | 2 | |
| 3 | use std::ffi::{CStr, c_char}; | |
| 3 | use std::ffi::{c_char, CStr}; | |
| 4 | 4 | use std::ptr::null_mut; |
| 5 | 5 | |
| 6 | 6 | #[repr(C)] |
| ... | ... | @@ -18,7 +18,7 @@ pub struct TwoU64s { |
| 18 | 18 | |
| 19 | 19 | #[repr(C)] |
| 20 | 20 | pub struct WrappedU64s { |
| 21 | pub a: TwoU64s | |
| 21 | pub a: TwoU64s, | |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | #[repr(C)] |
tests/run-make/extern-fn-reachable/dylib.rs+10-5| ... | ... | @@ -1,14 +1,19 @@ |
| 1 | 1 | #![crate_type = "dylib"] |
| 2 | 2 | #![allow(dead_code)] |
| 3 | 3 | |
| 4 | #[no_mangle] pub extern "C" fn fun1() {} | |
| 5 | #[no_mangle] extern "C" fn fun2() {} | |
| 4 | #[no_mangle] | |
| 5 | pub extern "C" fn fun1() {} | |
| 6 | #[no_mangle] | |
| 7 | extern "C" fn fun2() {} | |
| 6 | 8 | |
| 7 | 9 | mod foo { |
| 8 | #[no_mangle] pub extern "C" fn fun3() {} | |
| 10 | #[no_mangle] | |
| 11 | pub extern "C" fn fun3() {} | |
| 9 | 12 | } |
| 10 | 13 | pub mod bar { |
| 11 | #[no_mangle] pub extern "C" fn fun4() {} | |
| 14 | #[no_mangle] | |
| 15 | pub extern "C" fn fun4() {} | |
| 12 | 16 | } |
| 13 | 17 | |
| 14 | #[no_mangle] pub fn fun5() {} | |
| 18 | #[no_mangle] | |
| 19 | pub fn fun5() {} |
tests/run-make/extern-fn-struct-passing-abi/test.rs+6-2| ... | ... | @@ -90,8 +90,12 @@ extern "C" { |
| 90 | 90 | fn byval_rect_with_many_huge(a: Huge, b: Huge, c: Huge, d: Huge, e: Huge, f: Huge, g: Rect); |
| 91 | 91 | |
| 92 | 92 | fn byval_rect_with_many_huge64( |
| 93 | a: Huge64, b: Huge64, c: Huge64, | |
| 94 | d: Huge64, e: Huge64, f: Huge64, | |
| 93 | a: Huge64, | |
| 94 | b: Huge64, | |
| 95 | c: Huge64, | |
| 96 | d: Huge64, | |
| 97 | e: Huge64, | |
| 98 | f: Huge64, | |
| 95 | 99 | g: Rect, |
| 96 | 100 | ); |
| 97 | 101 |
tests/run-make/extern-multiple-copies/bar.rs+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | extern crate foo2; // foo2 first to exhibit the bug | |
| 2 | 1 | extern crate foo1; |
| 2 | extern crate foo2; // foo2 first to exhibit the bug | |
| 3 | 3 | |
| 4 | 4 | fn main() { |
| 5 | 5 | /* ... */ |
tests/run-make/external-crate-panic-handle-no-lint/app.rs-1| ... | ... | @@ -1,7 +1,6 @@ |
| 1 | 1 | #![crate_type = "bin"] |
| 2 | 2 | #![no_main] |
| 3 | 3 | #![no_std] |
| 4 | ||
| 5 | 4 | #![deny(unused_extern_crates)] |
| 6 | 5 | |
| 7 | 6 | // `panic` provides a `panic_handler` so it shouldn't trip the `unused_extern_crates` lint |
tests/run-make/incr-prev-body-beyond-eof/a.rs-4| ... | ... | @@ -9,8 +9,4 @@ fn main() { |
| 9 | 9 | // Basically, avoid modifying this file, including adding or removing whitespace! |
| 10 | 10 | fn foo() { |
| 11 | 11 | assert_eq!(1, 1); |
| 12 | ||
| 13 | ||
| 14 | ||
| 15 | ||
| 16 | 12 | } |
tests/run-make/incr-prev-body-beyond-eof/b.rs+1-1| ... | ... | @@ -8,5 +8,5 @@ fn main() { |
| 8 | 8 | // a.rs, the body must end on a line number which does not exist in b.rs. |
| 9 | 9 | // Basically, avoid modifying this file, including adding or removing whitespace! |
| 10 | 10 | fn foo() { |
| 11 | assert_eq!(1, 1);//// | |
| 11 | assert_eq!(1, 1); //// | |
| 12 | 12 | } |
tests/run-make/inline-always-many-cgu/foo.rs+2-4| ... | ... | @@ -2,11 +2,9 @@ |
| 2 | 2 | |
| 3 | 3 | pub mod a { |
| 4 | 4 | #[inline(always)] |
| 5 | pub fn foo() { | |
| 6 | } | |
| 5 | pub fn foo() {} | |
| 7 | 6 | |
| 8 | pub fn bar() { | |
| 9 | } | |
| 7 | pub fn bar() {} | |
| 10 | 8 | } |
| 11 | 9 | |
| 12 | 10 | #[no_mangle] |
tests/run-make/interdependent-c-libraries/main.rs+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | extern crate foo; | |
| 2 | 1 | extern crate bar; |
| 2 | extern crate foo; | |
| 3 | 3 | |
| 4 | 4 | fn main() { |
| 5 | 5 | bar::doit(); |
tests/run-make/intrinsic-unreachable/exit-ret.rs+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | #![crate_type="lib"] | |
| 1 | #![crate_type = "lib"] | |
| 2 | 2 | use std::arch::asm; |
| 3 | 3 | |
| 4 | 4 | #[deny(unreachable_code)] |
tests/run-make/intrinsic-unreachable/exit-unreachable.rs+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | #![feature(core_intrinsics)] |
| 2 | #![crate_type="lib"] | |
| 2 | #![crate_type = "lib"] | |
| 3 | 3 | use std::arch::asm; |
| 4 | 4 | |
| 5 | 5 | use std::intrinsics; |
tests/run-make/issue-18943/foo.rs+3-3| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | trait Foo { } | |
| 1 | trait Foo {} | |
| 2 | 2 | |
| 3 | trait Bar { } | |
| 3 | trait Bar {} | |
| 4 | 4 | |
| 5 | impl<'a> Foo for Bar + 'a { } | |
| 5 | impl<'a> Foo for Bar + 'a {} |
tests/run-make/issue-20626/foo.rs+3-1| ... | ... | @@ -1,4 +1,6 @@ |
| 1 | fn identity(a: &u32) -> &u32 { a } | |
| 1 | fn identity(a: &u32) -> &u32 { | |
| 2 | a | |
| 3 | } | |
| 2 | 4 | |
| 3 | 5 | fn print_foo(f: &fn(&u32) -> &u32, x: &u32) { |
| 4 | 6 | print!("{}", (*f)(x)); |
tests/run-make/issue-22131/foo.rs+3-1| ... | ... | @@ -2,4 +2,6 @@ |
| 2 | 2 | /// assert_eq!(foo::foo(), 1); |
| 3 | 3 | /// ``` |
| 4 | 4 | #[cfg(feature = "bar")] |
| 5 | pub fn foo() -> i32 { 1 } | |
| 5 | pub fn foo() -> i32 { | |
| 6 | 1 | |
| 7 | } |
tests/run-make/issue-26006/in/libc/lib.rs+2-2| ... | ... | @@ -1,3 +1,3 @@ |
| 1 | #![crate_type="rlib"] | |
| 1 | #![crate_type = "rlib"] | |
| 2 | 2 | |
| 3 | pub fn something(){} | |
| 3 | pub fn something() {} |
tests/run-make/issue-26006/in/time/lib.rs+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | 1 | #![feature(rustc_private)] |
| 2 | 2 | extern crate libc; |
| 3 | 3 | |
| 4 | fn main(){} | |
| 4 | fn main() {} |
tests/run-make/issue-37839/b.rs+2-1| ... | ... | @@ -1,2 +1,3 @@ |
| 1 | 1 | #![crate_type = "lib"] |
| 2 | #[macro_use] extern crate a; | |
| 2 | #[macro_use] | |
| 3 | extern crate a; |
tests/run-make/issue-47551/eh_frame-terminator.rs+1-3| ... | ... | @@ -7,9 +7,7 @@ struct Foo { |
| 7 | 7 | |
| 8 | 8 | impl Foo { |
| 9 | 9 | const fn new() -> Self { |
| 10 | Self { | |
| 11 | array: [0x1122_3344_5566_7788; 10240] | |
| 12 | } | |
| 10 | Self { array: [0x1122_3344_5566_7788; 10240] } | |
| 13 | 11 | } |
| 14 | 12 | } |
| 15 | 13 |
tests/run-make/issue-69368/c.rs+1-1| ... | ... | @@ -2,8 +2,8 @@ |
| 2 | 2 | #![feature(start)] |
| 3 | 3 | #![no_std] |
| 4 | 4 | |
| 5 | extern crate alloc; | |
| 6 | 5 | extern crate a; |
| 6 | extern crate alloc; | |
| 7 | 7 | extern crate b; |
| 8 | 8 | |
| 9 | 9 | use alloc::vec::Vec; |
tests/run-make/link-arg/empty.rs+1-1| ... | ... | @@ -1 +1 @@ |
| 1 | fn main() { } | |
| 1 | fn main() {} |
tests/run-make/long-linker-command-lines-cmd-exe/foo.rs+13-11| ... | ... | @@ -13,13 +13,13 @@ |
| 13 | 13 | |
| 14 | 14 | use std::env; |
| 15 | 15 | use std::fs::{self, File}; |
| 16 | use std::io::{BufWriter, Write, Read}; | |
| 16 | use std::io::{BufWriter, Read, Write}; | |
| 17 | 17 | use std::path::PathBuf; |
| 18 | 18 | use std::process::Command; |
| 19 | 19 | |
| 20 | 20 | fn main() { |
| 21 | 21 | if !cfg!(windows) { |
| 22 | return | |
| 22 | return; | |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | let tmpdir = PathBuf::from(env::var_os("OUT_DIR").unwrap()); |
| ... | ... | @@ -31,16 +31,16 @@ fn main() { |
| 31 | 31 | let file = file.to_str().unwrap(); |
| 32 | 32 | fs::copy(&file[1..], &ok).unwrap(); |
| 33 | 33 | } |
| 34 | None => { File::create(&not_ok).unwrap(); } | |
| 34 | None => { | |
| 35 | File::create(&not_ok).unwrap(); | |
| 36 | } | |
| 35 | 37 | } |
| 36 | return | |
| 38 | return; | |
| 37 | 39 | } |
| 38 | 40 | |
| 39 | 41 | let rustc = env::var_os("RUSTC").unwrap_or("rustc".into()); |
| 40 | 42 | let me = env::current_exe().unwrap(); |
| 41 | let bat = me.parent() | |
| 42 | .unwrap() | |
| 43 | .join("foo.bat"); | |
| 43 | let bat = me.parent().unwrap().join("foo.bat"); | |
| 44 | 44 | let bat_linker = format!("linker={}", bat.display()); |
| 45 | 45 | for i in (1..).map(|i| i * 10) { |
| 46 | 46 | println!("attempt: {}", i); |
| ... | ... | @@ -61,8 +61,10 @@ fn main() { |
| 61 | 61 | drop(fs::remove_file(&not_ok)); |
| 62 | 62 | let status = Command::new(&rustc) |
| 63 | 63 | .arg(&file) |
| 64 | .arg("-C").arg(&bat_linker) | |
| 65 | .arg("--out-dir").arg(&tmpdir) | |
| 64 | .arg("-C") | |
| 65 | .arg(&bat_linker) | |
| 66 | .arg("--out-dir") | |
| 67 | .arg(&tmpdir) | |
| 66 | 68 | .env("YOU_ARE_A_LINKER", "1") |
| 67 | 69 | .env("MY_LINKER", &me) |
| 68 | 70 | .status() |
| ... | ... | @@ -74,7 +76,7 @@ fn main() { |
| 74 | 76 | |
| 75 | 77 | if !ok.exists() { |
| 76 | 78 | assert!(not_ok.exists()); |
| 77 | continue | |
| 79 | continue; | |
| 78 | 80 | } |
| 79 | 81 | |
| 80 | 82 | let mut contents = Vec::new(); |
| ... | ... | @@ -96,6 +98,6 @@ fn main() { |
| 96 | 98 | assert!(contents.windows(exp.len()).any(|w| w == &exp[..])); |
| 97 | 99 | } |
| 98 | 100 | |
| 99 | break | |
| 101 | break; | |
| 100 | 102 | } |
| 101 | 103 | } |
tests/run-make/long-linker-command-lines/foo.rs+23-18| ... | ... | @@ -34,9 +34,7 @@ fn write_test_case(file: &Path, n: usize) -> HashSet<String> { |
| 34 | 34 | fn read_linker_args(path: &Path) -> String { |
| 35 | 35 | let contents = fs::read(path).unwrap(); |
| 36 | 36 | if cfg!(target_env = "msvc") { |
| 37 | let mut i = contents.chunks(2).map(|c| { | |
| 38 | c[0] as u16 | ((c[1] as u16) << 8) | |
| 39 | }); | |
| 37 | let mut i = contents.chunks(2).map(|c| c[0] as u16 | ((c[1] as u16) << 8)); | |
| 40 | 38 | assert_eq!(i.next(), Some(0xfeff), "Expected UTF-16 BOM"); |
| 41 | 39 | String::from_utf16(&i.collect::<Vec<u16>>()).unwrap() |
| 42 | 40 | } else { |
| ... | ... | @@ -52,7 +50,7 @@ fn main() { |
| 52 | 50 | let file = file.to_str().expect("non-utf8 file argument"); |
| 53 | 51 | fs::copy(&file[1..], &ok).unwrap(); |
| 54 | 52 | } |
| 55 | return | |
| 53 | return; | |
| 56 | 54 | } |
| 57 | 55 | |
| 58 | 56 | let rustc = env::var_os("RUSTC").unwrap_or("rustc".into()); |
| ... | ... | @@ -65,28 +63,35 @@ fn main() { |
| 65 | 63 | drop(fs::remove_file(&ok)); |
| 66 | 64 | let output = Command::new(&rustc) |
| 67 | 65 | .arg(&file) |
| 68 | .arg("-C").arg(&me_as_linker) | |
| 69 | .arg("--out-dir").arg(&tmpdir) | |
| 66 | .arg("-C") | |
| 67 | .arg(&me_as_linker) | |
| 68 | .arg("--out-dir") | |
| 69 | .arg(&tmpdir) | |
| 70 | 70 | .env("YOU_ARE_A_LINKER", "1") |
| 71 | 71 | .output() |
| 72 | 72 | .unwrap(); |
| 73 | 73 | |
| 74 | 74 | if !output.status.success() { |
| 75 | 75 | let stderr = String::from_utf8_lossy(&output.stderr); |
| 76 | panic!("status: {}\nstdout:\n{}\nstderr:\n{}", | |
| 77 | output.status, | |
| 78 | String::from_utf8_lossy(&output.stdout), | |
| 79 | stderr.lines().map(|l| { | |
| 80 | if l.len() > 200 { | |
| 81 | format!("{}...\n", &l[..200]) | |
| 82 | } else { | |
| 83 | format!("{}\n", l) | |
| 84 | } | |
| 85 | }).collect::<String>()); | |
| 76 | panic!( | |
| 77 | "status: {}\nstdout:\n{}\nstderr:\n{}", | |
| 78 | output.status, | |
| 79 | String::from_utf8_lossy(&output.stdout), | |
| 80 | stderr | |
| 81 | .lines() | |
| 82 | .map(|l| { | |
| 83 | if l.len() > 200 { | |
| 84 | format!("{}...\n", &l[..200]) | |
| 85 | } else { | |
| 86 | format!("{}\n", l) | |
| 87 | } | |
| 88 | }) | |
| 89 | .collect::<String>() | |
| 90 | ); | |
| 86 | 91 | } |
| 87 | 92 | |
| 88 | 93 | if !ok.exists() { |
| 89 | continue | |
| 94 | continue; | |
| 90 | 95 | } |
| 91 | 96 | |
| 92 | 97 | let linker_args = read_linker_args(&ok); |
| ... | ... | @@ -101,6 +106,6 @@ fn main() { |
| 101 | 106 | linker_args, |
| 102 | 107 | ); |
| 103 | 108 | |
| 104 | break | |
| 109 | break; | |
| 105 | 110 | } |
| 106 | 111 | } |
tests/run-make/many-crates-but-no-match/crateA1.rs+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | #![crate_name="crateA"] | |
| 1 | #![crate_name = "crateA"] | |
| 2 | 2 | |
| 3 | 3 | // Base crate |
| 4 | 4 | pub fn func<T>() {} |
tests/run-make/many-crates-but-no-match/crateA2.rs+4-2| ... | ... | @@ -1,4 +1,6 @@ |
| 1 | #![crate_name="crateA"] | |
| 1 | #![crate_name = "crateA"] | |
| 2 | 2 | |
| 3 | 3 | // Base crate |
| 4 | pub fn func<T>() { println!("hello"); } | |
| 4 | pub fn func<T>() { | |
| 5 | println!("hello"); | |
| 6 | } |
tests/run-make/many-crates-but-no-match/crateA3.rs+4-2| ... | ... | @@ -1,4 +1,6 @@ |
| 1 | #![crate_name="crateA"] | |
| 1 | #![crate_name = "crateA"] | |
| 2 | 2 | |
| 3 | 3 | // Base crate |
| 4 | pub fn foo<T>() { println!("world!"); } | |
| 4 | pub fn foo<T>() { | |
| 5 | println!("world!"); | |
| 6 | } |
tests/run-make/metadata-flag-frobs-symbols/foo.rs+3-1| ... | ... | @@ -3,4 +3,6 @@ |
| 3 | 3 | |
| 4 | 4 | static FOO: usize = 3; |
| 5 | 5 | |
| 6 | pub fn foo() -> &'static usize { &FOO } | |
| 6 | pub fn foo() -> &'static usize { | |
| 7 | &FOO | |
| 8 | } |
tests/run-make/mixing-deps/dylib.rs+3-1| ... | ... | @@ -3,4 +3,6 @@ extern crate both; |
| 3 | 3 | |
| 4 | 4 | use std::mem; |
| 5 | 5 | |
| 6 | pub fn addr() -> usize { unsafe { mem::transmute(&both::foo) } } | |
| 6 | pub fn addr() -> usize { | |
| 7 | unsafe { mem::transmute(&both::foo) } | |
| 8 | } |
tests/run-make/mixing-deps/prog.rs+2-3| ... | ... | @@ -1,9 +1,8 @@ |
| 1 | extern crate dylib; | |
| 2 | 1 | extern crate both; |
| 2 | extern crate dylib; | |
| 3 | 3 | |
| 4 | 4 | use std::mem; |
| 5 | 5 | |
| 6 | 6 | fn main() { |
| 7 | assert_eq!(unsafe { mem::transmute::<&isize, usize>(&both::foo) }, | |
| 8 | dylib::addr()); | |
| 7 | assert_eq!(unsafe { mem::transmute::<&isize, usize>(&both::foo) }, dylib::addr()); | |
| 9 | 8 | } |
tests/run-make/mixing-libs/dylib.rs+3-1| ... | ... | @@ -1,4 +1,6 @@ |
| 1 | 1 | #![crate_type = "dylib"] |
| 2 | 2 | extern crate rlib; |
| 3 | 3 | |
| 4 | pub fn dylib() { rlib::rlib() } | |
| 4 | pub fn dylib() { | |
| 5 | rlib::rlib() | |
| 6 | } |
tests/run-make/native-link-modifier-whole-archive/native_lib_in_src.rs+6-4| ... | ... | @@ -1,9 +1,11 @@ |
| 1 | 1 | use std::io::Write; |
| 2 | 2 | |
| 3 | #[link(name = "c_static_lib_with_constructor", | |
| 4 | kind = "static", | |
| 5 | modifiers = "-bundle,+whole-archive")] | |
| 6 | extern {} | |
| 3 | #[link( | |
| 4 | name = "c_static_lib_with_constructor", | |
| 5 | kind = "static", | |
| 6 | modifiers = "-bundle,+whole-archive" | |
| 7 | )] | |
| 8 | extern "C" {} | |
| 7 | 9 | |
| 8 | 10 | pub fn hello() { |
| 9 | 11 | print!("native_lib_in_src."); |
tests/run-make/non-pie-thread-local/foo.rs+3-1| ... | ... | @@ -2,7 +2,9 @@ |
| 2 | 2 | |
| 3 | 3 | struct Destroy; |
| 4 | 4 | impl Drop for Destroy { |
| 5 | fn drop(&mut self) { println!("drop"); } | |
| 5 | fn drop(&mut self) { | |
| 6 | println!("drop"); | |
| 7 | } | |
| 6 | 8 | } |
| 7 | 9 | |
| 8 | 10 | thread_local! { |
tests/run-make/pass-non-c-like-enum-to-c/nonclike.rs+2-2| ... | ... | @@ -4,7 +4,7 @@ pub enum TT { |
| 4 | 4 | BB, |
| 5 | 5 | } |
| 6 | 6 | |
| 7 | #[repr(C,u8)] | |
| 7 | #[repr(C, u8)] | |
| 8 | 8 | pub enum T { |
| 9 | 9 | A(u64), |
| 10 | 10 | B, |
| ... | ... | @@ -16,6 +16,6 @@ extern "C" { |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | fn main() { |
| 19 | assert_eq!(33, unsafe { tt_add(TT::AA(1,2), TT::AA(10,20)) }); | |
| 19 | assert_eq!(33, unsafe { tt_add(TT::AA(1, 2), TT::AA(10, 20)) }); | |
| 20 | 20 | assert_eq!(11, unsafe { t_add(T::A(1), T::A(10)) }); |
| 21 | 21 | } |
tests/run-make/pdb-buildinfo-cl-cmd/main.rs+1-2| ... | ... | @@ -1,2 +1 @@ |
| 1 | fn main() { | |
| 2 | } | |
| 1 | fn main() {} |
tests/run-make/pgo-branch-weights/interesting.rs+2-3| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | #![crate_name="interesting"] | |
| 2 | #![crate_type="rlib"] | |
| 1 | #![crate_name = "interesting"] | |
| 2 | #![crate_type = "rlib"] | |
| 3 | 3 | |
| 4 | 4 | extern crate opaque; |
| 5 | 5 | |
| ... | ... | @@ -22,7 +22,6 @@ pub fn function_called_42_times(c: char) { |
| 22 | 22 | // This branch is taken 12 times |
| 23 | 23 | opaque::f1(); |
| 24 | 24 | } else { |
| 25 | ||
| 26 | 25 | if c == 'b' { |
| 27 | 26 | // This branch is taken 28 times |
| 28 | 27 | opaque::f2(); |
tests/run-make/pgo-branch-weights/opaque.rs+2-2| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | #![crate_name="opaque"] | |
| 2 | #![crate_type="rlib"] | |
| 1 | #![crate_name = "opaque"] | |
| 2 | #![crate_type = "rlib"] | |
| 3 | 3 | |
| 4 | 4 | pub fn f1() {} |
| 5 | 5 | pub fn f2() {} |
tests/run-make/pgo-indirect-call-promotion/interesting.rs+2-6| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | #![crate_name="interesting"] | |
| 2 | #![crate_type="rlib"] | |
| 1 | #![crate_name = "interesting"] | |
| 2 | #![crate_type = "rlib"] | |
| 3 | 3 | |
| 4 | 4 | extern crate opaque; |
| 5 | 5 | |
| ... | ... | @@ -15,7 +15,6 @@ pub fn function_called_never() { |
| 15 | 15 | |
| 16 | 16 | #[no_mangle] |
| 17 | 17 | pub fn call_a_bunch_of_functions(fns: &[fn()]) { |
| 18 | ||
| 19 | 18 | // Indirect call promotion transforms the below into something like |
| 20 | 19 | // |
| 21 | 20 | // for f in fns { |
| ... | ... | @@ -33,13 +32,11 @@ pub fn call_a_bunch_of_functions(fns: &[fn()]) { |
| 33 | 32 | } |
| 34 | 33 | } |
| 35 | 34 | |
| 36 | ||
| 37 | 35 | pub trait Foo { |
| 38 | 36 | fn foo(&self); |
| 39 | 37 | } |
| 40 | 38 | |
| 41 | 39 | impl Foo for u32 { |
| 42 | ||
| 43 | 40 | #[no_mangle] |
| 44 | 41 | fn foo(&self) { |
| 45 | 42 | opaque::opaque_f2(); |
| ... | ... | @@ -48,7 +45,6 @@ impl Foo for u32 { |
| 48 | 45 | |
| 49 | 46 | #[no_mangle] |
| 50 | 47 | pub fn call_a_bunch_of_trait_methods(trait_objects: &[&dyn Foo]) { |
| 51 | ||
| 52 | 48 | // Same as above, just with vtables in between |
| 53 | 49 | for x in trait_objects { |
| 54 | 50 | x.foo(); |
tests/run-make/pgo-indirect-call-promotion/main.rs+2-3| ... | ... | @@ -2,9 +2,8 @@ extern crate interesting; |
| 2 | 2 | |
| 3 | 3 | fn main() { |
| 4 | 4 | // function pointer case |
| 5 | let fns: Vec<_> = std::iter::repeat(interesting::function_called_always as fn()) | |
| 6 | .take(1000) | |
| 7 | .collect(); | |
| 5 | let fns: Vec<_> = | |
| 6 | std::iter::repeat(interesting::function_called_always as fn()).take(1000).collect(); | |
| 8 | 7 | interesting::call_a_bunch_of_functions(&fns[..]); |
| 9 | 8 | |
| 10 | 9 | // Trait object case |
tests/run-make/pgo-indirect-call-promotion/opaque.rs+2-2| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | #![crate_name="opaque"] | |
| 2 | #![crate_type="rlib"] | |
| 1 | #![crate_name = "opaque"] | |
| 2 | #![crate_type = "rlib"] | |
| 3 | 3 | |
| 4 | 4 | #[no_mangle] |
| 5 | 5 | pub fn opaque_f1() {} |
tests/run-make/pgo-use/main.rs+1-1| ... | ... | @@ -11,7 +11,7 @@ pub fn hot_function(c: u8) { |
| 11 | 11 | fn main() { |
| 12 | 12 | let arg = std::env::args().skip(1).next().unwrap(); |
| 13 | 13 | |
| 14 | for i in 0 .. 1000_000 { | |
| 14 | for i in 0..1000_000 { | |
| 15 | 15 | let some_value = arg.as_bytes()[i % arg.len()]; |
| 16 | 16 | if some_value == b'!' { |
| 17 | 17 | // This branch is never taken at runtime |
tests/run-make/pointer-auth-link-with-c/test.rs+3-1| ... | ... | @@ -4,5 +4,7 @@ extern "C" { |
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | fn main() { |
| 7 | unsafe {foo();} | |
| 7 | unsafe { | |
| 8 | foo(); | |
| 9 | } | |
| 8 | 10 | } |
tests/run-make/pretty-print-to-file/input.rs+4-4| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | #[crate_type="lib"] | |
| 1 | #[crate_type = "lib"] | |
| 2 | 2 | |
| 3 | pub fn | |
| 4 | foo() -> i32 | |
| 5 | { 45 } | |
| 3 | pub fn foo() -> i32 { | |
| 4 | 45 | |
| 5 | } |
tests/run-make/print-check-cfg/rmake.rs+6-4| ... | ... | @@ -40,19 +40,21 @@ fn main() { |
| 40 | 40 | /*contains*/ &["feature", "feature=\"\"", "feature=\"test\"", "feature=\"lol\""], |
| 41 | 41 | ); |
| 42 | 42 | check( |
| 43 | /*args*/ &[ | |
| 43 | /*args*/ | |
| 44 | &[ | |
| 44 | 45 | r#"--check-cfg=cfg(feature, values(any()))"#, |
| 45 | r#"--check-cfg=cfg(feature, values("tmp"))"# | |
| 46 | r#"--check-cfg=cfg(feature, values("tmp"))"#, | |
| 46 | 47 | ], |
| 47 | 48 | /*has_any*/ false, |
| 48 | 49 | /*has_any_any*/ false, |
| 49 | 50 | /*contains*/ &["unix", "miri", "feature=any()"], |
| 50 | 51 | ); |
| 51 | 52 | check( |
| 52 | /*args*/ &[ | |
| 53 | /*args*/ | |
| 54 | &[ | |
| 53 | 55 | r#"--check-cfg=cfg(has_foo, has_bar)"#, |
| 54 | 56 | r#"--check-cfg=cfg(feature, values("tmp"))"#, |
| 55 | r#"--check-cfg=cfg(feature, values("tmp"))"# | |
| 57 | r#"--check-cfg=cfg(feature, values("tmp"))"#, | |
| 56 | 58 | ], |
| 57 | 59 | /*has_any*/ false, |
| 58 | 60 | /*has_any_any*/ false, |
tests/run-make/proc-macro-init-order/b.rs+2-1| ... | ... | @@ -1,2 +1,3 @@ |
| 1 | 1 | #![crate_type = "lib"] |
| 2 | #[macro_use] extern crate a; | |
| 2 | #[macro_use] | |
| 3 | extern crate a; |
tests/run-make/proc-macro-init-order/c.rs+1-1| ... | ... | @@ -1,3 +1,3 @@ |
| 1 | 1 | #![crate_type = "staticlib"] |
| 2 | extern crate b; | |
| 3 | 2 | extern crate a; |
| 3 | extern crate b; |
tests/run-make/prune-link-args/empty.rs+1-1| ... | ... | @@ -1 +1 @@ |
| 1 | fn main() { } | |
| 1 | fn main() {} |
tests/run-make/raw-dylib-alt-calling-convention/driver.rs+2-3| ... | ... | @@ -2,7 +2,6 @@ extern crate raw_dylib_alt_calling_convention_test; |
| 2 | 2 | |
| 3 | 3 | fn main() { |
| 4 | 4 | raw_dylib_alt_calling_convention_test::library_function( |
| 5 | std::env::args().skip(1).next().map_or( | |
| 6 | false, | |
| 7 | |s| std::str::FromStr::from_str(&s).unwrap())); | |
| 5 | std::env::args().skip(1).next().map_or(false, |s| std::str::FromStr::from_str(&s).unwrap()), | |
| 6 | ); | |
| 8 | 7 | } |
tests/run-make/raw-dylib-c/lib.rs+3-3| ... | ... | @@ -1,16 +1,16 @@ |
| 1 | 1 | #[link(name = "extern_1.dll", kind = "raw-dylib", modifiers = "+verbatim")] |
| 2 | extern { | |
| 2 | extern "C" { | |
| 3 | 3 | fn extern_fn_1(); |
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | #[link(name = "extern_2", kind = "raw-dylib")] |
| 7 | extern { | |
| 7 | extern "C" { | |
| 8 | 8 | fn extern_fn_3(); |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | 11 | pub fn library_function() { |
| 12 | 12 | #[link(name = "extern_1", kind = "raw-dylib")] |
| 13 | extern { | |
| 13 | extern "C" { | |
| 14 | 14 | fn extern_fn_2(); |
| 15 | 15 | fn print_extern_variable(); |
| 16 | 16 | static mut extern_variable: i32; |
tests/run-make/raw-dylib-cross-compilation/lib.rs+1-1| ... | ... | @@ -8,7 +8,7 @@ |
| 8 | 8 | trait Sized {} |
| 9 | 9 | |
| 10 | 10 | #[link(name = "extern_1", kind = "raw-dylib")] |
| 11 | extern { | |
| 11 | extern "C" { | |
| 12 | 12 | fn extern_fn(); |
| 13 | 13 | } |
| 14 | 14 |
tests/run-make/raw-dylib-custom-dlltool/lib.rs+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | #[link(name = "extern_1", kind = "raw-dylib")] |
| 2 | extern { | |
| 2 | extern "C" { | |
| 3 | 3 | fn extern_fn_1(); |
| 4 | 4 | } |
| 5 | 5 |
tests/run-make/raw-dylib-import-name-type/driver.rs+1-1| ... | ... | @@ -76,7 +76,7 @@ extern "vectorcall" { |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | #[link(name = "extern", kind = "raw-dylib")] |
| 79 | extern { | |
| 79 | extern "C" { | |
| 80 | 80 | fn print_extern_variable_undecorated(); |
| 81 | 81 | fn print_extern_variable_noprefix(); |
| 82 | 82 | fn print_extern_variable_decorated(); |
tests/run-make/raw-dylib-inline-cross-dylib/driver.rs+1-1| ... | ... | @@ -2,7 +2,7 @@ extern crate raw_dylib_test; |
| 2 | 2 | extern crate raw_dylib_test_wrapper; |
| 3 | 3 | |
| 4 | 4 | #[link(name = "extern_2", kind = "raw-dylib")] |
| 5 | extern { | |
| 5 | extern "C" { | |
| 6 | 6 | fn extern_fn_2(); |
| 7 | 7 | } |
| 8 | 8 |
tests/run-make/raw-dylib-inline-cross-dylib/lib.rs+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | #[link(name = "extern_1", kind = "raw-dylib")] |
| 2 | extern { | |
| 2 | extern "C" { | |
| 3 | 3 | fn extern_fn_1(); |
| 4 | 4 | fn extern_fn_2(); |
| 5 | 5 | } |
tests/run-make/raw-dylib-link-ordinal/lib.rs+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | #[link(name = "exporter", kind = "raw-dylib")] |
| 2 | extern { | |
| 2 | extern "C" { | |
| 3 | 3 | #[link_ordinal(13)] |
| 4 | 4 | fn imported_function(); |
| 5 | 5 | #[link_ordinal(5)] |
tests/run-make/reproducible-build-2/linker.rs+2-2| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | use std::env; |
| 2 | use std::path::Path; | |
| 3 | 2 | use std::fs::File; |
| 4 | 3 | use std::io::{Read, Write}; |
| 4 | use std::path::Path; | |
| 5 | 5 | |
| 6 | 6 | fn main() { |
| 7 | 7 | let mut dst = env::current_exe().unwrap(); |
| ... | ... | @@ -19,7 +19,7 @@ fn main() { |
| 19 | 19 | if !path.is_file() { |
| 20 | 20 | out.push_str(&arg); |
| 21 | 21 | out.push_str("\n"); |
| 22 | continue | |
| 22 | continue; | |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | let mut contents = Vec::new(); |
tests/run-make/reproducible-build-2/reproducible-build-aux.rs+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | #![crate_type="lib"] | |
| 1 | #![crate_type = "lib"] | |
| 2 | 2 | |
| 3 | 3 | pub static STATIC: i32 = 1234; |
| 4 | 4 | |
| ... | ... | @@ -18,7 +18,7 @@ impl<T1, T2> Drop for Struct<T1, T2> { |
| 18 | 18 | pub enum Enum { |
| 19 | 19 | Variant1, |
| 20 | 20 | Variant2(u32), |
| 21 | Variant3 { x: u32 } | |
| 21 | Variant3 { x: u32 }, | |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | pub struct TupleStruct(pub i8, pub i16, pub i32, pub i64); |
tests/run-make/reproducible-build-2/reproducible-build.rs+8-11| ... | ... | @@ -18,6 +18,8 @@ |
| 18 | 18 | // - Trait object shims |
| 19 | 19 | // - Fn Pointer shims |
| 20 | 20 | |
| 21 | // ignore-tidy-linelength | |
| 22 | ||
| 21 | 23 | #![allow(dead_code, warnings)] |
| 22 | 24 | |
| 23 | 25 | extern crate reproducible_build_aux; |
| ... | ... | @@ -40,7 +42,7 @@ impl<T1, T2> Drop for Struct<T1, T2> { |
| 40 | 42 | pub enum Enum { |
| 41 | 43 | Variant1, |
| 42 | 44 | Variant2(u32), |
| 43 | Variant3 { x: u32 } | |
| 45 | Variant3 { x: u32 }, | |
| 44 | 46 | } |
| 45 | 47 | |
| 46 | 48 | struct TupleStruct(i8, i16, i32, i64); |
| ... | ... | @@ -67,19 +69,14 @@ fn main() { |
| 67 | 69 | generic_fn::<char, Struct<u32, u64>>(); |
| 68 | 70 | generic_fn::<Struct<u64, u32>, reproducible_build_aux::Struct<u32, u64>>(); |
| 69 | 71 | |
| 70 | let dropped = Struct { | |
| 71 | x: "", | |
| 72 | y: 'a', | |
| 73 | }; | |
| 72 | let dropped = Struct { x: "", y: 'a' }; | |
| 74 | 73 | |
| 75 | 74 | let _ = Enum::Variant1; |
| 76 | 75 | let _ = Enum::Variant2(0); |
| 77 | 76 | let _ = Enum::Variant3 { x: 0 }; |
| 78 | 77 | let _ = TupleStruct(1, 2, 3, 4); |
| 79 | 78 | |
| 80 | let closure = |x| { | |
| 81 | x + 1i32 | |
| 82 | }; | |
| 79 | let closure = |x| x + 1i32; | |
| 83 | 80 | |
| 84 | 81 | fn inner<F: Fn(i32) -> i32>(f: F) -> i32 { |
| 85 | 82 | f(STATIC) |
| ... | ... | @@ -94,13 +91,13 @@ fn main() { |
| 94 | 91 | f(0); |
| 95 | 92 | } |
| 96 | 93 | |
| 97 | with_fn_once_adapter(|_:i32| { }); | |
| 94 | with_fn_once_adapter(|_: i32| {}); | |
| 98 | 95 | |
| 99 | 96 | reproducible_build_aux::regular_fn(STATIC); |
| 100 | 97 | reproducible_build_aux::generic_fn::<u32, char>(); |
| 101 | 98 | reproducible_build_aux::generic_fn::<char, Struct<u32, u64>>(); |
| 102 | reproducible_build_aux::generic_fn::<Struct<u64, u32>, | |
| 103 | reproducible_build_aux::Struct<u32, u64>>(); | |
| 99 | reproducible_build_aux::generic_fn::<Struct<u64, u32>, reproducible_build_aux::Struct<u32, u64>>( | |
| 100 | ); | |
| 104 | 101 | |
| 105 | 102 | let _ = reproducible_build_aux::Enum::Variant1; |
| 106 | 103 | let _ = reproducible_build_aux::Enum::Variant2(0); |
tests/run-make/reproducible-build/linker.rs+2-2| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | use std::env; |
| 2 | use std::path::Path; | |
| 3 | 2 | use std::fs::File; |
| 4 | 3 | use std::io::{Read, Write}; |
| 4 | use std::path::Path; | |
| 5 | 5 | |
| 6 | 6 | fn main() { |
| 7 | 7 | let mut dst = env::current_exe().unwrap(); |
| ... | ... | @@ -19,7 +19,7 @@ fn main() { |
| 19 | 19 | if !path.is_file() { |
| 20 | 20 | out.push_str(&arg); |
| 21 | 21 | out.push_str("\n"); |
| 22 | continue | |
| 22 | continue; | |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | let mut contents = Vec::new(); |
tests/run-make/reproducible-build/reproducible-build-aux.rs+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | #![crate_type="lib"] | |
| 1 | #![crate_type = "lib"] | |
| 2 | 2 | |
| 3 | 3 | pub static STATIC: i32 = 1234; |
| 4 | 4 | |
| ... | ... | @@ -18,7 +18,7 @@ impl<T1, T2> Drop for Struct<T1, T2> { |
| 18 | 18 | pub enum Enum { |
| 19 | 19 | Variant1, |
| 20 | 20 | Variant2(u32), |
| 21 | Variant3 { x: u32 } | |
| 21 | Variant3 { x: u32 }, | |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | pub struct TupleStruct(pub i8, pub i16, pub i32, pub i64); |
tests/run-make/reproducible-build/reproducible-build.rs+8-11| ... | ... | @@ -18,6 +18,8 @@ |
| 18 | 18 | // - Trait object shims |
| 19 | 19 | // - Fn Pointer shims |
| 20 | 20 | |
| 21 | // ignore-tidy-linelength | |
| 22 | ||
| 21 | 23 | #![allow(dead_code, warnings)] |
| 22 | 24 | |
| 23 | 25 | extern crate reproducible_build_aux; |
| ... | ... | @@ -40,7 +42,7 @@ impl<T1, T2> Drop for Struct<T1, T2> { |
| 40 | 42 | pub enum Enum { |
| 41 | 43 | Variant1, |
| 42 | 44 | Variant2(u32), |
| 43 | Variant3 { x: u32 } | |
| 45 | Variant3 { x: u32 }, | |
| 44 | 46 | } |
| 45 | 47 | |
| 46 | 48 | struct TupleStruct(i8, i16, i32, i64); |
| ... | ... | @@ -67,19 +69,14 @@ fn main() { |
| 67 | 69 | generic_fn::<char, Struct<u32, u64>>(); |
| 68 | 70 | generic_fn::<Struct<u64, u32>, reproducible_build_aux::Struct<u32, u64>>(); |
| 69 | 71 | |
| 70 | let dropped = Struct { | |
| 71 | x: "", | |
| 72 | y: 'a', | |
| 73 | }; | |
| 72 | let dropped = Struct { x: "", y: 'a' }; | |
| 74 | 73 | |
| 75 | 74 | let _ = Enum::Variant1; |
| 76 | 75 | let _ = Enum::Variant2(0); |
| 77 | 76 | let _ = Enum::Variant3 { x: 0 }; |
| 78 | 77 | let _ = TupleStruct(1, 2, 3, 4); |
| 79 | 78 | |
| 80 | let closure = |x| { | |
| 81 | x + 1i32 | |
| 82 | }; | |
| 79 | let closure = |x| x + 1i32; | |
| 83 | 80 | |
| 84 | 81 | fn inner<F: Fn(i32) -> i32>(f: F) -> i32 { |
| 85 | 82 | f(STATIC) |
| ... | ... | @@ -94,13 +91,13 @@ fn main() { |
| 94 | 91 | f(0); |
| 95 | 92 | } |
| 96 | 93 | |
| 97 | with_fn_once_adapter(|_:i32| { }); | |
| 94 | with_fn_once_adapter(|_: i32| {}); | |
| 98 | 95 | |
| 99 | 96 | reproducible_build_aux::regular_fn(STATIC); |
| 100 | 97 | reproducible_build_aux::generic_fn::<u32, char>(); |
| 101 | 98 | reproducible_build_aux::generic_fn::<char, Struct<u32, u64>>(); |
| 102 | reproducible_build_aux::generic_fn::<Struct<u64, u32>, | |
| 103 | reproducible_build_aux::Struct<u32, u64>>(); | |
| 99 | reproducible_build_aux::generic_fn::<Struct<u64, u32>, reproducible_build_aux::Struct<u32, u64>>( | |
| 100 | ); | |
| 104 | 101 | |
| 105 | 102 | let _ = reproducible_build_aux::Enum::Variant1; |
| 106 | 103 | let _ = reproducible_build_aux::Enum::Variant2(0); |
tests/run-make/reset-codegen-1/foo.rs+1-1| ... | ... | @@ -1 +1 @@ |
| 1 | fn main() { } | |
| 1 | fn main() {} |
tests/run-make/resolve-rename/bar.rs+3-1| ... | ... | @@ -2,4 +2,6 @@ |
| 2 | 2 | |
| 3 | 3 | extern crate foo; |
| 4 | 4 | |
| 5 | pub fn bar() { foo::foo() } | |
| 5 | pub fn bar() { | |
| 6 | foo::foo() | |
| 7 | } |
tests/run-make/resolve-rename/baz.rs+3-1| ... | ... | @@ -2,4 +2,6 @@ |
| 2 | 2 | |
| 3 | 3 | extern crate bar; |
| 4 | 4 | |
| 5 | pub fn baz() { bar::bar() } | |
| 5 | pub fn baz() { | |
| 6 | bar::bar() | |
| 7 | } |
tests/run-make/return-non-c-like-enum-from-c/nonclike.rs+1-1| ... | ... | @@ -4,7 +4,7 @@ pub enum TT { |
| 4 | 4 | BB, |
| 5 | 5 | } |
| 6 | 6 | |
| 7 | #[repr(C,u8)] | |
| 7 | #[repr(C, u8)] | |
| 8 | 8 | pub enum T { |
| 9 | 9 | A(u64), |
| 10 | 10 | B, |
tests/run-make/return-non-c-like-enum/nonclike.rs+1-1| ... | ... | @@ -9,7 +9,7 @@ pub extern "C" fn tt_new(a: u64, b: u64) -> TT { |
| 9 | 9 | TT::AA(a, b) |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | #[repr(C,u8)] | |
| 12 | #[repr(C, u8)] | |
| 13 | 13 | pub enum T { |
| 14 | 14 | A(u64), |
| 15 | 15 | B, |
tests/run-make/rlib-chain/m2.rs+3-1| ... | ... | @@ -1,4 +1,6 @@ |
| 1 | 1 | #![crate_type = "rlib"] |
| 2 | 2 | extern crate m1; |
| 3 | 3 | |
| 4 | pub fn m2() { m1::m1() } | |
| 4 | pub fn m2() { | |
| 5 | m1::m1() | |
| 6 | } |
tests/run-make/rlib-chain/m3.rs+3-1| ... | ... | @@ -1,4 +1,6 @@ |
| 1 | 1 | #![crate_type = "rlib"] |
| 2 | 2 | extern crate m2; |
| 3 | 3 | |
| 4 | pub fn m3() { m2::m2() } | |
| 4 | pub fn m3() { | |
| 5 | m2::m2() | |
| 6 | } |
tests/run-make/rlib-chain/m4.rs+3-1| ... | ... | @@ -1,3 +1,5 @@ |
| 1 | 1 | extern crate m3; |
| 2 | 2 | |
| 3 | fn main() { m3::m3() } | |
| 3 | fn main() { | |
| 4 | m3::m3() | |
| 5 | } |
tests/run-make/rustdoc-error-lines/input.rs+1-3| ... | ... | @@ -6,9 +6,7 @@ |
| 6 | 6 | /// #![feature(bool_to_option)] |
| 7 | 7 | /// let x: char = 1; |
| 8 | 8 | /// ``` |
| 9 | pub fn foo() { | |
| 10 | ||
| 11 | } | |
| 9 | pub fn foo() {} | |
| 12 | 10 | |
| 13 | 11 | /// Add some text around the test... |
| 14 | 12 | /// |
tests/run-make/rustdoc-error-lines/rmake.rs+4-4| ... | ... | @@ -11,10 +11,10 @@ fn main() { |
| 11 | 11 | let should_contain = &[ |
| 12 | 12 | "input.rs - foo (line 5)", |
| 13 | 13 | "input.rs:7:15", |
| 14 | "input.rs - bar (line 15)", | |
| 15 | "input.rs:17:15", | |
| 16 | "input.rs - bar (line 24)", | |
| 17 | "input.rs:26:15", | |
| 14 | "input.rs - bar (line 13)", | |
| 15 | "input.rs:15:15", | |
| 16 | "input.rs - bar (line 22)", | |
| 17 | "input.rs:24:15", | |
| 18 | 18 | ]; |
| 19 | 19 | for text in should_contain { |
| 20 | 20 | assert!(output.contains(text), "output doesn't contains {:?}", text); |
tests/run-make/rustdoc-map-file/foo.rs+2-2| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | pub use private::Quz; | |
| 2 | 1 | pub use hidden::Bar; |
| 2 | pub use private::Quz; | |
| 3 | 3 | |
| 4 | 4 | mod private { |
| 5 | 5 | pub struct Quz; |
| ... | ... | @@ -12,5 +12,5 @@ pub mod hidden { |
| 12 | 12 | |
| 13 | 13 | #[macro_export] |
| 14 | 14 | macro_rules! foo { |
| 15 | () => {} | |
| 15 | () => {}; | |
| 16 | 16 | } |
tests/run-make/rustdoc-scrape-examples-invalid-expr/src/lib.rs+3-1| ... | ... | @@ -1 +1,3 @@ |
| 1 | pub const fn f() -> usize { 5 } | |
| 1 | pub const fn f() -> usize { | |
| 2 | 5 | |
| 3 | } |
tests/run-make/rustdoc-scrape-examples-macros/examples/ex.rs+5-5| ... | ... | @@ -8,20 +8,20 @@ a_proc_macro!(); // no |
| 8 | 8 | |
| 9 | 9 | #[an_attr_macro] |
| 10 | 10 | fn a() { |
| 11 | f(); // no | |
| 11 | f(); // no | |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | #[an_attr_macro(with_span)] |
| 15 | 15 | fn b() { |
| 16 | f(); // yes | |
| 16 | f(); // yes | |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | fn c() { |
| 20 | a_rules_macro!(f()); // yes | |
| 20 | a_rules_macro!(f()); // yes | |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | fn d() { |
| 24 | a_rules_macro!(()); // no | |
| 24 | a_rules_macro!(()); // no | |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | fn main(){} | |
| 27 | fn main() {} |
tests/run-make/rustdoc-scrape-examples-macros/src/lib.rs+3-1| ... | ... | @@ -8,5 +8,7 @@ pub fn f() {} |
| 8 | 8 | |
| 9 | 9 | #[macro_export] |
| 10 | 10 | macro_rules! a_rules_macro { |
| 11 | ($e:expr) => { ($e, foobar::f()); } | |
| 11 | ($e:expr) => { | |
| 12 | ($e, foobar::f()); | |
| 13 | }; | |
| 12 | 14 | } |
tests/run-make/rustdoc-scrape-examples-test/examples/ex.rs+1-1| ... | ... | @@ -2,5 +2,5 @@ fn main() {} |
| 2 | 2 | |
| 3 | 3 | #[test] |
| 4 | 4 | fn a_test() { |
| 5 | foobar::ok(); | |
| 5 | foobar::ok(); | |
| 6 | 6 | } |
tests/run-make/rustdoc-scrape-examples-whitespace/examples/ex.rs+4-2| ... | ... | @@ -1,8 +1,10 @@ |
| 1 | 1 | struct Foo; |
| 2 | 2 | impl Foo { |
| 3 | fn bar() { foobar::ok(); } | |
| 3 | fn bar() { | |
| 4 | foobar::ok(); | |
| 5 | } | |
| 4 | 6 | } |
| 5 | 7 | |
| 6 | 8 | fn main() { |
| 7 | Foo::bar(); | |
| 9 | Foo::bar(); | |
| 8 | 10 | } |
tests/run-make/share-generics-dylib/linked_leaf.rs+2-1| ... | ... | @@ -1,11 +1,12 @@ |
| 1 | // Blank line after this one because it must come before `instance_user_{a,b}_rlib`. | |
| 1 | 2 | extern crate instance_user_dylib; |
| 3 | ||
| 2 | 4 | extern crate instance_user_a_rlib; |
| 3 | 5 | extern crate instance_user_b_rlib; |
| 4 | 6 | |
| 5 | 7 | use std::cell::Cell; |
| 6 | 8 | |
| 7 | 9 | fn main() { |
| 8 | ||
| 9 | 10 | instance_user_a_rlib::foo(); |
| 10 | 11 | instance_user_b_rlib::foo(); |
| 11 | 12 | instance_user_dylib::foo(); |
tests/run-make/split-debuginfo/main.rs+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | extern crate bar; |
| 2 | 2 | |
| 3 | use bar::{Bar, make_bar}; | |
| 3 | use bar::{make_bar, Bar}; | |
| 4 | 4 | |
| 5 | 5 | fn main() { |
| 6 | 6 | let b = make_bar(3); |
tests/run-make/stable-symbol-names/stable-symbol-names1.rs+11-11| ... | ... | @@ -1,31 +1,31 @@ |
| 1 | #![crate_type="rlib"] | |
| 1 | #![crate_type = "rlib"] | |
| 2 | 2 | |
| 3 | 3 | pub trait Foo { |
| 4 | fn generic_method<T>(); | |
| 4 | fn generic_method<T>(); | |
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | pub struct Bar; |
| 8 | 8 | |
| 9 | 9 | impl Foo for Bar { |
| 10 | fn generic_method<T>() {} | |
| 10 | fn generic_method<T>() {} | |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | pub fn mono_function() { |
| 14 | Bar::generic_method::<Bar>(); | |
| 14 | Bar::generic_method::<Bar>(); | |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | pub fn mono_function_lifetime<'a>(x: &'a u64) -> u64 { |
| 18 | *x | |
| 18 | *x | |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | pub fn generic_function<T>(t: T) -> T { |
| 22 | t | |
| 22 | t | |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | pub fn user() { |
| 26 | generic_function(0u32); | |
| 27 | generic_function("abc"); | |
| 28 | let x = 2u64; | |
| 29 | generic_function(&x); | |
| 30 | let _ = mono_function_lifetime(&x); | |
| 26 | generic_function(0u32); | |
| 27 | generic_function("abc"); | |
| 28 | let x = 2u64; | |
| 29 | generic_function(&x); | |
| 30 | let _ = mono_function_lifetime(&x); | |
| 31 | 31 | } |
tests/run-make/stable-symbol-names/stable-symbol-names2.rs+9-9| ... | ... | @@ -1,17 +1,17 @@ |
| 1 | #![crate_type="rlib"] | |
| 1 | #![crate_type = "rlib"] | |
| 2 | 2 | |
| 3 | 3 | extern crate stable_symbol_names1; |
| 4 | 4 | |
| 5 | 5 | pub fn user() { |
| 6 | stable_symbol_names1::generic_function(1u32); | |
| 7 | stable_symbol_names1::generic_function("def"); | |
| 8 | let x = 2u64; | |
| 9 | stable_symbol_names1::generic_function(&x); | |
| 10 | stable_symbol_names1::mono_function(); | |
| 11 | stable_symbol_names1::mono_function_lifetime(&0); | |
| 6 | stable_symbol_names1::generic_function(1u32); | |
| 7 | stable_symbol_names1::generic_function("def"); | |
| 8 | let x = 2u64; | |
| 9 | stable_symbol_names1::generic_function(&x); | |
| 10 | stable_symbol_names1::mono_function(); | |
| 11 | stable_symbol_names1::mono_function_lifetime(&0); | |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | pub fn trait_impl_test_function() { |
| 15 | use stable_symbol_names1::*; | |
| 16 | Bar::generic_method::<Bar>(); | |
| 15 | use stable_symbol_names1::*; | |
| 16 | Bar::generic_method::<Bar>(); | |
| 17 | 17 | } |
tests/run-make/static-unwinding/lib.rs+7-2| ... | ... | @@ -5,11 +5,16 @@ pub static mut statik: isize = 0; |
| 5 | 5 | struct A; |
| 6 | 6 | impl Drop for A { |
| 7 | 7 | fn drop(&mut self) { |
| 8 | unsafe { statik = 1; } | |
| 8 | unsafe { | |
| 9 | statik = 1; | |
| 10 | } | |
| 9 | 11 | } |
| 10 | 12 | } |
| 11 | 13 | |
| 12 | pub fn callback<F>(f: F) where F: FnOnce() { | |
| 14 | pub fn callback<F>(f: F) | |
| 15 | where | |
| 16 | F: FnOnce(), | |
| 17 | { | |
| 13 | 18 | let _a = A; |
| 14 | 19 | f(); |
| 15 | 20 | } |
tests/run-make/static-unwinding/main.rs+7-3| ... | ... | @@ -7,15 +7,19 @@ static mut statik: isize = 0; |
| 7 | 7 | struct A; |
| 8 | 8 | impl Drop for A { |
| 9 | 9 | fn drop(&mut self) { |
| 10 | unsafe { statik = 1; } | |
| 10 | unsafe { | |
| 11 | statik = 1; | |
| 12 | } | |
| 11 | 13 | } |
| 12 | 14 | } |
| 13 | 15 | |
| 14 | 16 | fn main() { |
| 15 | thread::spawn(move|| { | |
| 17 | thread::spawn(move || { | |
| 16 | 18 | let _a = A; |
| 17 | 19 | lib::callback(|| panic!()); |
| 18 | }).join().unwrap_err(); | |
| 20 | }) | |
| 21 | .join() | |
| 22 | .unwrap_err(); | |
| 19 | 23 | |
| 20 | 24 | unsafe { |
| 21 | 25 | assert_eq!(lib::statik, 1); |
tests/run-make/suspicious-library/bar.rs+3-1| ... | ... | @@ -1,3 +1,5 @@ |
| 1 | 1 | extern crate foo; |
| 2 | 2 | |
| 3 | fn main() { foo::foo() } | |
| 3 | fn main() { | |
| 4 | foo::foo() | |
| 5 | } |
tests/run-make/symbol-mangling-hashed/a_dylib.rs+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | #![crate_type="dylib"] | |
| 1 | #![crate_type = "dylib"] | |
| 2 | 2 | pub fn hello() { |
| 3 | 3 | println!("hello dylib"); |
| 4 | 4 | } |
tests/run-make/symbol-mangling-hashed/a_rlib.rs+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | #![crate_type="rlib"] | |
| 1 | #![crate_type = "rlib"] | |
| 2 | 2 | |
| 3 | 3 | pub fn hello() { |
| 4 | 4 | println!("hello rlib"); |
tests/run-make/symbol-mangling-hashed/b_bin.rs+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | extern crate a_rlib; | |
| 2 | 1 | extern crate a_dylib; |
| 2 | extern crate a_rlib; | |
| 3 | 3 | extern crate b_dylib; |
| 4 | 4 | |
| 5 | 5 | fn main() { |
tests/run-make/symbol-mangling-hashed/b_dylib.rs+2-2| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | #![crate_type="dylib"] | |
| 1 | #![crate_type = "dylib"] | |
| 2 | 2 | |
| 3 | extern crate a_rlib; | |
| 4 | 3 | extern crate a_dylib; |
| 4 | extern crate a_rlib; | |
| 5 | 5 | |
| 6 | 6 | pub fn hello() { |
| 7 | 7 | a_rlib::hello(); |
tests/run-make/symbol-visibility/a_cdylib.rs+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | #![crate_type="cdylib"] | |
| 1 | #![crate_type = "cdylib"] | |
| 2 | 2 | |
| 3 | 3 | extern crate an_rlib; |
| 4 | 4 |
tests/run-make/symbol-visibility/a_rust_dylib.rs+4-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | #![crate_type="dylib"] | |
| 1 | #![crate_type = "dylib"] | |
| 2 | 2 | |
| 3 | 3 | extern crate an_rlib; |
| 4 | 4 | |
| ... | ... | @@ -12,4 +12,6 @@ pub extern "C" fn public_c_function_from_rust_dylib() { |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | // This should be exported if -Zshare-generics=yes |
| 15 | pub fn public_generic_function_from_rust_dylib<T>(x: T) -> T { x } | |
| 15 | pub fn public_generic_function_from_rust_dylib<T>(x: T) -> T { | |
| 16 | x | |
| 17 | } |
tests/run-make/symbol-visibility/an_executable.rs+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | #![crate_type="bin"] | |
| 1 | #![crate_type = "bin"] | |
| 2 | 2 | |
| 3 | 3 | extern crate an_rlib; |
| 4 | 4 |
tests/run-make/symbol-visibility/an_rlib.rs+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | #![crate_type="rlib"] | |
| 1 | #![crate_type = "rlib"] | |
| 2 | 2 | |
| 3 | 3 | pub fn public_rust_function_from_rlib() {} |
| 4 | 4 |
tests/run-make/symlinked-extern/bar.rs+1-2| ... | ... | @@ -2,5 +2,4 @@ |
| 2 | 2 | |
| 3 | 3 | extern crate foo; |
| 4 | 4 | |
| 5 | pub fn bar(_s: foo::S) { | |
| 6 | } | |
| 5 | pub fn bar(_s: foo::S) {} |
tests/run-make/symlinked-extern/foo.rs+3-1| ... | ... | @@ -2,4 +2,6 @@ |
| 2 | 2 | |
| 3 | 3 | pub struct S; |
| 4 | 4 | |
| 5 | pub fn foo() -> S { S } | |
| 5 | pub fn foo() -> S { | |
| 6 | S | |
| 7 | } |
tests/run-make/target-cpu-native/foo.rs+1-2| ... | ... | @@ -1,2 +1 @@ |
| 1 | fn main() { | |
| 2 | } | |
| 1 | fn main() {} |
tests/run-make/test-harness/test-ignore-cfg.rs+2-4| ... | ... | @@ -1,9 +1,7 @@ |
| 1 | 1 | #[test] |
| 2 | 2 | #[cfg_attr(ignorecfg, ignore)] |
| 3 | fn shouldignore() { | |
| 4 | } | |
| 3 | fn shouldignore() {} | |
| 5 | 4 | |
| 6 | 5 | #[test] |
| 7 | 6 | #[cfg_attr(noignorecfg, ignore)] |
| 8 | fn shouldnotignore() { | |
| 9 | } | |
| 7 | fn shouldnotignore() {} |
tests/run-make/type-mismatch-same-crate-name/crateA.rs+2-2| ... | ... | @@ -3,7 +3,7 @@ mod foo { |
| 3 | 3 | } |
| 4 | 4 | |
| 5 | 5 | mod bar { |
| 6 | pub trait Bar{} | |
| 6 | pub trait Bar {} | |
| 7 | 7 | |
| 8 | 8 | pub fn bar() -> Box<Bar> { |
| 9 | 9 | unimplemented!() |
| ... | ... | @@ -12,5 +12,5 @@ mod bar { |
| 12 | 12 | |
| 13 | 13 | // This makes the publicly accessible path |
| 14 | 14 | // differ from the internal one. |
| 15 | pub use bar::{bar, Bar}; | |
| 15 | 16 | pub use foo::Foo; |
| 16 | pub use bar::{Bar, bar}; |
tests/run-make/type-mismatch-same-crate-name/crateB.rs+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | 1 | extern crate crateA; |
| 2 | 2 | |
| 3 | pub fn try_foo(x: crateA::Foo){} | |
| 4 | pub fn try_bar(x: Box<crateA::Bar>){} | |
| 3 | pub fn try_foo(x: crateA::Foo) {} | |
| 4 | pub fn try_bar(x: Box<crateA::Bar>) {} |
tests/run-make/use-suggestions-rust-2018/use-suggestions.rs+1-1| ... | ... | @@ -1,3 +1,3 @@ |
| 1 | 1 | fn main() { |
| 2 | let x = Baz{}; | |
| 2 | let x = Baz {}; | |
| 3 | 3 | } |
tests/run-make/wasm-custom-section/bar.rs+1-1| ... | ... | @@ -10,4 +10,4 @@ pub static A: [u8; 2] = [5, 6]; |
| 10 | 10 | pub static B: [u8; 2] = [7, 8]; |
| 11 | 11 | |
| 12 | 12 | #[no_mangle] |
| 13 | pub extern fn foo() {} | |
| 13 | pub extern "C" fn foo() {} |
tests/run-make/wasm-custom-sections-opt/foo.rs+1-1| ... | ... | @@ -13,7 +13,7 @@ pub mod another { |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | #[no_mangle] |
| 16 | pub extern fn foo() { | |
| 16 | pub extern "C" fn foo() { | |
| 17 | 17 | // This will import `another::foo` through ThinLTO passes, and it better not |
| 18 | 18 | // also accidentally import the `FOO` custom section into this module as |
| 19 | 19 | // well |
tests/run-make/wasm-exceptions-nostd/src/arena_alloc.rs+2-7| ... | ... | @@ -14,9 +14,7 @@ pub struct ArenaAllocator { |
| 14 | 14 | |
| 15 | 15 | impl ArenaAllocator { |
| 16 | 16 | pub const fn new() -> Self { |
| 17 | Self { | |
| 18 | arena: UnsafeCell::new(Arena::new()), | |
| 19 | } | |
| 17 | Self { arena: UnsafeCell::new(Arena::new()) } | |
| 20 | 18 | } |
| 21 | 19 | } |
| 22 | 20 | |
| ... | ... | @@ -42,10 +40,7 @@ struct Arena { |
| 42 | 40 | |
| 43 | 41 | impl Arena { |
| 44 | 42 | pub const fn new() -> Self { |
| 45 | Self { | |
| 46 | buf: [0x55; ARENA_SIZE], | |
| 47 | allocated: 0, | |
| 48 | } | |
| 43 | Self { buf: [0x55; ARENA_SIZE], allocated: 0 } | |
| 49 | 44 | } |
| 50 | 45 | |
| 51 | 46 | pub unsafe fn alloc(&mut self, layout: Layout) -> *mut u8 { |
tests/run-make/wasm-exceptions-nostd/src/lib.rs+18-16| ... | ... | @@ -1,9 +1,7 @@ |
| 1 | 1 | #![no_std] |
| 2 | 2 | #![crate_type = "cdylib"] |
| 3 | ||
| 4 | 3 | // Allow a few unstable features because we create a panic |
| 5 | 4 | // runtime for native wasm exceptions from scratch |
| 6 | ||
| 7 | 5 | #![feature(core_intrinsics)] |
| 8 | 6 | #![feature(lang_items)] |
| 9 | 7 | #![feature(link_llvm_intrinsics)] |
| ... | ... | @@ -39,20 +37,24 @@ pub extern "C" fn start() -> usize { |
| 39 | 37 | let data = 0x1234usize as *mut u8; // Something to recognize |
| 40 | 38 | |
| 41 | 39 | unsafe { |
| 42 | core::intrinsics::catch_unwind(|data: *mut u8| { | |
| 43 | let _log_on_drop = LogOnDrop; | |
| 44 | ||
| 45 | logging::log_str(&alloc::format!("`r#try` called with ptr {:?}", data)); | |
| 46 | let x = [12]; | |
| 47 | let _ = x[4]; // should panic | |
| 48 | ||
| 49 | logging::log_str("This line should not be visible! :("); | |
| 50 | }, data, |data, exception| { | |
| 51 | let exception = *Box::from_raw(exception as *mut String); | |
| 52 | logging::log_str("Caught something!"); | |
| 53 | logging::log_str(&alloc::format!(" data : {:?}", data)); | |
| 54 | logging::log_str(&alloc::format!(" exception: {:?}", exception)); | |
| 55 | }); | |
| 40 | core::intrinsics::catch_unwind( | |
| 41 | |data: *mut u8| { | |
| 42 | let _log_on_drop = LogOnDrop; | |
| 43 | ||
| 44 | logging::log_str(&alloc::format!("`r#try` called with ptr {:?}", data)); | |
| 45 | let x = [12]; | |
| 46 | let _ = x[4]; // should panic | |
| 47 | ||
| 48 | logging::log_str("This line should not be visible! :("); | |
| 49 | }, | |
| 50 | data, | |
| 51 | |data, exception| { | |
| 52 | let exception = *Box::from_raw(exception as *mut String); | |
| 53 | logging::log_str("Caught something!"); | |
| 54 | logging::log_str(&alloc::format!(" data : {:?}", data)); | |
| 55 | logging::log_str(&alloc::format!(" exception: {:?}", exception)); | |
| 56 | }, | |
| 57 | ); | |
| 56 | 58 | } |
| 57 | 59 | |
| 58 | 60 | logging::log_str("This program terminates correctly."); |
tests/run-make/wasm-exceptions-nostd/src/panicking.rs+1-4| ... | ... | @@ -17,10 +17,7 @@ fn panic_handler(info: &core::panic::PanicInfo<'_>) -> ! { |
| 17 | 17 | use alloc::boxed::Box; |
| 18 | 18 | use alloc::string::ToString; |
| 19 | 19 | |
| 20 | let msg = info | |
| 21 | .message() | |
| 22 | .map(|msg| msg.to_string()) | |
| 23 | .unwrap_or("(no message)".to_string()); | |
| 20 | let msg = info.message().map(|msg| msg.to_string()).unwrap_or("(no message)".to_string()); | |
| 24 | 21 | let exception = Box::new(msg.to_string()); |
| 25 | 22 | unsafe { |
| 26 | 23 | let exception_raw = Box::into_raw(exception); |
tests/run-make/wasm-export-all-symbols/bar.rs+1-1| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | #![crate_type = "rlib"] |
| 2 | 2 | |
| 3 | 3 | #[no_mangle] |
| 4 | pub extern fn foo() {} | |
| 4 | pub extern "C" fn foo() {} | |
| 5 | 5 | |
| 6 | 6 | #[no_mangle] |
| 7 | 7 | pub static FOO: u64 = 42; |
tests/run-make/wasm-symbols-not-exported/bar.rs+2-3| ... | ... | @@ -11,15 +11,14 @@ unsafe impl GlobalAlloc for B { |
| 11 | 11 | 1 as *mut u8 |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | unsafe fn dealloc(&self, ptr: *mut u8, x: Layout) { | |
| 15 | } | |
| 14 | unsafe fn dealloc(&self, ptr: *mut u8, x: Layout) {} | |
| 16 | 15 | } |
| 17 | 16 | |
| 18 | 17 | #[global_allocator] |
| 19 | 18 | static A: B = B; |
| 20 | 19 | |
| 21 | 20 | #[no_mangle] |
| 22 | pub extern fn foo(a: u32) -> u32 { | |
| 21 | pub extern "C" fn foo(a: u32) -> u32 { | |
| 23 | 22 | assert_eq!(a, 3); |
| 24 | 23 | a * 2 |
| 25 | 24 | } |
tests/run-make/wasm-symbols-not-exported/foo.rs+1-1| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | #![crate_type = "cdylib"] |
| 2 | 2 | |
| 3 | 3 | #[no_mangle] |
| 4 | pub extern fn foo() { | |
| 4 | pub extern "C" fn foo() { | |
| 5 | 5 | println!("foo"); |
| 6 | 6 | panic!("test"); |
| 7 | 7 | } |
tests/run-make/wasm-symbols-not-imported/foo.rs+1-1| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | use core::panic::PanicInfo; |
| 5 | 5 | |
| 6 | 6 | #[no_mangle] |
| 7 | pub extern fn foo() { | |
| 7 | pub extern "C" fn foo() { | |
| 8 | 8 | panic!() |
| 9 | 9 | } |
| 10 | 10 |
tests/run-make/windows-spawn/spawn.rs+1-1| ... | ... | @@ -6,5 +6,5 @@ fn main() { |
| 6 | 6 | assert_eq!( |
| 7 | 7 | Command::new("hopefullydoesntexist").arg("bar").spawn().unwrap_err().kind(), |
| 8 | 8 | ErrorKind::NotFound |
| 9 | ) | |
| 9 | ); | |
| 10 | 10 | } |
tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/build.rs+8-16| ... | ... | @@ -1,17 +1,9 @@ |
| 1 | 1 | fn main() { |
| 2 | cc::Build::new() | |
| 3 | .file("foo.c") | |
| 4 | .compile("foo_c"); | |
| 2 | cc::Build::new().file("foo.c").compile("foo_c"); | |
| 5 | 3 | |
| 6 | cc::Build::new() | |
| 7 | .file("foo_asm.s") | |
| 8 | .compile("foo_asm"); | |
| 4 | cc::Build::new().file("foo_asm.s").compile("foo_asm"); | |
| 9 | 5 | |
| 10 | cc::Build::new() | |
| 11 | .cpp(true) | |
| 12 | .cpp_set_stdlib(None) | |
| 13 | .file("foo_cxx.cpp") | |
| 14 | .compile("foo_cxx"); | |
| 6 | cc::Build::new().cpp(true).cpp_set_stdlib(None).file("foo_cxx.cpp").compile("foo_cxx"); | |
| 15 | 7 | |
| 16 | 8 | // When the cmake crate detects the clang compiler, it passes the |
| 17 | 9 | // "--target" argument to the linker which subsequently fails. The |
| ... | ... | @@ -20,11 +12,11 @@ fn main() { |
| 20 | 12 | // `CMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY` can be used |
| 21 | 13 | // https://cmake.org/cmake/help/v3.5/module/CMakeForceCompiler.html |
| 22 | 14 | let dst = cmake::Config::new("libcmake_foo") |
| 23 | .build_target("cmake_foo") | |
| 24 | .define("CMAKE_C_COMPILER_FORCED", "1") | |
| 25 | .define("CMAKE_CXX_COMPILER_FORCED", "1") | |
| 26 | .define("CMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY", "1") | |
| 27 | .build(); | |
| 15 | .build_target("cmake_foo") | |
| 16 | .define("CMAKE_C_COMPILER_FORCED", "1") | |
| 17 | .define("CMAKE_CXX_COMPILER_FORCED", "1") | |
| 18 | .define("CMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY", "1") | |
| 19 | .build(); | |
| 28 | 20 | println!("cargo:rustc-link-search=native={}/build/", dst.display()); |
| 29 | 21 | println!("cargo:rustc-link-lib=static=cmake_foo"); |
| 30 | 22 | } |