tests/ui: prepare some tests for --check-cfg by default
This commit is contained in:
parent
d6d3b342e8
commit
ed81578820
@ -1,22 +1,19 @@
|
|||||||
// Test that `-Cinstrument-coverage=off` does not add coverage instrumentation to LLVM IR.
|
// Test that `-Cinstrument-coverage=off` does not add coverage instrumentation to LLVM IR.
|
||||||
|
|
||||||
//@ needs-profiler-support
|
//@ revisions: n no off false_ zero
|
||||||
//@ revisions: n no off false zero
|
|
||||||
//@ [n] compile-flags: -Cinstrument-coverage=n
|
//@ [n] compile-flags: -Cinstrument-coverage=n
|
||||||
//@ [no] compile-flags: -Cinstrument-coverage=no
|
//@ [no] compile-flags: -Cinstrument-coverage=no
|
||||||
//@ [off] compile-flags: -Cinstrument-coverage=off
|
//@ [off] compile-flags: -Cinstrument-coverage=off
|
||||||
//@ [false] compile-flags: -Cinstrument-coverage=false
|
//@ [false_] compile-flags: -Cinstrument-coverage=false
|
||||||
//@ [zero] compile-flags: -Cinstrument-coverage=0
|
//@ [zero] compile-flags: -Cinstrument-coverage=0
|
||||||
|
|
||||||
// CHECK-NOT: __llvm_profile_filename
|
// CHECK-NOT: __llvm_profile_filename
|
||||||
// CHECK-NOT: __llvm_coverage_mapping
|
// CHECK-NOT: __llvm_coverage_mapping
|
||||||
|
|
||||||
#![crate_type="lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
#[inline(never)]
|
#[inline(never)]
|
||||||
fn some_function() {
|
fn some_function() {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn some_other_function() {
|
pub fn some_other_function() {
|
||||||
some_function();
|
some_function();
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
// Test that `-Cinstrument-coverage` creates expected __llvm_profile_filename symbol in LLVM IR.
|
// Test that `-Cinstrument-coverage` creates expected __llvm_profile_filename symbol in LLVM IR.
|
||||||
|
|
||||||
//@ needs-profiler-support
|
//@ needs-profiler-support
|
||||||
//@ revisions: default y yes on true all
|
//@ revisions: default y yes on true_ all
|
||||||
//@ [default] compile-flags: -Cinstrument-coverage
|
//@ [default] compile-flags: -Cinstrument-coverage
|
||||||
//@ [y] compile-flags: -Cinstrument-coverage=y
|
//@ [y] compile-flags: -Cinstrument-coverage=y
|
||||||
//@ [yes] compile-flags: -Cinstrument-coverage=yes
|
//@ [yes] compile-flags: -Cinstrument-coverage=yes
|
||||||
//@ [on] compile-flags: -Cinstrument-coverage=on
|
//@ [on] compile-flags: -Cinstrument-coverage=on
|
||||||
//@ [true] compile-flags: -Cinstrument-coverage=true
|
//@ [true_] compile-flags: -Cinstrument-coverage=true
|
||||||
//@ [all] compile-flags: -Cinstrument-coverage=all
|
//@ [all] compile-flags: -Cinstrument-coverage=all
|
||||||
|
|
||||||
// CHECK: @__llvm_profile_filename = {{.*}}"default_%m_%p.profraw\00"{{.*}}
|
// CHECK: @__llvm_profile_filename = {{.*}}"default_%m_%p.profraw\00"{{.*}}
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
#[cfg(target(os = "x"))] //~ ERROR compact `cfg(target(..))` is experimental
|
#[cfg(target(os = "linux"))] //~ ERROR compact `cfg(target(..))` is experimental
|
||||||
struct Foo(u64, u64);
|
struct Foo(u64, u64);
|
||||||
|
|
||||||
#[cfg_attr(target(os = "x"), x)] //~ ERROR compact `cfg(target(..))` is experimental
|
#[cfg_attr(target(os = "linux"), non_exhaustive)] //~ ERROR compact `cfg(target(..))` is experimental
|
||||||
struct Bar(u64, u64);
|
struct Bar(u64, u64);
|
||||||
|
|
||||||
#[cfg(not(any(all(target(os = "x")))))] //~ ERROR compact `cfg(target(..))` is experimental
|
#[cfg(not(any(all(target(os = "linux")))))] //~ ERROR compact `cfg(target(..))` is experimental
|
||||||
fn foo() {}
|
fn foo() {}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
cfg!(target(os = "x"));
|
cfg!(target(os = "linux"));
|
||||||
//~^ ERROR compact `cfg(target(..))` is experimental and subject to change
|
//~^ ERROR compact `cfg(target(..))` is experimental and subject to change
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
error[E0658]: compact `cfg(target(..))` is experimental and subject to change
|
error[E0658]: compact `cfg(target(..))` is experimental and subject to change
|
||||||
--> $DIR/feature-gate-cfg-target-compact.rs:1:7
|
--> $DIR/feature-gate-cfg-target-compact.rs:1:7
|
||||||
|
|
|
|
||||||
LL | #[cfg(target(os = "x"))]
|
LL | #[cfg(target(os = "linux"))]
|
||||||
| ^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: see issue #96901 <https://github.com/rust-lang/rust/issues/96901> for more information
|
= note: see issue #96901 <https://github.com/rust-lang/rust/issues/96901> for more information
|
||||||
= help: add `#![feature(cfg_target_compact)]` to the crate attributes to enable
|
= help: add `#![feature(cfg_target_compact)]` to the crate attributes to enable
|
||||||
@ -11,8 +11,8 @@ LL | #[cfg(target(os = "x"))]
|
|||||||
error[E0658]: compact `cfg(target(..))` is experimental and subject to change
|
error[E0658]: compact `cfg(target(..))` is experimental and subject to change
|
||||||
--> $DIR/feature-gate-cfg-target-compact.rs:4:12
|
--> $DIR/feature-gate-cfg-target-compact.rs:4:12
|
||||||
|
|
|
|
||||||
LL | #[cfg_attr(target(os = "x"), x)]
|
LL | #[cfg_attr(target(os = "linux"), non_exhaustive)]
|
||||||
| ^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: see issue #96901 <https://github.com/rust-lang/rust/issues/96901> for more information
|
= note: see issue #96901 <https://github.com/rust-lang/rust/issues/96901> for more information
|
||||||
= help: add `#![feature(cfg_target_compact)]` to the crate attributes to enable
|
= help: add `#![feature(cfg_target_compact)]` to the crate attributes to enable
|
||||||
@ -21,8 +21,8 @@ LL | #[cfg_attr(target(os = "x"), x)]
|
|||||||
error[E0658]: compact `cfg(target(..))` is experimental and subject to change
|
error[E0658]: compact `cfg(target(..))` is experimental and subject to change
|
||||||
--> $DIR/feature-gate-cfg-target-compact.rs:7:19
|
--> $DIR/feature-gate-cfg-target-compact.rs:7:19
|
||||||
|
|
|
|
||||||
LL | #[cfg(not(any(all(target(os = "x")))))]
|
LL | #[cfg(not(any(all(target(os = "linux")))))]
|
||||||
| ^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: see issue #96901 <https://github.com/rust-lang/rust/issues/96901> for more information
|
= note: see issue #96901 <https://github.com/rust-lang/rust/issues/96901> for more information
|
||||||
= help: add `#![feature(cfg_target_compact)]` to the crate attributes to enable
|
= help: add `#![feature(cfg_target_compact)]` to the crate attributes to enable
|
||||||
@ -31,8 +31,8 @@ LL | #[cfg(not(any(all(target(os = "x")))))]
|
|||||||
error[E0658]: compact `cfg(target(..))` is experimental and subject to change
|
error[E0658]: compact `cfg(target(..))` is experimental and subject to change
|
||||||
--> $DIR/feature-gate-cfg-target-compact.rs:11:10
|
--> $DIR/feature-gate-cfg-target-compact.rs:11:10
|
||||||
|
|
|
|
||||||
LL | cfg!(target(os = "x"));
|
LL | cfg!(target(os = "linux"));
|
||||||
| ^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: see issue #96901 <https://github.com/rust-lang/rust/issues/96901> for more information
|
= note: see issue #96901 <https://github.com/rust-lang/rust/issues/96901> for more information
|
||||||
= help: add `#![feature(cfg_target_compact)]` to the crate attributes to enable
|
= help: add `#![feature(cfg_target_compact)]` to the crate attributes to enable
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
//@ check-pass
|
//@ check-pass
|
||||||
//@ needs-profiler-support
|
//@ needs-profiler-support
|
||||||
//@ revisions: default y yes on true all
|
//@ revisions: default y yes on true_ all
|
||||||
//@ [default] compile-flags: -Cinstrument-coverage
|
//@ [default] compile-flags: -Cinstrument-coverage
|
||||||
//@ [y] compile-flags: -Cinstrument-coverage=y
|
//@ [y] compile-flags: -Cinstrument-coverage=y
|
||||||
//@ [yes] compile-flags: -Cinstrument-coverage=yes
|
//@ [yes] compile-flags: -Cinstrument-coverage=yes
|
||||||
//@ [on] compile-flags: -Cinstrument-coverage=on
|
//@ [on] compile-flags: -Cinstrument-coverage=on
|
||||||
//@ [true] compile-flags: -Cinstrument-coverage=true
|
//@ [true_] compile-flags: -Cinstrument-coverage=true
|
||||||
//@ [all] compile-flags: -Cinstrument-coverage=all
|
//@ [all] compile-flags: -Cinstrument-coverage=all
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
//@ run-pass
|
//@ run-pass
|
||||||
#![allow(dead_code)]
|
|
||||||
//@ compile-flags: --cfg foo
|
|
||||||
|
|
||||||
//@ pretty-expanded FIXME #23616
|
//@ pretty-expanded FIXME #23616
|
||||||
|
|
||||||
|
#![allow(dead_code)]
|
||||||
|
|
||||||
struct Foo {
|
struct Foo {
|
||||||
#[cfg(FALSE)]
|
#[cfg(FALSE)]
|
||||||
bar: baz,
|
bar: baz,
|
||||||
@ -11,7 +10,7 @@ struct Foo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct Foo2 {
|
struct Foo2 {
|
||||||
#[cfg(foo)]
|
#[cfg(all())]
|
||||||
foo: isize,
|
foo: isize,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
//@ check-pass
|
//@ check-pass
|
||||||
//@ compile-flags:--cfg set1
|
|
||||||
|
|
||||||
#![cfg_attr(set1, feature(rustc_attrs))]
|
#![cfg_attr(all(), feature(rustc_attrs))]
|
||||||
#![rustc_dummy]
|
#![rustc_dummy]
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
@ -16,7 +16,7 @@ macro_rules! emit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// item
|
// item
|
||||||
compiles_fine!(bar);
|
compiles_fine!(FALSE);
|
||||||
emit!(foo);
|
emit!(foo);
|
||||||
|
|
||||||
fn foo() {
|
fn foo() {
|
||||||
@ -25,7 +25,7 @@ fn foo() {
|
|||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
// statement
|
// statement
|
||||||
compiles_fine!(baz);
|
compiles_fine!(FALSE);
|
||||||
emit!(baz);
|
emit!(FALSE);
|
||||||
println!("{}", MISTYPED);
|
println!("{}", MISTYPED);
|
||||||
}
|
}
|
||||||
|
@ -14,11 +14,11 @@ pub fn main() {
|
|||||||
if cfg!(not(all(foo, qux="foo"))) { panic!() }
|
if cfg!(not(all(foo, qux="foo"))) { panic!() }
|
||||||
if cfg!(all(not(all(foo, qux="foo")))) { panic!() }
|
if cfg!(all(not(all(foo, qux="foo")))) { panic!() }
|
||||||
|
|
||||||
if cfg!(not_a_cfg) { panic!() }
|
if cfg!(FALSE) { panic!() }
|
||||||
if cfg!(all(not_a_cfg, foo, qux="foo")) { panic!() }
|
if cfg!(all(FALSE, foo, qux="foo")) { panic!() }
|
||||||
if cfg!(all(not_a_cfg, foo, qux="foo")) { panic!() }
|
if cfg!(all(FALSE, foo, qux="foo")) { panic!() }
|
||||||
if ! cfg!(any(not_a_cfg, foo)) { panic!() }
|
if ! cfg!(any(FALSE, foo)) { panic!() }
|
||||||
|
|
||||||
if ! cfg!(not(not_a_cfg)) { panic!() }
|
if ! cfg!(not(FALSE)) { panic!() }
|
||||||
if ! cfg!(all(not(not_a_cfg), foo, qux="foo")) { panic!() }
|
if ! cfg!(all(not(FALSE), foo, qux="foo")) { panic!() }
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user