diff options
Diffstat (limited to 'tests/codegen')
22 files changed, 113 insertions, 132 deletions
diff --git a/tests/codegen/asm/aarch64-clobbers.rs b/tests/codegen/asm/aarch64-clobbers.rs index 900e6629fd2..dd3ba1510b5 100644 --- a/tests/codegen/asm/aarch64-clobbers.rs +++ b/tests/codegen/asm/aarch64-clobbers.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: aarch64 aarch64_fixed_x18 aarch64_no_x18 aarch64_reserve_x18 arm64ec //@[aarch64] compile-flags: --target aarch64-unknown-linux-gnu //@[aarch64] needs-llvm-components: aarch64 @@ -14,16 +15,11 @@ // ignore-tidy-linelength #![crate_type = "rlib"] -#![feature(no_core, rustc_attrs, lang_items)] +#![feature(no_core)] #![no_core] -#[lang = "sized"] -trait Sized {} - -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} +extern crate minicore; +use minicore::*; // CHECK-LABEL: @cc_clobber // CHECK: call void asm sideeffect "", "~{cc}"() diff --git a/tests/codegen/asm/avr-clobbers.rs b/tests/codegen/asm/avr-clobbers.rs index 6e0c75368e2..56218cd7bcf 100644 --- a/tests/codegen/asm/avr-clobbers.rs +++ b/tests/codegen/asm/avr-clobbers.rs @@ -1,18 +1,14 @@ +//@ add-core-stubs //@ assembly-output: emit-asm //@ compile-flags: --target avr-unknown-gnu-atmega328 //@ needs-llvm-components: avr #![crate_type = "rlib"] -#![feature(no_core, rustc_attrs, lang_items, asm_experimental_arch)] +#![feature(no_core, asm_experimental_arch)] #![no_core] -#[lang = "sized"] -trait Sized {} - -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} +extern crate minicore; +use minicore::*; // CHECK-LABEL: @sreg_is_clobbered // CHECK: void asm sideeffect "", "~{sreg}"() diff --git a/tests/codegen/asm/hexagon-clobbers.rs b/tests/codegen/asm/hexagon-clobbers.rs index 6bb662ead99..800b8964669 100644 --- a/tests/codegen/asm/hexagon-clobbers.rs +++ b/tests/codegen/asm/hexagon-clobbers.rs @@ -1,19 +1,15 @@ +//@ add-core-stubs //@ revisions: hexagon //@[hexagon] compile-flags: --target hexagon-unknown-linux-musl //@[hexagon] needs-llvm-components: hexagon //@ compile-flags: -Zmerge-functions=disabled #![crate_type = "rlib"] -#![feature(no_core, rustc_attrs, lang_items, asm_experimental_arch)] +#![feature(no_core, asm_experimental_arch)] #![no_core] -#[lang = "sized"] -trait Sized {} - -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} +extern crate minicore; +use minicore::*; // CHECK-LABEL: @flags_clobber // CHECK: call void asm sideeffect "", ""() diff --git a/tests/codegen/asm/msp430-clobbers.rs b/tests/codegen/asm/msp430-clobbers.rs index c00c04f3088..2c8d29cffc4 100644 --- a/tests/codegen/asm/msp430-clobbers.rs +++ b/tests/codegen/asm/msp430-clobbers.rs @@ -1,18 +1,14 @@ +//@ add-core-stubs //@ assembly-output: emit-asm //@ compile-flags: --target msp430-none-elf //@ needs-llvm-components: msp430 #![crate_type = "rlib"] -#![feature(no_core, rustc_attrs, lang_items, asm_experimental_arch)] +#![feature(no_core, asm_experimental_arch)] #![no_core] -#[lang = "sized"] -trait Sized {} - -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} +extern crate minicore; +use minicore::*; // CHECK-LABEL: @sr_clobber // CHECK: call void asm sideeffect "", "~{sr}"() diff --git a/tests/codegen/asm/powerpc-clobbers.rs b/tests/codegen/asm/powerpc-clobbers.rs index 2832377cef0..f7fc7eea5d5 100644 --- a/tests/codegen/asm/powerpc-clobbers.rs +++ b/tests/codegen/asm/powerpc-clobbers.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: powerpc powerpc64 powerpc64le aix64 //@[powerpc] compile-flags: --target powerpc-unknown-linux-gnu //@[powerpc] needs-llvm-components: powerpc @@ -10,16 +11,11 @@ // ignore-tidy-linelength #![crate_type = "rlib"] -#![feature(no_core, rustc_attrs, lang_items, asm_experimental_arch)] +#![feature(no_core, asm_experimental_arch)] #![no_core] -#[lang = "sized"] -trait Sized {} - -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} +extern crate minicore; +use minicore::*; // CHECK-LABEL: @cr_clobber // CHECK: call void asm sideeffect "", "~{cr}"() diff --git a/tests/codegen/asm/riscv-clobbers.rs b/tests/codegen/asm/riscv-clobbers.rs index 59b2705a449..e55b6731098 100644 --- a/tests/codegen/asm/riscv-clobbers.rs +++ b/tests/codegen/asm/riscv-clobbers.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ assembly-output: emit-asm //@ revisions: rv32i rv64i rv32e //@[rv32i] compile-flags: --target riscv32i-unknown-none-elf @@ -9,16 +10,11 @@ // ignore-tidy-linelength #![crate_type = "rlib"] -#![feature(no_core, rustc_attrs, lang_items)] +#![feature(no_core)] #![no_core] -#[lang = "sized"] -trait Sized {} - -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} +extern crate minicore; +use minicore::*; // CHECK-LABEL: @flags_clobber // CHECK: call void asm sideeffect "", "~{vtype},~{vl},~{vxsat},~{vxrm}"() diff --git a/tests/codegen/asm/s390x-clobbers.rs b/tests/codegen/asm/s390x-clobbers.rs index 56d82b4b044..cbb6630553c 100644 --- a/tests/codegen/asm/s390x-clobbers.rs +++ b/tests/codegen/asm/s390x-clobbers.rs @@ -1,18 +1,14 @@ +//@ add-core-stubs //@ revisions: s390x //@[s390x] compile-flags: --target s390x-unknown-linux-gnu //@[s390x] needs-llvm-components: systemz #![crate_type = "rlib"] -#![feature(no_core, rustc_attrs, lang_items)] +#![feature(no_core)] #![no_core] -#[lang = "sized"] -trait Sized {} - -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} +extern crate minicore; +use minicore::*; // CHECK-LABEL: @cc_clobber // CHECK: call void asm sideeffect "", "~{cc}"() diff --git a/tests/codegen/asm/sanitize-llvm.rs b/tests/codegen/asm/sanitize-llvm.rs index fb332f9a0f3..97a77033284 100644 --- a/tests/codegen/asm/sanitize-llvm.rs +++ b/tests/codegen/asm/sanitize-llvm.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs // FIXME(nagisa): remove the flags below once all targets support `asm!`. //@ compile-flags: --target x86_64-unknown-linux-gnu -Copt-level=0 //@ needs-llvm-components: x86 @@ -5,19 +6,12 @@ // Verify we sanitize the special tokens for the LLVM inline-assembly, ensuring people won't // inadvertently rely on the LLVM-specific syntax and features. #![no_core] -#![feature(no_core, lang_items, rustc_attrs)] +#![feature(no_core)] #![crate_type = "rlib"] #![allow(named_asm_labels)] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; pub unsafe fn we_escape_dollar_signs() { // CHECK: call void asm sideeffect alignstack inteldialect "banana$$:" diff --git a/tests/codegen/asm/sparc-clobbers.rs b/tests/codegen/asm/sparc-clobbers.rs index 843abd55352..a71715ed94d 100644 --- a/tests/codegen/asm/sparc-clobbers.rs +++ b/tests/codegen/asm/sparc-clobbers.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: sparc sparcv8plus sparc64 //@[sparc] compile-flags: --target sparc-unknown-none-elf //@[sparc] needs-llvm-components: sparc @@ -7,16 +8,11 @@ //@[sparc64] needs-llvm-components: sparc #![crate_type = "rlib"] -#![feature(no_core, rustc_attrs, lang_items, asm_experimental_arch)] +#![feature(no_core, asm_experimental_arch)] #![no_core] -#[lang = "sized"] -trait Sized {} - -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} +extern crate minicore; +use minicore::*; // CHECK-LABEL: @cc_clobber // CHECK: call void asm sideeffect "", "~{icc},~{fcc0},~{fcc1},~{fcc2},~{fcc3}"() diff --git a/tests/codegen/async-fn-debug-awaitee-field.rs b/tests/codegen/async-fn-debug-awaitee-field.rs index d1a7d738e9e..ab13d4509e2 100644 --- a/tests/codegen/async-fn-debug-awaitee-field.rs +++ b/tests/codegen/async-fn-debug-awaitee-field.rs @@ -1,8 +1,12 @@ -// This test makes sure that the coroutine field capturing the awaitee in a `.await` expression -// is called "__awaitee" in debuginfo. This name must not be changed since debuggers and debugger -// extensions rely on the field having this name. - // ignore-tidy-linelength +//! This test makes sure that the coroutine field capturing the awaitee in a `.await` expression +//! is called `__awaitee` in debuginfo. This name must not be changed since debuggers and debugger +//! extensions rely on the field having this name. + +//@ revisions: MSVC NONMSVC +//@[MSVC] only-msvc +//@[NONMSVC] ignore-msvc + //@ compile-flags: -C debuginfo=2 --edition=2018 -Copt-level=0 #![crate_type = "lib"] diff --git a/tests/codegen/debug-accessibility/crate-enum.rs b/tests/codegen/debug-accessibility/crate-enum.rs index c80700d7b28..9ad5a6fd0ff 100644 --- a/tests/codegen/debug-accessibility/crate-enum.rs +++ b/tests/codegen/debug-accessibility/crate-enum.rs @@ -1,9 +1,11 @@ -//@ compile-flags: -C debuginfo=2 // ignore-tidy-linelength +//! Checks that visibility information is present in the debuginfo for crate-visibility enums. -#![allow(dead_code)] +//@ revisions: MSVC NONMSVC +//@[MSVC] only-msvc +//@[NONMSVC] ignore-msvc -// Checks that visibility information is present in the debuginfo for crate-visibility enums. +//@ compile-flags: -C debuginfo=2 mod module { use std::hint::black_box; diff --git a/tests/codegen/debug-accessibility/private-enum.rs b/tests/codegen/debug-accessibility/private-enum.rs index 22d49a40eff..002336c03b3 100644 --- a/tests/codegen/debug-accessibility/private-enum.rs +++ b/tests/codegen/debug-accessibility/private-enum.rs @@ -1,9 +1,10 @@ -//@ compile-flags: -C debuginfo=2 // ignore-tidy-linelength +//! Checks that visibility information is present in the debuginfo for private enums. -#![allow(dead_code)] - -// Checks that visibility information is present in the debuginfo for private enums. +//@ revisions: MSVC NONMSVC +//@[MSVC] only-msvc +//@[NONMSVC] ignore-msvc +//@ compile-flags: -C debuginfo=2 use std::hint::black_box; diff --git a/tests/codegen/debug-accessibility/public-enum.rs b/tests/codegen/debug-accessibility/public-enum.rs index f16ccf1a3c9..e5cd1ab7350 100644 --- a/tests/codegen/debug-accessibility/public-enum.rs +++ b/tests/codegen/debug-accessibility/public-enum.rs @@ -1,9 +1,11 @@ -//@ compile-flags: -C debuginfo=2 // ignore-tidy-linelength +//! Checks that visibility information is present in the debuginfo for types and their fields. -#![allow(dead_code)] +//@ revisions: MSVC NONMSVC +//@[MSVC] only-msvc +//@[NONMSVC] ignore-msvc -// Checks that visibility information is present in the debuginfo for types and their fields. +//@ compile-flags: -C debuginfo=2 use std::hint::black_box; diff --git a/tests/codegen/debug-accessibility/super-enum.rs b/tests/codegen/debug-accessibility/super-enum.rs index 1b6d7d793ed..8e34d8be01f 100644 --- a/tests/codegen/debug-accessibility/super-enum.rs +++ b/tests/codegen/debug-accessibility/super-enum.rs @@ -1,9 +1,10 @@ -//@ compile-flags: -C debuginfo=2 // ignore-tidy-linelength +//! Checks that visibility information is present in the debuginfo for super-visibility enums. -#![allow(dead_code)] - -// Checks that visibility information is present in the debuginfo for super-visibility enums. +//@ revisions: MSVC NONMSVC +//@[MSVC] only-msvc +//@[NONMSVC] ignore-msvc +//@ compile-flags: -C debuginfo=2 mod module { use std::hint::black_box; diff --git a/tests/codegen/debug-vtable.rs b/tests/codegen/debug-vtable.rs index 036fff6cd23..b9808e4079b 100644 --- a/tests/codegen/debug-vtable.rs +++ b/tests/codegen/debug-vtable.rs @@ -1,5 +1,10 @@ -// This test checks the debuginfo for the expected 3 vtables is generated for correct names and number -// of entries. +// ignore-tidy-linelength +//! This test checks the debuginfo for the expected 3 vtables is generated for correct names and +//! number of entries. + +//@ revisions: MSVC NONMSVC +//@[MSVC] only-msvc +//@[NONMSVC] ignore-msvc // Use the v0 symbol mangling scheme to codegen order independent of rustc version. // Unnamed items like shims are generated in lexicographical order of their symbol name and in the @@ -7,7 +12,6 @@ // of the name, thus randomizing item order with respect to rustc version. //@ compile-flags: -Cdebuginfo=2 -Copt-level=0 -Csymbol-mangling-version=v0 -// ignore-tidy-linelength // Make sure that vtables don't have the unnamed_addr attribute when debuginfo is enabled. // This helps debuggers more reliably map from dyn pointer to concrete type. diff --git a/tests/codegen/debuginfo-generic-closure-env-names.rs b/tests/codegen/debuginfo-generic-closure-env-names.rs index 6d56fbc40ab..6b314c9abae 100644 --- a/tests/codegen/debuginfo-generic-closure-env-names.rs +++ b/tests/codegen/debuginfo-generic-closure-env-names.rs @@ -1,14 +1,17 @@ -// This test checks that we get proper type names for closure environments and -// async-fn environments in debuginfo, especially making sure that generic arguments -// of the enclosing functions don't get lost. -// -// Unfortunately, the order that debuginfo gets emitted into LLVM IR becomes a bit hard -// to predict once async fns are involved, so DAG allows any order. -// -// Note that the test does not check async-fns when targeting MSVC because debuginfo for -// those does not follow the enum-fallback encoding yet and thus is incomplete. - // ignore-tidy-linelength +//! This test checks that we get proper type names for closure environments and +//! async-fn environments in debuginfo, especially making sure that generic arguments +//! of the enclosing functions don't get lost. +//! +//! Unfortunately, the order that debuginfo gets emitted into LLVM IR becomes a bit hard +//! to predict once async fns are involved, so DAG allows any order. +//! +//! Note that the test does not check async-fns when targeting MSVC because debuginfo for +//! those does not follow the enum-fallback encoding yet and thus is incomplete. + +//@ revisions: MSVC NONMSVC +//@[MSVC] only-msvc +//@[NONMSVC] ignore-msvc // Use the v0 symbol mangling scheme to codegen order independent of rustc version. // Unnamed items like shims are generated in lexicographical order of their symbol name and in the diff --git a/tests/codegen/issues/issue-15953.rs b/tests/codegen/issues/issue-15953.rs index 28d28428904..70e597ac1dd 100644 --- a/tests/codegen/issues/issue-15953.rs +++ b/tests/codegen/issues/issue-15953.rs @@ -9,7 +9,7 @@ struct Foo { #[no_mangle] // CHECK: memcpy fn interior(x: Vec<i32>) -> Vec<i32> { - let Foo { x } = Foo { x: x }; + let Foo { x } = Foo { x }; x } diff --git a/tests/codegen/issues/issue-98678-async.rs b/tests/codegen/issues/issue-98678-async.rs index 75f5d82eee5..3dd06bb5194 100644 --- a/tests/codegen/issues/issue-98678-async.rs +++ b/tests/codegen/issues/issue-98678-async.rs @@ -1,11 +1,13 @@ -// This test verifies the accuracy of emitted file and line debuginfo metadata for async blocks and -// async functions. -// +// ignore-tidy-linelength +//! This test verifies the accuracy of emitted file and line debuginfo metadata for async blocks and +//! async functions. + +//@ revisions: MSVC NONMSVC +//@[MSVC] only-msvc +//@[NONMSVC] ignore-msvc //@ edition:2021 //@ compile-flags: --crate-type=lib -Copt-level=0 -Cdebuginfo=2 -Zdebug-info-type-line-numbers=true -// ignore-tidy-linelength - // NONMSVC-DAG: ![[#FILE:]] = !DIFile({{.*}}filename:{{.*[/\\]}}issue-98678-async.rs{{".*}}) // MSVC: ![[#FILE:]] = !DIFile({{.*}}filename:{{.*}}\\issue-98678-async.rs{{".*}}) diff --git a/tests/codegen/issues/issue-98678-closure-coroutine.rs b/tests/codegen/issues/issue-98678-closure-coroutine.rs index 0730e56bf31..8763bcb799d 100644 --- a/tests/codegen/issues/issue-98678-closure-coroutine.rs +++ b/tests/codegen/issues/issue-98678-closure-coroutine.rs @@ -1,10 +1,13 @@ -// This test verifies the accuracy of emitted file and line debuginfo metadata for closures and -// coroutines. -// -//@ compile-flags: --crate-type=lib -Copt-level=0 -Cdebuginfo=2 -Zdebug-info-type-line-numbers=true +// ignore-tidy-linelength +//! This test verifies the accuracy of emitted file and line debuginfo metadata for closures and +//! coroutines. + #![feature(coroutines, stmt_expr_attributes)] -// ignore-tidy-linelength +//@ revisions: MSVC NONMSVC +//@[MSVC] only-msvc +//@[NONMSVC] ignore-msvc +//@ compile-flags: --crate-type=lib -Copt-level=0 -Cdebuginfo=2 -Zdebug-info-type-line-numbers=true // NONMSVC-DAG: ![[#FILE:]] = !DIFile({{.*}}filename:{{.*[/\\]}}issue-98678-closure-coroutine.rs{{".*}}) // MSVC-DAG: ![[#FILE:]] = !DIFile({{.*}}filename:{{.*}}\\issue-98678-closure-coroutine.rs{{".*}}) diff --git a/tests/codegen/issues/issue-98678-enum.rs b/tests/codegen/issues/issue-98678-enum.rs index 62c6cded866..87bf8797293 100644 --- a/tests/codegen/issues/issue-98678-enum.rs +++ b/tests/codegen/issues/issue-98678-enum.rs @@ -1,8 +1,10 @@ -// This test verifies the accuracy of emitted file and line debuginfo metadata enums. -// -//@ compile-flags: --crate-type=lib -Copt-level=0 -Cdebuginfo=2 -Zdebug-info-type-line-numbers=true - // ignore-tidy-linelength +//! This test verifies the accuracy of emitted file and line debuginfo metadata enums. + +//@ revisions: MSVC NONMSVC +//@[MSVC] only-msvc +//@[NONMSVC] ignore-msvc +//@ compile-flags: --crate-type=lib -Copt-level=0 -Cdebuginfo=2 -Zdebug-info-type-line-numbers=true // NONMSVC: ![[#FILE:]] = !DIFile({{.*}}filename:{{.*[/\\]}}issue-98678-enum.rs{{".*}}) // MSVC: ![[#FILE:]] = !DIFile({{.*}}filename:{{.*}}\\issue-98678-enum.rs{{".*}}) diff --git a/tests/codegen/issues/issue-98678-struct-union.rs b/tests/codegen/issues/issue-98678-struct-union.rs index bf2d6e731aa..a83a585a433 100644 --- a/tests/codegen/issues/issue-98678-struct-union.rs +++ b/tests/codegen/issues/issue-98678-struct-union.rs @@ -1,9 +1,11 @@ -// This test verifies the accuracy of emitted file and line debuginfo metadata for structs and -// unions. -// -//@ compile-flags: --crate-type=lib -Copt-level=0 -Cdebuginfo=2 -Zdebug-info-type-line-numbers=true - // ignore-tidy-linelength +//! This test verifies the accuracy of emitted file and line debuginfo metadata for structs and +//! unions. + +//@ revisions: MSVC NONMSVC +//@[MSVC] only-msvc +//@[NONMSVC] ignore-msvc +//@ compile-flags: --crate-type=lib -Copt-level=0 -Cdebuginfo=2 -Zdebug-info-type-line-numbers=true // NONMSVC: ![[#FILE:]] = !DIFile({{.*}}filename:{{.*[/\\]}}issue-98678-struct-union.rs{{".*}}) // MSVC: ![[#FILE:]] = !DIFile({{.*}}filename:{{.*}}\\issue-98678-struct-union.rs{{".*}}) diff --git a/tests/codegen/meta-filecheck/msvc-prefix-good.rs b/tests/codegen/meta-filecheck/msvc-prefix-good.rs deleted file mode 100644 index 580d20d5438..00000000000 --- a/tests/codegen/meta-filecheck/msvc-prefix-good.rs +++ /dev/null @@ -1,7 +0,0 @@ -// One of MSVC or NONMSVC should always be defined, so this test should pass. - -// (one of these should always be present) - -// MSVC: main -// NONMSVC: main -fn main() {} |
