Skip to content

Commit 0c3f5cc

Browse files
committed
Further cleanup cfgs in the UI test suite
This commit does three things: 1. replaces (the last remaining) never true cfgs by the FALSE cfg 2. fix derive-helper-configured.rs (typo in directive) 3. and comment some current unused #[cfg_attr] (missing revisions)
1 parent 033becf commit 0c3f5cc

9 files changed

+33
-35
lines changed

tests/ui/conditional-compilation/cfg-generic-params.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
//@ compile-flags:--cfg yes
22

3-
fn f_lt<#[cfg(yes)] 'a: 'a, #[cfg(no)] T>() {}
4-
fn f_ty<#[cfg(no)] 'a: 'a, #[cfg(yes)] T>() {}
3+
fn f_lt<#[cfg(yes)] 'a: 'a, #[cfg(FALSE)] T>() {}
4+
fn f_ty<#[cfg(FALSE)] 'a: 'a, #[cfg(yes)] T>() {}
55

6-
type FnGood = for<#[cfg(yes)] 'a, #[cfg(no)] T> fn(); // OK
7-
type FnBad = for<#[cfg(no)] 'a, #[cfg(yes)] T> fn();
6+
type FnGood = for<#[cfg(yes)] 'a, #[cfg(FALSE)] T> fn(); // OK
7+
type FnBad = for<#[cfg(FALSE)] 'a, #[cfg(yes)] T> fn();
88
//~^ ERROR only lifetime parameters can be used in this context
99

10-
type PolyGood = dyn for<#[cfg(yes)] 'a, #[cfg(no)] T> Copy; // OK
11-
type PolyBad = dyn for<#[cfg(no)] 'a, #[cfg(yes)] T> Copy;
10+
type PolyGood = dyn for<#[cfg(yes)] 'a, #[cfg(FALSE)] T> Copy; // OK
11+
type PolyBad = dyn for<#[cfg(FALSE)] 'a, #[cfg(yes)] T> Copy;
1212
//~^ ERROR only lifetime parameters can be used in this context
1313

14-
struct WhereGood where for<#[cfg(yes)] 'a, #[cfg(no)] T> u8: Copy; // OK
15-
struct WhereBad where for<#[cfg(no)] 'a, #[cfg(yes)] T> u8: Copy;
14+
struct WhereGood where for<#[cfg(yes)] 'a, #[cfg(FALSE)] T> u8: Copy; // OK
15+
struct WhereBad where for<#[cfg(FALSE)] 'a, #[cfg(yes)] T> u8: Copy;
1616
//~^ ERROR only lifetime parameters can be used in this context
1717

18-
fn f_lt_no<#[cfg_attr(no, unknown)] 'a>() {} // OK
18+
fn f_lt_no<#[cfg_attr(FALSE, unknown)] 'a>() {} // OK
1919
fn f_lt_yes<#[cfg_attr(yes, unknown)] 'a>() {}
2020
//~^ ERROR cannot find attribute `unknown` in this scope
21-
fn f_ty_no<#[cfg_attr(no, unknown)] T>() {} // OK
21+
fn f_ty_no<#[cfg_attr(FALSE, unknown)] T>() {} // OK
2222
fn f_ty_yes<#[cfg_attr(yes, unknown)] T>() {}
2323
//~^ ERROR cannot find attribute `unknown` in this scope
2424

25-
type FnNo = for<#[cfg_attr(no, unknown)] 'a> fn(); // OK
25+
type FnNo = for<#[cfg_attr(FALSE, unknown)] 'a> fn(); // OK
2626
type FnYes = for<#[cfg_attr(yes, unknown)] 'a> fn();
2727
//~^ ERROR cannot find attribute `unknown` in this scope
2828

29-
type PolyNo = dyn for<#[cfg_attr(no, unknown)] 'a> Copy; // OK
29+
type PolyNo = dyn for<#[cfg_attr(FALSE, unknown)] 'a> Copy; // OK
3030
type PolyYes = dyn for<#[cfg_attr(yes, unknown)] 'a> Copy;
3131
//~^ ERROR cannot find attribute `unknown` in this scope
3232

33-
struct WhereNo where for<#[cfg_attr(no, unknown)] 'a> u8: Copy; // OK
33+
struct WhereNo where for<#[cfg_attr(FALSE, unknown)] 'a> u8: Copy; // OK
3434
struct WhereYes where for<#[cfg_attr(yes, unknown)] 'a> u8: Copy;
3535
//~^ ERROR cannot find attribute `unknown` in this scope
3636

tests/ui/conditional-compilation/cfg-generic-params.stderr

+9-9
Original file line numberDiff line numberDiff line change
@@ -29,30 +29,30 @@ LL | struct WhereYes where for<#[cfg_attr(yes, unknown)] 'a> u8: Copy;
2929
| ^^^^^^^
3030

3131
error[E0658]: only lifetime parameters can be used in this context
32-
--> $DIR/cfg-generic-params.rs:7:45
32+
--> $DIR/cfg-generic-params.rs:7:48
3333
|
34-
LL | type FnBad = for<#[cfg(no)] 'a, #[cfg(yes)] T> fn();
35-
| ^
34+
LL | type FnBad = for<#[cfg(FALSE)] 'a, #[cfg(yes)] T> fn();
35+
| ^
3636
|
3737
= note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
3838
= help: add `#![feature(non_lifetime_binders)]` to the crate attributes to enable
3939
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
4040

4141
error[E0658]: only lifetime parameters can be used in this context
42-
--> $DIR/cfg-generic-params.rs:11:51
42+
--> $DIR/cfg-generic-params.rs:11:54
4343
|
44-
LL | type PolyBad = dyn for<#[cfg(no)] 'a, #[cfg(yes)] T> Copy;
45-
| ^
44+
LL | type PolyBad = dyn for<#[cfg(FALSE)] 'a, #[cfg(yes)] T> Copy;
45+
| ^
4646
|
4747
= note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
4848
= help: add `#![feature(non_lifetime_binders)]` to the crate attributes to enable
4949
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
5050

5151
error[E0658]: only lifetime parameters can be used in this context
52-
--> $DIR/cfg-generic-params.rs:15:54
52+
--> $DIR/cfg-generic-params.rs:15:57
5353
|
54-
LL | struct WhereBad where for<#[cfg(no)] 'a, #[cfg(yes)] T> u8: Copy;
55-
| ^
54+
LL | struct WhereBad where for<#[cfg(FALSE)] 'a, #[cfg(yes)] T> u8: Copy;
55+
| ^
5656
|
5757
= note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
5858
= help: add `#![feature(non_lifetime_binders)]` to the crate attributes to enable

tests/ui/const-generics/const-arg-in-const-arg.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// we use a single revision because this should have a `full` revision
33
// but right now that ICEs and I(@BoxyUwU) could not get stderr normalization to work
44

5-
#![cfg_attr(full, feature(generic_const_exprs))]
6-
#![cfg_attr(full, allow(incomplete_features))]
5+
// #![cfg_attr(full, feature(generic_const_exprs))]
6+
// #![cfg_attr(full, allow(incomplete_features))]
77

88
const fn foo<T>() -> usize { std::mem::size_of::<T>() }
99
const fn bar<const N: usize>() -> usize { N }

tests/ui/feature-gates/feature-gate-yeet_expr-in-cfg.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
//@ compile-flags: --edition 2021
22

33
pub fn demo() -> Option<i32> {
4-
#[cfg(nope)]
4+
#[cfg(FALSE)]
55
{
66
do yeet //~ ERROR `do yeet` expression is experimental
77
}
88

99
Some(1)
1010
}
1111

12-
#[cfg(nope)]
12+
#[cfg(FALSE)]
1313
pub fn alternative() -> Result<(), String> {
1414
do yeet "hello"; //~ ERROR `do yeet` expression is experimental
1515
}

tests/ui/proc-macro/derive-helper-configured.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
// Derive helpers are resolved successfully inside `cfg_attr`.
22

33
//@ check-pass
4-
// compile-flats:--cfg TRUE
54
//@ aux-build:test-macros.rs
65

76
#[macro_use]
87
extern crate test_macros;
98

10-
#[cfg_attr(TRUE, empty_helper)]
119
#[derive(Empty)]
12-
#[cfg_attr(TRUE, empty_helper)]
10+
#[cfg_attr(all(), empty_helper)]
1311
struct S {
14-
#[cfg_attr(TRUE, empty_helper)]
12+
#[cfg_attr(all(), empty_helper)]
1513
field: u8,
1614
}
1715

tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop-fail-2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//@ known-bug: #110395
22
#![feature(const_trait_impl)]
33
#![feature(const_mut_refs)]
4-
#![cfg_attr(precise, feature(const_precise_live_drops))]
4+
// #![cfg_attr(precise, feature(const_precise_live_drops))]
55

66
use std::marker::{Destruct, PhantomData};
77

tests/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.fixed

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@ aux-build:edition-lint-paths.rs
22
//@ run-rustfix
3-
//@ compile-flags:--extern edition_lint_paths --cfg blandiloquence
3+
//@ compile-flags:--extern edition_lint_paths
44
//@ edition:2018
55

66
#![deny(rust_2018_idioms)]

tests/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
//@ aux-build:edition-lint-paths.rs
22
//@ run-rustfix
3-
//@ compile-flags:--extern edition_lint_paths --cfg blandiloquence
3+
//@ compile-flags:--extern edition_lint_paths
44
//@ edition:2018
55

66
#![deny(rust_2018_idioms)]
77
#![allow(dead_code)]
88

99
// The suggestion span should include the attribute.
1010

11-
#[cfg(blandiloquence)] //~ HELP remove it
11+
#[cfg(not(FALSE))] //~ HELP remove it
1212
extern crate edition_lint_paths;
1313
//~^ ERROR unused extern crate
1414

tests/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error: unused extern crate
22
--> $DIR/issue-54400-unused-extern-crate-attr-span.rs:12:1
33
|
4-
LL | / #[cfg(blandiloquence)]
4+
LL | / #[cfg(not(FALSE))]
55
LL | | extern crate edition_lint_paths;
66
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
77
| |________________________________|

0 commit comments

Comments
 (0)