diff --git a/src/test/ui/const-generics/apit-with-const-param.rs b/src/test/ui/const-generics/apit-with-const-param.rs index f9c6e201b1762..facc0bcf5130c 100644 --- a/src/test/ui/const-generics/apit-with-const-param.rs +++ b/src/test/ui/const-generics/apit-with-const-param.rs @@ -1,7 +1,9 @@ // check-pass +// revisions: full min -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] trait Trait {} diff --git a/src/test/ui/const-generics/apit-with-const-param.stderr b/src/test/ui/const-generics/apit-with-const-param.stderr deleted file mode 100644 index 4389e4738eadc..0000000000000 --- a/src/test/ui/const-generics/apit-with-const-param.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/apit-with-const-param.rs:3:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/const-generics/array-size-in-generic-struct-param.full.stderr b/src/test/ui/const-generics/array-size-in-generic-struct-param.full.stderr new file mode 100644 index 0000000000000..cf4487b5829c1 --- /dev/null +++ b/src/test/ui/const-generics/array-size-in-generic-struct-param.full.stderr @@ -0,0 +1,18 @@ +error: constant expression depends on a generic parameter + --> $DIR/array-size-in-generic-struct-param.rs:9:38 + | +LL | struct ArithArrayLen([u32; 0 + N]); + | ^^^^^^^^^^^^ + | + = note: this may fail depending on what value the parameter takes + +error: constant expression depends on a generic parameter + --> $DIR/array-size-in-generic-struct-param.rs:20:10 + | +LL | arr: [u8; CFG.arr_size], + | ^^^^^^^^^^^^^^^^^^ + | + = note: this may fail depending on what value the parameter takes + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/const-generics/array-size-in-generic-struct-param.min.stderr b/src/test/ui/const-generics/array-size-in-generic-struct-param.min.stderr new file mode 100644 index 0000000000000..61d23475c6f79 --- /dev/null +++ b/src/test/ui/const-generics/array-size-in-generic-struct-param.min.stderr @@ -0,0 +1,27 @@ +error: generic parameters must not be used inside of non trivial constant values + --> $DIR/array-size-in-generic-struct-param.rs:9:48 + | +LL | struct ArithArrayLen([u32; 0 + N]); + | ^ non-trivial anonymous constants must not depend on the parameter `N` + | + = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + +error: generic parameters must not be used inside of non trivial constant values + --> $DIR/array-size-in-generic-struct-param.rs:20:15 + | +LL | arr: [u8; CFG.arr_size], + | ^^^ non-trivial anonymous constants must not depend on the parameter `CFG` + | + = help: it is currently only allowed to use either `CFG` or `{ CFG }` as generic constants + +error: using `Config` as const generic parameters is forbidden + --> $DIR/array-size-in-generic-struct-param.rs:18:21 + | +LL | struct B { + | ^^^^^^ + | + = note: the only supported types are integers, `bool` and `char` + = note: more complex types are supported with `#[feature(const_generics)]` + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/const-generics/array-size-in-generic-struct-param.rs b/src/test/ui/const-generics/array-size-in-generic-struct-param.rs index 5c02e585dc8ba..aa1a3b9cf2888 100644 --- a/src/test/ui/const-generics/array-size-in-generic-struct-param.rs +++ b/src/test/ui/const-generics/array-size-in-generic-struct-param.rs @@ -1,9 +1,14 @@ -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +// Tests that array sizes that depend on const-params are checked using `ConstEvaluatable`. +// revisions: full min + +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] #[allow(dead_code)] struct ArithArrayLen([u32; 0 + N]); -//~^ ERROR constant expression depends on a generic parameter +//[full]~^ ERROR constant expression depends on a generic parameter +//[min]~^^ ERROR generic parameters must not be used inside of non trivial constant values #[derive(PartialEq, Eq)] struct Config { @@ -11,7 +16,10 @@ struct Config { } struct B { - arr: [u8; CFG.arr_size], //~ ERROR constant expression depends on a generic parameter + //[min]~^ ERROR using `Config` as const generic parameters is forbidden + arr: [u8; CFG.arr_size], + //[full]~^ ERROR constant expression depends on a generic parameter + //[min]~^^ ERROR generic parameters must not be used inside of non trivial } const C: Config = Config { arr_size: 5 }; diff --git a/src/test/ui/const-generics/array-size-in-generic-struct-param.stderr b/src/test/ui/const-generics/array-size-in-generic-struct-param.stderr deleted file mode 100644 index ad67a87265bd3..0000000000000 --- a/src/test/ui/const-generics/array-size-in-generic-struct-param.stderr +++ /dev/null @@ -1,27 +0,0 @@ -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/array-size-in-generic-struct-param.rs:1:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -error: constant expression depends on a generic parameter - --> $DIR/array-size-in-generic-struct-param.rs:5:38 - | -LL | struct ArithArrayLen([u32; 0 + N]); - | ^^^^^^^^^^^^ - | - = note: this may fail depending on what value the parameter takes - -error: constant expression depends on a generic parameter - --> $DIR/array-size-in-generic-struct-param.rs:14:10 - | -LL | arr: [u8; CFG.arr_size], - | ^^^^^^^^^^^^^^^^^^ - | - = note: this may fail depending on what value the parameter takes - -error: aborting due to 2 previous errors; 1 warning emitted - diff --git a/src/test/ui/const-generics/broken-mir-1.rs b/src/test/ui/const-generics/broken-mir-1.rs index f137be2d6a6fa..d13ae12c03bc2 100644 --- a/src/test/ui/const-generics/broken-mir-1.rs +++ b/src/test/ui/const-generics/broken-mir-1.rs @@ -1,7 +1,9 @@ // run-pass +// revisions: full min -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] pub trait Foo { fn foo(&self); diff --git a/src/test/ui/const-generics/broken-mir-1.stderr b/src/test/ui/const-generics/broken-mir-1.stderr deleted file mode 100644 index a5532bde1f5e9..0000000000000 --- a/src/test/ui/const-generics/broken-mir-1.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/broken-mir-1.rs:3:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/const-generics/broken-mir-2.rs b/src/test/ui/const-generics/broken-mir-2.rs index 2cd035639ee5c..2f9afe0b46433 100644 --- a/src/test/ui/const-generics/broken-mir-2.rs +++ b/src/test/ui/const-generics/broken-mir-2.rs @@ -1,7 +1,9 @@ // run-pass +// revisions: full min -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] use std::fmt::Debug; diff --git a/src/test/ui/const-generics/broken-mir-2.stderr b/src/test/ui/const-generics/broken-mir-2.stderr deleted file mode 100644 index c36ef8450976c..0000000000000 --- a/src/test/ui/const-generics/broken-mir-2.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/broken-mir-2.rs:3:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/const-generics/cannot-infer-const-args.full.stderr b/src/test/ui/const-generics/cannot-infer-const-args.full.stderr new file mode 100644 index 0000000000000..053139787edf9 --- /dev/null +++ b/src/test/ui/const-generics/cannot-infer-const-args.full.stderr @@ -0,0 +1,11 @@ +error[E0282]: type annotations needed + --> $DIR/cannot-infer-const-args.rs:12:5 + | +LL | foo(); + | ^^^ + | + = note: unable to infer the value of a const parameter + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/const-generics/cannot-infer-const-args.min.stderr b/src/test/ui/const-generics/cannot-infer-const-args.min.stderr new file mode 100644 index 0000000000000..053139787edf9 --- /dev/null +++ b/src/test/ui/const-generics/cannot-infer-const-args.min.stderr @@ -0,0 +1,11 @@ +error[E0282]: type annotations needed + --> $DIR/cannot-infer-const-args.rs:12:5 + | +LL | foo(); + | ^^^ + | + = note: unable to infer the value of a const parameter + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/const-generics/cannot-infer-const-args.rs b/src/test/ui/const-generics/cannot-infer-const-args.rs index 2f6ad2654c12c..2d74b4788bf4b 100644 --- a/src/test/ui/const-generics/cannot-infer-const-args.rs +++ b/src/test/ui/const-generics/cannot-infer-const-args.rs @@ -1,5 +1,8 @@ -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +// revisions: full min + +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] fn foo() -> usize { 0 diff --git a/src/test/ui/const-generics/cannot-infer-const-args.stderr b/src/test/ui/const-generics/cannot-infer-const-args.stderr deleted file mode 100644 index b29d27e524751..0000000000000 --- a/src/test/ui/const-generics/cannot-infer-const-args.stderr +++ /dev/null @@ -1,20 +0,0 @@ -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/cannot-infer-const-args.rs:1:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -error[E0282]: type annotations needed - --> $DIR/cannot-infer-const-args.rs:9:5 - | -LL | foo(); - | ^^^ - | - = note: unable to infer the value of a const parameter - -error: aborting due to previous error; 1 warning emitted - -For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/const-generics/coerce_unsized_array.rs b/src/test/ui/const-generics/coerce_unsized_array.rs index b28768a5163dd..a3c295f73c7ea 100644 --- a/src/test/ui/const-generics/coerce_unsized_array.rs +++ b/src/test/ui/const-generics/coerce_unsized_array.rs @@ -1,6 +1,9 @@ // run-pass -#![feature(const_generics)] -#![allow(incomplete_features)] +// revisions: full min + +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] fn foo(v: &[u8; N]) -> &[u8] { v diff --git a/src/test/ui/const-generics/concrete-const-as-fn-arg.rs b/src/test/ui/const-generics/concrete-const-as-fn-arg.rs index 18ebba49f6f91..7771bf336016a 100644 --- a/src/test/ui/const-generics/concrete-const-as-fn-arg.rs +++ b/src/test/ui/const-generics/concrete-const-as-fn-arg.rs @@ -1,8 +1,10 @@ // Test that a concrete const type i.e. A<2>, can be used as an argument type in a function // run-pass +// revisions: full min -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] struct A; // ok diff --git a/src/test/ui/const-generics/concrete-const-as-fn-arg.stderr b/src/test/ui/const-generics/concrete-const-as-fn-arg.stderr deleted file mode 100644 index c8f3a8beaf83f..0000000000000 --- a/src/test/ui/const-generics/concrete-const-as-fn-arg.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/concrete-const-as-fn-arg.rs:4:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/const-generics/concrete-const-impl-method.rs b/src/test/ui/const-generics/concrete-const-impl-method.rs index c1ddf9a33140d..edb403ce8fd66 100644 --- a/src/test/ui/const-generics/concrete-const-impl-method.rs +++ b/src/test/ui/const-generics/concrete-const-impl-method.rs @@ -1,9 +1,11 @@ // Test that a method/associated non-method within an impl block of a concrete const type i.e. A<2>, // is callable. // run-pass +// revisions: full min -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] pub struct A; diff --git a/src/test/ui/const-generics/concrete-const-impl-method.stderr b/src/test/ui/const-generics/concrete-const-impl-method.stderr deleted file mode 100644 index 5edb4f4f6cdad..0000000000000 --- a/src/test/ui/const-generics/concrete-const-impl-method.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/concrete-const-impl-method.rs:5:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/const-generics/condition-in-trait-const-arg.rs b/src/test/ui/const-generics/condition-in-trait-const-arg.rs index 9d8aaed54bd75..77b68052fc0bb 100644 --- a/src/test/ui/const-generics/condition-in-trait-const-arg.rs +++ b/src/test/ui/const-generics/condition-in-trait-const-arg.rs @@ -1,7 +1,10 @@ +// Checks that `impl Trait<{anon_const}> for Type` evaluates successfully. // run-pass +// revisions: full min -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] trait IsZeroTrait{} diff --git a/src/test/ui/const-generics/condition-in-trait-const-arg.stderr b/src/test/ui/const-generics/condition-in-trait-const-arg.stderr deleted file mode 100644 index 9ac33454128b5..0000000000000 --- a/src/test/ui/const-generics/condition-in-trait-const-arg.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/condition-in-trait-const-arg.rs:3:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/const-generics/const-arg-in-fn.rs b/src/test/ui/const-generics/const-arg-in-fn.rs index 5ea2cf92fdc60..5c438efd82a0c 100644 --- a/src/test/ui/const-generics/const-arg-in-fn.rs +++ b/src/test/ui/const-generics/const-arg-in-fn.rs @@ -1,7 +1,9 @@ // run-pass +// revisions: full min -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] fn const_u32_identity() -> u32 { X diff --git a/src/test/ui/const-generics/const-arg-in-fn.stderr b/src/test/ui/const-generics/const-arg-in-fn.stderr deleted file mode 100644 index bb66849c7fe6c..0000000000000 --- a/src/test/ui/const-generics/const-arg-in-fn.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/const-arg-in-fn.rs:3:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/const-generics/const-argument-non-static-lifetime.rs b/src/test/ui/const-generics/const-argument-non-static-lifetime.rs index bc09ba2ab553b..dc34621b90500 100644 --- a/src/test/ui/const-generics/const-argument-non-static-lifetime.rs +++ b/src/test/ui/const-generics/const-argument-non-static-lifetime.rs @@ -1,7 +1,9 @@ // run-pass +// revisions: full +// FIXME(#75323) Omitted min revision for now due to ICE. -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] #![allow(dead_code)] fn test() {} diff --git a/src/test/ui/const-generics/const-argument-non-static-lifetime.stderr b/src/test/ui/const-generics/const-argument-non-static-lifetime.stderr deleted file mode 100644 index 53a7550090d44..0000000000000 --- a/src/test/ui/const-generics/const-argument-non-static-lifetime.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/const-argument-non-static-lifetime.rs:3:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/const-generics/const-expression-parameter.full.stderr b/src/test/ui/const-generics/const-expression-parameter.full.stderr new file mode 100644 index 0000000000000..496af9c6e02e0 --- /dev/null +++ b/src/test/ui/const-generics/const-expression-parameter.full.stderr @@ -0,0 +1,8 @@ +error: expected one of `,` or `>`, found `+` + --> $DIR/const-expression-parameter.rs:16:22 + | +LL | i32_identity::<1 + 2>(); + | ^ expected one of `,` or `>` + +error: aborting due to previous error + diff --git a/src/test/ui/const-generics/const-expression-parameter.min.stderr b/src/test/ui/const-generics/const-expression-parameter.min.stderr new file mode 100644 index 0000000000000..496af9c6e02e0 --- /dev/null +++ b/src/test/ui/const-generics/const-expression-parameter.min.stderr @@ -0,0 +1,8 @@ +error: expected one of `,` or `>`, found `+` + --> $DIR/const-expression-parameter.rs:16:22 + | +LL | i32_identity::<1 + 2>(); + | ^ expected one of `,` or `>` + +error: aborting due to previous error + diff --git a/src/test/ui/const-generics/const-expression-parameter.rs b/src/test/ui/const-generics/const-expression-parameter.rs index e0b66a7c14c3a..7a1eaf9f93908 100644 --- a/src/test/ui/const-generics/const-expression-parameter.rs +++ b/src/test/ui/const-generics/const-expression-parameter.rs @@ -1,5 +1,8 @@ -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +// revisions: full min + +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] fn i32_identity() -> i32 { 5 diff --git a/src/test/ui/const-generics/const-expression-parameter.stderr b/src/test/ui/const-generics/const-expression-parameter.stderr deleted file mode 100644 index e421c22be01a8..0000000000000 --- a/src/test/ui/const-generics/const-expression-parameter.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error: expected one of `,` or `>`, found `+` - --> $DIR/const-expression-parameter.rs:13:22 - | -LL | i32_identity::<1 + 2>(); - | ^ expected one of `,` or `>` - -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/const-expression-parameter.rs:1:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -error: aborting due to previous error; 1 warning emitted - diff --git a/src/test/ui/const-generics/const-fn-with-const-param.rs b/src/test/ui/const-generics/const-fn-with-const-param.rs index bbc55815e9a20..add1290b1d975 100644 --- a/src/test/ui/const-generics/const-fn-with-const-param.rs +++ b/src/test/ui/const-generics/const-fn-with-const-param.rs @@ -1,6 +1,10 @@ +// Checks that `const fn` with const params can be used. // run-pass -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +// revisions: full min + +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] const fn const_u32_identity() -> u32 { X diff --git a/src/test/ui/const-generics/const-fn-with-const-param.stderr b/src/test/ui/const-generics/const-fn-with-const-param.stderr deleted file mode 100644 index 109b50028480b..0000000000000 --- a/src/test/ui/const-generics/const-fn-with-const-param.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/const-fn-with-const-param.rs:2:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/const-generics/const-generic-array-wrapper.rs b/src/test/ui/const-generics/const-generic-array-wrapper.rs index 3e43387163b62..34edd0b4a8e87 100644 --- a/src/test/ui/const-generics/const-generic-array-wrapper.rs +++ b/src/test/ui/const-generics/const-generic-array-wrapper.rs @@ -1,7 +1,9 @@ // run-pass +// revisions: full min -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] struct Foo([T; N]); diff --git a/src/test/ui/const-generics/const-generic-array-wrapper.stderr b/src/test/ui/const-generics/const-generic-array-wrapper.stderr deleted file mode 100644 index 47448bbd19d6d..0000000000000 --- a/src/test/ui/const-generics/const-generic-array-wrapper.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/const-generic-array-wrapper.rs:3:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/const-generics/const-generic-type_name.rs b/src/test/ui/const-generics/const-generic-type_name.rs index 22f9bd2a0f0b2..a954c02635216 100644 --- a/src/test/ui/const-generics/const-generic-type_name.rs +++ b/src/test/ui/const-generics/const-generic-type_name.rs @@ -1,7 +1,9 @@ // run-pass +// revisions: full min -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] #[derive(Debug)] struct S; diff --git a/src/test/ui/const-generics/const-generic-type_name.stderr b/src/test/ui/const-generics/const-generic-type_name.stderr deleted file mode 100644 index f161739c9c8a6..0000000000000 --- a/src/test/ui/const-generics/const-generic-type_name.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/const-generic-type_name.rs:3:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/const-generics/const-param-after-const-literal-arg.rs b/src/test/ui/const-generics/const-param-after-const-literal-arg.rs index 19c4120eb2f14..3982f7a7f125c 100644 --- a/src/test/ui/const-generics/const-param-after-const-literal-arg.rs +++ b/src/test/ui/const-generics/const-param-after-const-literal-arg.rs @@ -1,7 +1,9 @@ // check-pass +// revisions: full min -#![allow(incomplete_features)] -#![feature(const_generics)] +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] struct Foo; diff --git a/src/test/ui/const-generics/const-param-elided-lifetime.stderr b/src/test/ui/const-generics/const-param-elided-lifetime.full.stderr similarity index 57% rename from src/test/ui/const-generics/const-param-elided-lifetime.stderr rename to src/test/ui/const-generics/const-param-elided-lifetime.full.stderr index 8c50fb73679a9..aa29d61d917b6 100644 --- a/src/test/ui/const-generics/const-param-elided-lifetime.stderr +++ b/src/test/ui/const-generics/const-param-elided-lifetime.full.stderr @@ -1,42 +1,33 @@ error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/const-param-elided-lifetime.rs:9:19 + --> $DIR/const-param-elided-lifetime.rs:11:19 | LL | struct A; | ^ explicit lifetime name needed here error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/const-param-elided-lifetime.rs:13:15 + --> $DIR/const-param-elided-lifetime.rs:16:15 | LL | impl A { | ^ explicit lifetime name needed here error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/const-param-elided-lifetime.rs:14:21 + --> $DIR/const-param-elided-lifetime.rs:19:21 | LL | fn foo(&self) {} | ^ explicit lifetime name needed here error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/const-param-elided-lifetime.rs:18:15 + --> $DIR/const-param-elided-lifetime.rs:24:15 | LL | impl B for A {} | ^ explicit lifetime name needed here error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/const-param-elided-lifetime.rs:21:17 + --> $DIR/const-param-elided-lifetime.rs:28:17 | LL | fn bar() {} | ^ explicit lifetime name needed here -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/const-param-elided-lifetime.rs:6:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -error: aborting due to 5 previous errors; 1 warning emitted +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0637`. diff --git a/src/test/ui/const-generics/const-param-elided-lifetime.min.stderr b/src/test/ui/const-generics/const-param-elided-lifetime.min.stderr new file mode 100644 index 0000000000000..bdd1da96c7565 --- /dev/null +++ b/src/test/ui/const-generics/const-param-elided-lifetime.min.stderr @@ -0,0 +1,78 @@ +error[E0637]: `&` without an explicit lifetime name cannot be used here + --> $DIR/const-param-elided-lifetime.rs:11:19 + | +LL | struct A; + | ^ explicit lifetime name needed here + +error[E0637]: `&` without an explicit lifetime name cannot be used here + --> $DIR/const-param-elided-lifetime.rs:16:15 + | +LL | impl A { + | ^ explicit lifetime name needed here + +error[E0637]: `&` without an explicit lifetime name cannot be used here + --> $DIR/const-param-elided-lifetime.rs:19:21 + | +LL | fn foo(&self) {} + | ^ explicit lifetime name needed here + +error[E0637]: `&` without an explicit lifetime name cannot be used here + --> $DIR/const-param-elided-lifetime.rs:24:15 + | +LL | impl B for A {} + | ^ explicit lifetime name needed here + +error[E0637]: `&` without an explicit lifetime name cannot be used here + --> $DIR/const-param-elided-lifetime.rs:28:17 + | +LL | fn bar() {} + | ^ explicit lifetime name needed here + +error: using `&'static u8` as const generic parameters is forbidden + --> $DIR/const-param-elided-lifetime.rs:11:19 + | +LL | struct A; + | ^^^ + | + = note: the only supported types are integers, `bool` and `char` + = note: more complex types are supported with `#[feature(const_generics)]` + +error: using `&'static u8` as const generic parameters is forbidden + --> $DIR/const-param-elided-lifetime.rs:16:15 + | +LL | impl A { + | ^^^ + | + = note: the only supported types are integers, `bool` and `char` + = note: more complex types are supported with `#[feature(const_generics)]` + +error: using `&'static u8` as const generic parameters is forbidden + --> $DIR/const-param-elided-lifetime.rs:24:15 + | +LL | impl B for A {} + | ^^^ + | + = note: the only supported types are integers, `bool` and `char` + = note: more complex types are supported with `#[feature(const_generics)]` + +error: using `&'static u8` as const generic parameters is forbidden + --> $DIR/const-param-elided-lifetime.rs:28:17 + | +LL | fn bar() {} + | ^^^ + | + = note: the only supported types are integers, `bool` and `char` + = note: more complex types are supported with `#[feature(const_generics)]` + +error: using `&'static u8` as const generic parameters is forbidden + --> $DIR/const-param-elided-lifetime.rs:19:21 + | +LL | fn foo(&self) {} + | ^^^ + | + = note: the only supported types are integers, `bool` and `char` + = note: more complex types are supported with `#[feature(const_generics)]` + +error: aborting due to 10 previous errors + +For more information about this error, try `rustc --explain E0637`. diff --git a/src/test/ui/const-generics/const-param-elided-lifetime.rs b/src/test/ui/const-generics/const-param-elided-lifetime.rs index 5e6b6c4dabe02..814b71d4b741f 100644 --- a/src/test/ui/const-generics/const-param-elided-lifetime.rs +++ b/src/test/ui/const-generics/const-param-elided-lifetime.rs @@ -2,23 +2,31 @@ // behaviour of trait bounds where `fn foo>() {}` is illegal. Though we could change // elided lifetimes within the type of a const generic parameters to be 'static, like elided // lifetimes within const/static items. +// revisions: full min -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] struct A; //~^ ERROR `&` without an explicit lifetime name cannot be used here +//[min]~^^ ERROR using `&'static u8` as const generic parameters is forbidden trait B {} -impl A { //~ ERROR `&` without an explicit lifetime name cannot be used here +impl A { +//~^ ERROR `&` without an explicit lifetime name cannot be used here +//[min]~^^ ERROR using `&'static u8` as const generic parameters is forbidden fn foo(&self) {} //~^ ERROR `&` without an explicit lifetime name cannot be used here + //[min]~^^ ERROR using `&'static u8` as const generic parameters is forbidden } impl B for A {} //~^ ERROR `&` without an explicit lifetime name cannot be used here +//[min]~^^ ERROR using `&'static u8` as const generic parameters is forbidden fn bar() {} //~^ ERROR `&` without an explicit lifetime name cannot be used here +//[min]~^^ ERROR using `&'static u8` as const generic parameters is forbidden fn main() {} diff --git a/src/test/ui/const-generics/const-param-from-outer-fn.full.stderr b/src/test/ui/const-generics/const-param-from-outer-fn.full.stderr new file mode 100644 index 0000000000000..5a126f5c3c696 --- /dev/null +++ b/src/test/ui/const-generics/const-param-from-outer-fn.full.stderr @@ -0,0 +1,13 @@ +error[E0401]: can't use generic parameters from outer function + --> $DIR/const-param-from-outer-fn.rs:9:9 + | +LL | fn foo() { + | - const parameter from outer function +LL | fn bar() -> u32 { + | --- try adding a local generic parameter in this method instead +LL | X + | ^ use of generic parameter from outer function + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0401`. diff --git a/src/test/ui/const-generics/const-param-from-outer-fn.min.stderr b/src/test/ui/const-generics/const-param-from-outer-fn.min.stderr new file mode 100644 index 0000000000000..5a126f5c3c696 --- /dev/null +++ b/src/test/ui/const-generics/const-param-from-outer-fn.min.stderr @@ -0,0 +1,13 @@ +error[E0401]: can't use generic parameters from outer function + --> $DIR/const-param-from-outer-fn.rs:9:9 + | +LL | fn foo() { + | - const parameter from outer function +LL | fn bar() -> u32 { + | --- try adding a local generic parameter in this method instead +LL | X + | ^ use of generic parameter from outer function + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0401`. diff --git a/src/test/ui/const-generics/const-param-from-outer-fn.rs b/src/test/ui/const-generics/const-param-from-outer-fn.rs index 4b8e2db7233e4..e1376c6e108b8 100644 --- a/src/test/ui/const-generics/const-param-from-outer-fn.rs +++ b/src/test/ui/const-generics/const-param-from-outer-fn.rs @@ -1,5 +1,8 @@ -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +// revisions: full min + +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] fn foo() { fn bar() -> u32 { diff --git a/src/test/ui/const-generics/const-param-from-outer-fn.stderr b/src/test/ui/const-generics/const-param-from-outer-fn.stderr deleted file mode 100644 index 30bd1d7291456..0000000000000 --- a/src/test/ui/const-generics/const-param-from-outer-fn.stderr +++ /dev/null @@ -1,22 +0,0 @@ -error[E0401]: can't use generic parameters from outer function - --> $DIR/const-param-from-outer-fn.rs:6:9 - | -LL | fn foo() { - | - const parameter from outer function -LL | fn bar() -> u32 { - | --- try adding a local generic parameter in this method instead -LL | X - | ^ use of generic parameter from outer function - -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/const-param-from-outer-fn.rs:1:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -error: aborting due to previous error; 1 warning emitted - -For more information about this error, try `rustc --explain E0401`. diff --git a/src/test/ui/const-generics/const-param-in-trait.rs b/src/test/ui/const-generics/const-param-in-trait.rs index 6874072571108..9d31162c1c6f4 100644 --- a/src/test/ui/const-generics/const-param-in-trait.rs +++ b/src/test/ui/const-generics/const-param-in-trait.rs @@ -1,8 +1,12 @@ +// Check that const parameters are permitted in traits. // run-pass +// revisions: full min -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] -trait Trait {} + +trait Trait {} fn main() {} diff --git a/src/test/ui/const-generics/const-param-in-trait.stderr b/src/test/ui/const-generics/const-param-in-trait.stderr deleted file mode 100644 index a2e367b25ade0..0000000000000 --- a/src/test/ui/const-generics/const-param-in-trait.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/const-param-in-trait.rs:3:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/const-generics/const-param-type-depends-on-const-param.full.stderr b/src/test/ui/const-generics/const-param-type-depends-on-const-param.full.stderr new file mode 100644 index 0000000000000..f7ad579dbca0b --- /dev/null +++ b/src/test/ui/const-generics/const-param-type-depends-on-const-param.full.stderr @@ -0,0 +1,15 @@ +error[E0770]: the type of const parameters must not depend on other generic parameters + --> $DIR/const-param-type-depends-on-const-param.rs:12:52 + | +LL | pub struct Dependent([(); N]); + | ^ the type must not depend on the parameter `N` + +error[E0770]: the type of const parameters must not depend on other generic parameters + --> $DIR/const-param-type-depends-on-const-param.rs:16:40 + | +LL | pub struct SelfDependent; + | ^ the type must not depend on the parameter `N` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0770`. diff --git a/src/test/ui/const-generics/const-param-type-depends-on-const-param.min.stderr b/src/test/ui/const-generics/const-param-type-depends-on-const-param.min.stderr new file mode 100644 index 0000000000000..103f4c36faef3 --- /dev/null +++ b/src/test/ui/const-generics/const-param-type-depends-on-const-param.min.stderr @@ -0,0 +1,33 @@ +error[E0770]: the type of const parameters must not depend on other generic parameters + --> $DIR/const-param-type-depends-on-const-param.rs:12:52 + | +LL | pub struct Dependent([(); N]); + | ^ the type must not depend on the parameter `N` + +error[E0770]: the type of const parameters must not depend on other generic parameters + --> $DIR/const-param-type-depends-on-const-param.rs:16:40 + | +LL | pub struct SelfDependent; + | ^ the type must not depend on the parameter `N` + +error: using `[u8; _]` as const generic parameters is forbidden + --> $DIR/const-param-type-depends-on-const-param.rs:12:47 + | +LL | pub struct Dependent([(); N]); + | ^^^^^^^ + | + = note: the only supported types are integers, `bool` and `char` + = note: more complex types are supported with `#[feature(const_generics)]` + +error: using `[u8; _]` as const generic parameters is forbidden + --> $DIR/const-param-type-depends-on-const-param.rs:16:35 + | +LL | pub struct SelfDependent; + | ^^^^^^^ + | + = note: the only supported types are integers, `bool` and `char` + = note: more complex types are supported with `#[feature(const_generics)]` + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0770`. diff --git a/src/test/ui/const-generics/const-param-type-depends-on-const-param.rs b/src/test/ui/const-generics/const-param-type-depends-on-const-param.rs index 5aa3617d1d7e0..d21a7cec117ee 100644 --- a/src/test/ui/const-generics/const-param-type-depends-on-const-param.rs +++ b/src/test/ui/const-generics/const-param-type-depends-on-const-param.rs @@ -1,5 +1,8 @@ -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +// revisions: full min + +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] // Currently, const parameters cannot depend on other generic parameters, // as our current implementation can't really support this. @@ -8,8 +11,10 @@ pub struct Dependent([(); N]); //~^ ERROR: the type of const parameters must not depend on other generic parameters +//[min]~^^ ERROR using `[u8; _]` as const generic parameters is forbidden pub struct SelfDependent; //~^ ERROR: the type of const parameters must not depend on other generic parameters +//[min]~^^ ERROR using `[u8; _]` as const generic parameters is forbidden fn main() {} diff --git a/src/test/ui/const-generics/const-param-type-depends-on-const-param.stderr b/src/test/ui/const-generics/const-param-type-depends-on-const-param.stderr deleted file mode 100644 index f6606aea726ad..0000000000000 --- a/src/test/ui/const-generics/const-param-type-depends-on-const-param.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error[E0770]: the type of const parameters must not depend on other generic parameters - --> $DIR/const-param-type-depends-on-const-param.rs:9:52 - | -LL | pub struct Dependent([(); N]); - | ^ the type must not depend on the parameter `N` - -error[E0770]: the type of const parameters must not depend on other generic parameters - --> $DIR/const-param-type-depends-on-const-param.rs:12:40 - | -LL | pub struct SelfDependent; - | ^ the type must not depend on the parameter `N` - -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/const-param-type-depends-on-const-param.rs:1:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -error: aborting due to 2 previous errors; 1 warning emitted - -For more information about this error, try `rustc --explain E0770`. diff --git a/src/test/ui/const-generics/const-param-type-depends-on-type-param.stderr b/src/test/ui/const-generics/const-param-type-depends-on-type-param.full.stderr similarity index 51% rename from src/test/ui/const-generics/const-param-type-depends-on-type-param.stderr rename to src/test/ui/const-generics/const-param-type-depends-on-type-param.full.stderr index d081dcbbc7a4e..ba99c87722cd6 100644 --- a/src/test/ui/const-generics/const-param-type-depends-on-type-param.stderr +++ b/src/test/ui/const-generics/const-param-type-depends-on-type-param.full.stderr @@ -1,27 +1,18 @@ error[E0770]: the type of const parameters must not depend on other generic parameters - --> $DIR/const-param-type-depends-on-type-param.rs:9:34 + --> $DIR/const-param-type-depends-on-type-param.rs:12:34 | LL | pub struct Dependent([(); X]); | ^ the type must not depend on the parameter `T` -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/const-param-type-depends-on-type-param.rs:1:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - error[E0392]: parameter `T` is never used - --> $DIR/const-param-type-depends-on-type-param.rs:9:22 + --> $DIR/const-param-type-depends-on-type-param.rs:12:22 | LL | pub struct Dependent([(); X]); | ^ unused parameter | = help: consider removing `T`, referring to it in a field, or using a marker such as `std::marker::PhantomData` -error: aborting due to 2 previous errors; 1 warning emitted +error: aborting due to 2 previous errors Some errors have detailed explanations: E0392, E0770. For more information about an error, try `rustc --explain E0392`. diff --git a/src/test/ui/const-generics/const-param-type-depends-on-type-param.min.stderr b/src/test/ui/const-generics/const-param-type-depends-on-type-param.min.stderr new file mode 100644 index 0000000000000..ba99c87722cd6 --- /dev/null +++ b/src/test/ui/const-generics/const-param-type-depends-on-type-param.min.stderr @@ -0,0 +1,18 @@ +error[E0770]: the type of const parameters must not depend on other generic parameters + --> $DIR/const-param-type-depends-on-type-param.rs:12:34 + | +LL | pub struct Dependent([(); X]); + | ^ the type must not depend on the parameter `T` + +error[E0392]: parameter `T` is never used + --> $DIR/const-param-type-depends-on-type-param.rs:12:22 + | +LL | pub struct Dependent([(); X]); + | ^ unused parameter + | + = help: consider removing `T`, referring to it in a field, or using a marker such as `std::marker::PhantomData` + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0392, E0770. +For more information about an error, try `rustc --explain E0392`. diff --git a/src/test/ui/const-generics/const-param-type-depends-on-type-param.rs b/src/test/ui/const-generics/const-param-type-depends-on-type-param.rs index 7fe04a43412a1..93ae111751236 100644 --- a/src/test/ui/const-generics/const-param-type-depends-on-type-param.rs +++ b/src/test/ui/const-generics/const-param-type-depends-on-type-param.rs @@ -1,5 +1,8 @@ -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +// revisions: full min + +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] // Currently, const parameters cannot depend on other generic parameters, // as our current implementation can't really support this. diff --git a/src/test/ui/const-generics/const-parameter-uppercase-lint.full.stderr b/src/test/ui/const-generics/const-parameter-uppercase-lint.full.stderr new file mode 100644 index 0000000000000..0f4f007f9d249 --- /dev/null +++ b/src/test/ui/const-generics/const-parameter-uppercase-lint.full.stderr @@ -0,0 +1,14 @@ +error: const parameter `x` should have an upper case name + --> $DIR/const-parameter-uppercase-lint.rs:9:15 + | +LL | fn noop() { + | ^ help: convert the identifier to upper case (notice the capitalization): `X` + | +note: the lint level is defined here + --> $DIR/const-parameter-uppercase-lint.rs:7:9 + | +LL | #![deny(non_upper_case_globals)] + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/const-generics/const-parameter-uppercase-lint.min.stderr b/src/test/ui/const-generics/const-parameter-uppercase-lint.min.stderr new file mode 100644 index 0000000000000..0f4f007f9d249 --- /dev/null +++ b/src/test/ui/const-generics/const-parameter-uppercase-lint.min.stderr @@ -0,0 +1,14 @@ +error: const parameter `x` should have an upper case name + --> $DIR/const-parameter-uppercase-lint.rs:9:15 + | +LL | fn noop() { + | ^ help: convert the identifier to upper case (notice the capitalization): `X` + | +note: the lint level is defined here + --> $DIR/const-parameter-uppercase-lint.rs:7:9 + | +LL | #![deny(non_upper_case_globals)] + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/const-generics/const-parameter-uppercase-lint.rs b/src/test/ui/const-generics/const-parameter-uppercase-lint.rs index 54a33e2181284..b9bd6666af39d 100644 --- a/src/test/ui/const-generics/const-parameter-uppercase-lint.rs +++ b/src/test/ui/const-generics/const-parameter-uppercase-lint.rs @@ -1,5 +1,8 @@ -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +// revisions: full min + +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] #![deny(non_upper_case_globals)] diff --git a/src/test/ui/const-generics/const-parameter-uppercase-lint.stderr b/src/test/ui/const-generics/const-parameter-uppercase-lint.stderr deleted file mode 100644 index b7febed7bdd22..0000000000000 --- a/src/test/ui/const-generics/const-parameter-uppercase-lint.stderr +++ /dev/null @@ -1,23 +0,0 @@ -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/const-parameter-uppercase-lint.rs:1:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -error: const parameter `x` should have an upper case name - --> $DIR/const-parameter-uppercase-lint.rs:6:15 - | -LL | fn noop() { - | ^ help: convert the identifier to upper case (notice the capitalization): `X` - | -note: the lint level is defined here - --> $DIR/const-parameter-uppercase-lint.rs:4:9 - | -LL | #![deny(non_upper_case_globals)] - | ^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to previous error; 1 warning emitted - diff --git a/src/test/ui/const-generics/const-types.rs b/src/test/ui/const-generics/const-types.rs index bde80f4a1ed09..cd34cfc0478c7 100644 --- a/src/test/ui/const-generics/const-types.rs +++ b/src/test/ui/const-generics/const-types.rs @@ -1,7 +1,10 @@ +// Check that arrays can be used with generic const and type. // run-pass +// revisions: full min -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] #![allow(dead_code, unused_variables)] diff --git a/src/test/ui/const-generics/const-types.stderr b/src/test/ui/const-generics/const-types.stderr deleted file mode 100644 index 4628c90031884..0000000000000 --- a/src/test/ui/const-generics/const-types.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/const-types.rs:3:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/const-generics/derive-debug-array-wrapper.rs b/src/test/ui/const-generics/derive-debug-array-wrapper.rs index 36272ae86199d..13fd87f1e3e57 100644 --- a/src/test/ui/const-generics/derive-debug-array-wrapper.rs +++ b/src/test/ui/const-generics/derive-debug-array-wrapper.rs @@ -1,7 +1,10 @@ +// Check that deriving debug on struct with const is permitted. // run-pass +// revisions: full min -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] #[derive(Debug)] struct X { diff --git a/src/test/ui/const-generics/derive-debug-array-wrapper.stderr b/src/test/ui/const-generics/derive-debug-array-wrapper.stderr deleted file mode 100644 index 8f7ab822554a2..0000000000000 --- a/src/test/ui/const-generics/derive-debug-array-wrapper.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/derive-debug-array-wrapper.rs:3:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/const-generics/different_byref.full.stderr b/src/test/ui/const-generics/different_byref.full.stderr new file mode 100644 index 0000000000000..4463ed7fcdd27 --- /dev/null +++ b/src/test/ui/const-generics/different_byref.full.stderr @@ -0,0 +1,12 @@ +error[E0308]: mismatched types + --> $DIR/different_byref.rs:13:9 + | +LL | x = Const::<{ [4] }> {}; + | ^^^^^^^^^^^^^^^^^^^ expected `3_usize`, found `4_usize` + | + = note: expected type `[3_usize]` + found type `[4_usize]` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/const-generics/different_byref.min.stderr b/src/test/ui/const-generics/different_byref.min.stderr new file mode 100644 index 0000000000000..770491179abb5 --- /dev/null +++ b/src/test/ui/const-generics/different_byref.min.stderr @@ -0,0 +1,11 @@ +error: using `[usize; 1]` as const generic parameters is forbidden + --> $DIR/different_byref.rs:8:23 + | +LL | struct Const {} + | ^^^^^^^^^^ + | + = note: the only supported types are integers, `bool` and `char` + = note: more complex types are supported with `#[feature(const_generics)]` + +error: aborting due to previous error + diff --git a/src/test/ui/const-generics/different_byref.rs b/src/test/ui/const-generics/different_byref.rs index 78964eb3dee6e..ec85ed775d4f5 100644 --- a/src/test/ui/const-generics/different_byref.rs +++ b/src/test/ui/const-generics/different_byref.rs @@ -1,11 +1,15 @@ -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +// Check that different const types are different. +// revisions: full min + +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] struct Const {} +//[min]~^ using `[usize; 1]` as const generic parameters is forbidden fn main() { let mut x = Const::<{ [3] }> {}; x = Const::<{ [4] }> {}; - //~^ ERROR mismatched types - + //[full]~^ ERROR mismatched types } diff --git a/src/test/ui/const-generics/different_byref.stderr b/src/test/ui/const-generics/different_byref.stderr deleted file mode 100644 index a3f331ee81155..0000000000000 --- a/src/test/ui/const-generics/different_byref.stderr +++ /dev/null @@ -1,21 +0,0 @@ -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/different_byref.rs:1:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -error[E0308]: mismatched types - --> $DIR/different_byref.rs:8:9 - | -LL | x = Const::<{ [4] }> {}; - | ^^^^^^^^^^^^^^^^^^^ expected `3_usize`, found `4_usize` - | - = note: expected type `[3_usize]` - found type `[4_usize]` - -error: aborting due to previous error; 1 warning emitted - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/const-generics/different_byref_simple.full.stderr b/src/test/ui/const-generics/different_byref_simple.full.stderr new file mode 100644 index 0000000000000..b6729c852abc3 --- /dev/null +++ b/src/test/ui/const-generics/different_byref_simple.full.stderr @@ -0,0 +1,12 @@ +error[E0308]: mismatched types + --> $DIR/different_byref_simple.rs:12:9 + | +LL | u = ConstUsize::<4> {}; + | ^^^^^^^^^^^^^^^^^^ expected `3_usize`, found `4_usize` + | + = note: expected struct `ConstUsize<3_usize>` + found struct `ConstUsize<4_usize>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/const-generics/different_byref_simple.min.stderr b/src/test/ui/const-generics/different_byref_simple.min.stderr new file mode 100644 index 0000000000000..b6729c852abc3 --- /dev/null +++ b/src/test/ui/const-generics/different_byref_simple.min.stderr @@ -0,0 +1,12 @@ +error[E0308]: mismatched types + --> $DIR/different_byref_simple.rs:12:9 + | +LL | u = ConstUsize::<4> {}; + | ^^^^^^^^^^^^^^^^^^ expected `3_usize`, found `4_usize` + | + = note: expected struct `ConstUsize<3_usize>` + found struct `ConstUsize<4_usize>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/const-generics/different_byref_simple.rs b/src/test/ui/const-generics/different_byref_simple.rs new file mode 100644 index 0000000000000..93289f933317c --- /dev/null +++ b/src/test/ui/const-generics/different_byref_simple.rs @@ -0,0 +1,14 @@ +// Check that different const types are different. +// revisions: full min + +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] + +struct ConstUsize {} + +fn main() { + let mut u = ConstUsize::<3> {}; + u = ConstUsize::<4> {}; + //~^ ERROR mismatched types +} diff --git a/src/test/ui/const-generics/fn-const-param-call.full.stderr b/src/test/ui/const-generics/fn-const-param-call.full.stderr new file mode 100644 index 0000000000000..f1bd8def9ff16 --- /dev/null +++ b/src/test/ui/const-generics/fn-const-param-call.full.stderr @@ -0,0 +1,14 @@ +error: using function pointers as const generic parameters is forbidden + --> $DIR/fn-const-param-call.rs:12:25 + | +LL | struct Wrapper u32>; + | ^^^^^^^^^^^ + +error: using function pointers as const generic parameters is forbidden + --> $DIR/fn-const-param-call.rs:14:15 + | +LL | impl u32> Wrapper { + | ^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/const-generics/fn-const-param-call.min.stderr b/src/test/ui/const-generics/fn-const-param-call.min.stderr new file mode 100644 index 0000000000000..83acd04e4640b --- /dev/null +++ b/src/test/ui/const-generics/fn-const-param-call.min.stderr @@ -0,0 +1,20 @@ +error: using function pointers as const generic parameters is forbidden + --> $DIR/fn-const-param-call.rs:12:25 + | +LL | struct Wrapper u32>; + | ^^^^^^^^^^^ + | + = note: the only supported types are integers, `bool` and `char` + = note: more complex types are supported with `#[feature(const_generics)]` + +error: using function pointers as const generic parameters is forbidden + --> $DIR/fn-const-param-call.rs:14:15 + | +LL | impl u32> Wrapper { + | ^^^^^^^^^^^ + | + = note: the only supported types are integers, `bool` and `char` + = note: more complex types are supported with `#[feature(const_generics)]` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/const-generics/fn-const-param-call.rs b/src/test/ui/const-generics/fn-const-param-call.rs index 90c438b05cb81..bba6c1f7a16f4 100644 --- a/src/test/ui/const-generics/fn-const-param-call.rs +++ b/src/test/ui/const-generics/fn-const-param-call.rs @@ -1,5 +1,9 @@ -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +// Check that functions cannot be used as const parameters. +// revisions: full min + +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] fn function() -> u32 { 17 diff --git a/src/test/ui/const-generics/fn-const-param-call.stderr b/src/test/ui/const-generics/fn-const-param-call.stderr deleted file mode 100644 index b5811243caa8a..0000000000000 --- a/src/test/ui/const-generics/fn-const-param-call.stderr +++ /dev/null @@ -1,23 +0,0 @@ -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/fn-const-param-call.rs:1:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -error: using function pointers as const generic parameters is forbidden - --> $DIR/fn-const-param-call.rs:8:25 - | -LL | struct Wrapper u32>; - | ^^^^^^^^^^^ - -error: using function pointers as const generic parameters is forbidden - --> $DIR/fn-const-param-call.rs:10:15 - | -LL | impl u32> Wrapper { - | ^^^^^^^^^^^ - -error: aborting due to 2 previous errors; 1 warning emitted - diff --git a/src/test/ui/const-generics/fn-const-param-infer.full.stderr b/src/test/ui/const-generics/fn-const-param-infer.full.stderr new file mode 100644 index 0000000000000..4bdc9b89af607 --- /dev/null +++ b/src/test/ui/const-generics/fn-const-param-infer.full.stderr @@ -0,0 +1,8 @@ +error: using function pointers as const generic parameters is forbidden + --> $DIR/fn-const-param-infer.rs:7:25 + | +LL | struct Checked bool>; + | ^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/const-generics/fn-const-param-infer.min.stderr b/src/test/ui/const-generics/fn-const-param-infer.min.stderr new file mode 100644 index 0000000000000..27d1101cbcb05 --- /dev/null +++ b/src/test/ui/const-generics/fn-const-param-infer.min.stderr @@ -0,0 +1,11 @@ +error: using function pointers as const generic parameters is forbidden + --> $DIR/fn-const-param-infer.rs:7:25 + | +LL | struct Checked bool>; + | ^^^^^^^^^^^^^^^^^ + | + = note: the only supported types are integers, `bool` and `char` + = note: more complex types are supported with `#[feature(const_generics)]` + +error: aborting due to previous error + diff --git a/src/test/ui/const-generics/fn-const-param-infer.rs b/src/test/ui/const-generics/fn-const-param-infer.rs index 14fa3b494b3fc..3ed75e7b00dd7 100644 --- a/src/test/ui/const-generics/fn-const-param-infer.rs +++ b/src/test/ui/const-generics/fn-const-param-infer.rs @@ -1,5 +1,8 @@ -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +// revisions: full min + +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] struct Checked bool>; //~^ ERROR: using function pointers as const generic parameters diff --git a/src/test/ui/const-generics/fn-const-param-infer.stderr b/src/test/ui/const-generics/fn-const-param-infer.stderr deleted file mode 100644 index 7aaa41eb7d7b1..0000000000000 --- a/src/test/ui/const-generics/fn-const-param-infer.stderr +++ /dev/null @@ -1,17 +0,0 @@ -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/fn-const-param-infer.rs:1:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -error: using function pointers as const generic parameters is forbidden - --> $DIR/fn-const-param-infer.rs:4:25 - | -LL | struct Checked bool>; - | ^^^^^^^^^^^^^^^^^ - -error: aborting due to previous error; 1 warning emitted - diff --git a/src/test/ui/const-generics/fn-taking-const-generic-array.rs b/src/test/ui/const-generics/fn-taking-const-generic-array.rs index 8e16221ed4bd2..950684aaa8dc1 100644 --- a/src/test/ui/const-generics/fn-taking-const-generic-array.rs +++ b/src/test/ui/const-generics/fn-taking-const-generic-array.rs @@ -1,7 +1,9 @@ // run-pass +// revisions: full min -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] use std::fmt::Display; diff --git a/src/test/ui/const-generics/fn-taking-const-generic-array.stderr b/src/test/ui/const-generics/fn-taking-const-generic-array.stderr deleted file mode 100644 index 52fd0a8fec03b..0000000000000 --- a/src/test/ui/const-generics/fn-taking-const-generic-array.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/fn-taking-const-generic-array.rs:3:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/const-generics/forbid-non-structural_match-types.full.stderr b/src/test/ui/const-generics/forbid-non-structural_match-types.full.stderr new file mode 100644 index 0000000000000..adcaa75996327 --- /dev/null +++ b/src/test/ui/const-generics/forbid-non-structural_match-types.full.stderr @@ -0,0 +1,9 @@ +error[E0741]: `C` must be annotated with `#[derive(PartialEq, Eq)]` to be used as the type of a const parameter + --> $DIR/forbid-non-structural_match-types.rs:15:19 + | +LL | struct D; + | ^ `C` doesn't derive both `PartialEq` and `Eq` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0741`. diff --git a/src/test/ui/const-generics/forbid-non-structural_match-types.min.stderr b/src/test/ui/const-generics/forbid-non-structural_match-types.min.stderr new file mode 100644 index 0000000000000..25aa354022304 --- /dev/null +++ b/src/test/ui/const-generics/forbid-non-structural_match-types.min.stderr @@ -0,0 +1,27 @@ +error: using `A` as const generic parameters is forbidden + --> $DIR/forbid-non-structural_match-types.rs:10:19 + | +LL | struct B; // ok + | ^ + | + = note: the only supported types are integers, `bool` and `char` + = note: more complex types are supported with `#[feature(const_generics)]` + +error: using `C` as const generic parameters is forbidden + --> $DIR/forbid-non-structural_match-types.rs:15:19 + | +LL | struct D; + | ^ + | + = note: the only supported types are integers, `bool` and `char` + = note: more complex types are supported with `#[feature(const_generics)]` + +error[E0741]: `C` must be annotated with `#[derive(PartialEq, Eq)]` to be used as the type of a const parameter + --> $DIR/forbid-non-structural_match-types.rs:15:19 + | +LL | struct D; + | ^ `C` doesn't derive both `PartialEq` and `Eq` + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0741`. diff --git a/src/test/ui/const-generics/forbid-non-structural_match-types.rs b/src/test/ui/const-generics/forbid-non-structural_match-types.rs index 514e215ba1aa2..86540db2d03a0 100644 --- a/src/test/ui/const-generics/forbid-non-structural_match-types.rs +++ b/src/test/ui/const-generics/forbid-non-structural_match-types.rs @@ -1,13 +1,18 @@ -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +// revisions: full min + +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] #[derive(PartialEq, Eq)] struct A; struct B; // ok +//[min]~^ ERROR using `A` as const generic parameters is forbidden struct C; struct D; //~ ERROR `C` must be annotated with `#[derive(PartialEq, Eq)]` +//[min]~^ ERROR using `C` as const generic parameters is forbidden fn main() {} diff --git a/src/test/ui/const-generics/forbid-non-structural_match-types.stderr b/src/test/ui/const-generics/forbid-non-structural_match-types.stderr deleted file mode 100644 index 600be64b1e1b8..0000000000000 --- a/src/test/ui/const-generics/forbid-non-structural_match-types.stderr +++ /dev/null @@ -1,18 +0,0 @@ -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/forbid-non-structural_match-types.rs:1:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -error[E0741]: `C` must be annotated with `#[derive(PartialEq, Eq)]` to be used as the type of a const parameter - --> $DIR/forbid-non-structural_match-types.rs:11:19 - | -LL | struct D; - | ^ `C` doesn't derive both `PartialEq` and `Eq` - -error: aborting due to previous error; 1 warning emitted - -For more information about this error, try `rustc --explain E0741`. diff --git a/src/test/ui/const-generics/foreign-item-const-parameter.stderr b/src/test/ui/const-generics/foreign-item-const-parameter.full.stderr similarity index 51% rename from src/test/ui/const-generics/foreign-item-const-parameter.stderr rename to src/test/ui/const-generics/foreign-item-const-parameter.full.stderr index ee947943af134..0ac51e8c9e61b 100644 --- a/src/test/ui/const-generics/foreign-item-const-parameter.stderr +++ b/src/test/ui/const-generics/foreign-item-const-parameter.full.stderr @@ -1,14 +1,5 @@ -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/foreign-item-const-parameter.rs:1:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - error[E0044]: foreign items may not have const parameters - --> $DIR/foreign-item-const-parameter.rs:5:5 + --> $DIR/foreign-item-const-parameter.rs:8:5 | LL | fn foo(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't have const parameters @@ -16,13 +7,13 @@ LL | fn foo(); = help: replace the const parameters with concrete consts error[E0044]: foreign items may not have type or const parameters - --> $DIR/foreign-item-const-parameter.rs:7:5 + --> $DIR/foreign-item-const-parameter.rs:10:5 | LL | fn bar(_: T); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't have type or const parameters | = help: replace the type or const parameters with concrete types or consts -error: aborting due to 2 previous errors; 1 warning emitted +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0044`. diff --git a/src/test/ui/const-generics/foreign-item-const-parameter.min.stderr b/src/test/ui/const-generics/foreign-item-const-parameter.min.stderr new file mode 100644 index 0000000000000..0ac51e8c9e61b --- /dev/null +++ b/src/test/ui/const-generics/foreign-item-const-parameter.min.stderr @@ -0,0 +1,19 @@ +error[E0044]: foreign items may not have const parameters + --> $DIR/foreign-item-const-parameter.rs:8:5 + | +LL | fn foo(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't have const parameters + | + = help: replace the const parameters with concrete consts + +error[E0044]: foreign items may not have type or const parameters + --> $DIR/foreign-item-const-parameter.rs:10:5 + | +LL | fn bar(_: T); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't have type or const parameters + | + = help: replace the type or const parameters with concrete types or consts + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0044`. diff --git a/src/test/ui/const-generics/foreign-item-const-parameter.rs b/src/test/ui/const-generics/foreign-item-const-parameter.rs index 41113780de32e..44b6d0332c3f9 100644 --- a/src/test/ui/const-generics/foreign-item-const-parameter.rs +++ b/src/test/ui/const-generics/foreign-item-const-parameter.rs @@ -1,5 +1,8 @@ -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +// revisions: full min + +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] extern "C" { fn foo(); //~ ERROR foreign items may not have const parameters diff --git a/src/test/ui/const-generics/impl-const-generic-struct.rs b/src/test/ui/const-generics/impl-const-generic-struct.rs index 4c2aee59ffebe..05cabc46baa34 100644 --- a/src/test/ui/const-generics/impl-const-generic-struct.rs +++ b/src/test/ui/const-generics/impl-const-generic-struct.rs @@ -1,7 +1,9 @@ // run-pass +// revisions: full min -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] struct S; diff --git a/src/test/ui/const-generics/impl-const-generic-struct.stderr b/src/test/ui/const-generics/impl-const-generic-struct.stderr deleted file mode 100644 index 9d68df07ce677..0000000000000 --- a/src/test/ui/const-generics/impl-const-generic-struct.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/impl-const-generic-struct.rs:3:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/const-generics/incorrect-number-of-const-args.full.stderr b/src/test/ui/const-generics/incorrect-number-of-const-args.full.stderr new file mode 100644 index 0000000000000..6b902e2d6585e --- /dev/null +++ b/src/test/ui/const-generics/incorrect-number-of-const-args.full.stderr @@ -0,0 +1,15 @@ +error[E0107]: wrong number of const arguments: expected 2, found 1 + --> $DIR/incorrect-number-of-const-args.rs:12:5 + | +LL | foo::<0>(); + | ^^^^^^^^ expected 2 const arguments + +error[E0107]: wrong number of const arguments: expected 2, found 3 + --> $DIR/incorrect-number-of-const-args.rs:13:17 + | +LL | foo::<0, 0, 0>(); + | ^ unexpected const argument + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0107`. diff --git a/src/test/ui/const-generics/incorrect-number-of-const-args.min.stderr b/src/test/ui/const-generics/incorrect-number-of-const-args.min.stderr new file mode 100644 index 0000000000000..6b902e2d6585e --- /dev/null +++ b/src/test/ui/const-generics/incorrect-number-of-const-args.min.stderr @@ -0,0 +1,15 @@ +error[E0107]: wrong number of const arguments: expected 2, found 1 + --> $DIR/incorrect-number-of-const-args.rs:12:5 + | +LL | foo::<0>(); + | ^^^^^^^^ expected 2 const arguments + +error[E0107]: wrong number of const arguments: expected 2, found 3 + --> $DIR/incorrect-number-of-const-args.rs:13:17 + | +LL | foo::<0, 0, 0>(); + | ^ unexpected const argument + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0107`. diff --git a/src/test/ui/const-generics/incorrect-number-of-const-args.rs b/src/test/ui/const-generics/incorrect-number-of-const-args.rs index cea64654e11a0..f7bdf761f7d12 100644 --- a/src/test/ui/const-generics/incorrect-number-of-const-args.rs +++ b/src/test/ui/const-generics/incorrect-number-of-const-args.rs @@ -1,5 +1,8 @@ -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +// revisions: full min + +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] fn foo() -> usize { 0 diff --git a/src/test/ui/const-generics/incorrect-number-of-const-args.stderr b/src/test/ui/const-generics/incorrect-number-of-const-args.stderr deleted file mode 100644 index 51064d7f90fb2..0000000000000 --- a/src/test/ui/const-generics/incorrect-number-of-const-args.stderr +++ /dev/null @@ -1,24 +0,0 @@ -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/incorrect-number-of-const-args.rs:1:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -error[E0107]: wrong number of const arguments: expected 2, found 1 - --> $DIR/incorrect-number-of-const-args.rs:9:5 - | -LL | foo::<0>(); - | ^^^^^^^^ expected 2 const arguments - -error[E0107]: wrong number of const arguments: expected 2, found 3 - --> $DIR/incorrect-number-of-const-args.rs:10:17 - | -LL | foo::<0, 0, 0>(); - | ^ unexpected const argument - -error: aborting due to 2 previous errors; 1 warning emitted - -For more information about this error, try `rustc --explain E0107`. diff --git a/src/test/ui/const-generics/infer_arg_from_pat.rs b/src/test/ui/const-generics/infer_arg_from_pat.rs index 7e8152dacc46c..609fdb35cf18d 100644 --- a/src/test/ui/const-generics/infer_arg_from_pat.rs +++ b/src/test/ui/const-generics/infer_arg_from_pat.rs @@ -1,8 +1,11 @@ // run-pass // // see issue #70529 -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +// revisions: full min + +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] struct A { arr: [u8; N], diff --git a/src/test/ui/const-generics/infer_arg_from_pat.stderr b/src/test/ui/const-generics/infer_arg_from_pat.stderr deleted file mode 100644 index f52e5e49a3bde..0000000000000 --- a/src/test/ui/const-generics/infer_arg_from_pat.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/infer_arg_from_pat.rs:4:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/const-generics/infer_arr_len_from_pat.rs b/src/test/ui/const-generics/infer_arr_len_from_pat.rs index cede9ea045d44..cbf48e3d24997 100644 --- a/src/test/ui/const-generics/infer_arr_len_from_pat.rs +++ b/src/test/ui/const-generics/infer_arr_len_from_pat.rs @@ -1,8 +1,11 @@ // check-pass // // see issue #70529 -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +// revisions: full min + +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] fn as_chunks() -> [u8; N] { loop {} diff --git a/src/test/ui/const-generics/infer_arr_len_from_pat.stderr b/src/test/ui/const-generics/infer_arr_len_from_pat.stderr deleted file mode 100644 index dfadfbb16637a..0000000000000 --- a/src/test/ui/const-generics/infer_arr_len_from_pat.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/infer_arr_len_from_pat.rs:4:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/const-generics/integer-literal-generic-arg-in-where-clause.rs b/src/test/ui/const-generics/integer-literal-generic-arg-in-where-clause.rs index 952e05bac30f4..bdbf338295ccc 100644 --- a/src/test/ui/const-generics/integer-literal-generic-arg-in-where-clause.rs +++ b/src/test/ui/const-generics/integer-literal-generic-arg-in-where-clause.rs @@ -1,7 +1,9 @@ // check-pass +// revisions: full min -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] fn takes_closure_of_array_3(f: F) where F: Fn([i32; 3]) { f([1, 2, 3]); @@ -15,4 +17,7 @@ fn returns_closure_of_array_3() -> impl Fn([i32; 3]) { |_| {} } -fn main() {} +fn main() { + takes_closure_of_array_3(returns_closure_of_array_3()); + takes_closure_of_array_3_apit(returns_closure_of_array_3()); +} diff --git a/src/test/ui/const-generics/integer-literal-generic-arg-in-where-clause.stderr b/src/test/ui/const-generics/integer-literal-generic-arg-in-where-clause.stderr deleted file mode 100644 index aadd10e5ccab3..0000000000000 --- a/src/test/ui/const-generics/integer-literal-generic-arg-in-where-clause.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/integer-literal-generic-arg-in-where-clause.rs:3:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/const-generics/issue-61522-array-len-succ.full.stderr b/src/test/ui/const-generics/issue-61522-array-len-succ.full.stderr new file mode 100644 index 0000000000000..8855f187e9703 --- /dev/null +++ b/src/test/ui/const-generics/issue-61522-array-len-succ.full.stderr @@ -0,0 +1,18 @@ +error: constant expression depends on a generic parameter + --> $DIR/issue-61522-array-len-succ.rs:7:40 + | +LL | pub struct MyArray([u8; COUNT + 1]); + | ^^^^^^^^^^^^^^^ + | + = note: this may fail depending on what value the parameter takes + +error: constant expression depends on a generic parameter + --> $DIR/issue-61522-array-len-succ.rs:12:24 + | +LL | fn inner(&self) -> &[u8; COUNT + 1] { + | ^^^^^^^^^^^^^^^^ + | + = note: this may fail depending on what value the parameter takes + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/const-generics/issue-61522-array-len-succ.min.stderr b/src/test/ui/const-generics/issue-61522-array-len-succ.min.stderr new file mode 100644 index 0000000000000..a1b1a095041b3 --- /dev/null +++ b/src/test/ui/const-generics/issue-61522-array-len-succ.min.stderr @@ -0,0 +1,18 @@ +error: generic parameters must not be used inside of non trivial constant values + --> $DIR/issue-61522-array-len-succ.rs:7:45 + | +LL | pub struct MyArray([u8; COUNT + 1]); + | ^^^^^ non-trivial anonymous constants must not depend on the parameter `COUNT` + | + = help: it is currently only allowed to use either `COUNT` or `{ COUNT }` as generic constants + +error: generic parameters must not be used inside of non trivial constant values + --> $DIR/issue-61522-array-len-succ.rs:12:30 + | +LL | fn inner(&self) -> &[u8; COUNT + 1] { + | ^^^^^ non-trivial anonymous constants must not depend on the parameter `COUNT` + | + = help: it is currently only allowed to use either `COUNT` or `{ COUNT }` as generic constants + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/const-generics/issue-61522-array-len-succ.rs b/src/test/ui/const-generics/issue-61522-array-len-succ.rs index 7c8cdeece8718..81443b90d6156 100644 --- a/src/test/ui/const-generics/issue-61522-array-len-succ.rs +++ b/src/test/ui/const-generics/issue-61522-array-len-succ.rs @@ -1,12 +1,17 @@ -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +// revisions: full min + +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] pub struct MyArray([u8; COUNT + 1]); -//~^ ERROR constant expression depends on a generic parameter +//[full]~^ ERROR constant expression depends on a generic parameter +//[min]~^^ ERROR generic parameters must not be used impl MyArray { fn inner(&self) -> &[u8; COUNT + 1] { - //~^ ERROR constant expression depends on a generic parameter + //[full]~^ ERROR constant expression depends on a generic parameter + //[min]~^^ ERROR generic parameters must not be used &self.0 } } diff --git a/src/test/ui/const-generics/issue-61522-array-len-succ.stderr b/src/test/ui/const-generics/issue-61522-array-len-succ.stderr deleted file mode 100644 index a1fbd5f2025bf..0000000000000 --- a/src/test/ui/const-generics/issue-61522-array-len-succ.stderr +++ /dev/null @@ -1,27 +0,0 @@ -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/issue-61522-array-len-succ.rs:1:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -error: constant expression depends on a generic parameter - --> $DIR/issue-61522-array-len-succ.rs:4:40 - | -LL | pub struct MyArray([u8; COUNT + 1]); - | ^^^^^^^^^^^^^^^ - | - = note: this may fail depending on what value the parameter takes - -error: constant expression depends on a generic parameter - --> $DIR/issue-61522-array-len-succ.rs:8:24 - | -LL | fn inner(&self) -> &[u8; COUNT + 1] { - | ^^^^^^^^^^^^^^^^ - | - = note: this may fail depending on what value the parameter takes - -error: aborting due to 2 previous errors; 1 warning emitted - diff --git a/src/test/ui/const-generics/issue-66596-impl-trait-for-str-const-arg.min.stderr b/src/test/ui/const-generics/issue-66596-impl-trait-for-str-const-arg.min.stderr new file mode 100644 index 0000000000000..3ff17ddb3bcf3 --- /dev/null +++ b/src/test/ui/const-generics/issue-66596-impl-trait-for-str-const-arg.min.stderr @@ -0,0 +1,11 @@ +error: using `&'static str` as const generic parameters is forbidden + --> $DIR/issue-66596-impl-trait-for-str-const-arg.rs:9:25 + | +LL | trait Trait { + | ^^^^^^^^^^^^ + | + = note: the only supported types are integers, `bool` and `char` + = note: more complex types are supported with `#[feature(const_generics)]` + +error: aborting due to previous error + diff --git a/src/test/ui/const-generics/issue-66596-impl-trait-for-str-const-arg.rs b/src/test/ui/const-generics/issue-66596-impl-trait-for-str-const-arg.rs index 74f036e6d89b5..d458a366fb373 100644 --- a/src/test/ui/const-generics/issue-66596-impl-trait-for-str-const-arg.rs +++ b/src/test/ui/const-generics/issue-66596-impl-trait-for-str-const-arg.rs @@ -1,9 +1,13 @@ -// check-pass +//[full] check-pass +// revisions: full min + +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete trait Trait { +//[min]~^ ERROR using `&'static str` as const generic parameters is forbidden type Assoc; } diff --git a/src/test/ui/const-generics/issue-66596-impl-trait-for-str-const-arg.stderr b/src/test/ui/const-generics/issue-66596-impl-trait-for-str-const-arg.stderr deleted file mode 100644 index 720420d9cd684..0000000000000 --- a/src/test/ui/const-generics/issue-66596-impl-trait-for-str-const-arg.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/issue-66596-impl-trait-for-str-const-arg.rs:3:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/const-generics/issue-68104-print-stack-overflow.rs b/src/test/ui/const-generics/issue-68104-print-stack-overflow.rs index bda9ce8767d08..eab63d3a6e6ab 100644 --- a/src/test/ui/const-generics/issue-68104-print-stack-overflow.rs +++ b/src/test/ui/const-generics/issue-68104-print-stack-overflow.rs @@ -1,8 +1,10 @@ // aux-build:impl-const.rs // run-pass +// revisions: full min -#![feature(const_generics)] -#![allow(incomplete_features)] +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] extern crate impl_const; diff --git a/src/test/ui/const-generics/issue-70180-1-stalled_on.rs b/src/test/ui/const-generics/issue-70180-1-stalled_on.rs index ff2a5250263d5..9cfa57006d5c6 100644 --- a/src/test/ui/const-generics/issue-70180-1-stalled_on.rs +++ b/src/test/ui/const-generics/issue-70180-1-stalled_on.rs @@ -1,6 +1,9 @@ // build-pass -#![feature(const_generics)] -#![allow(incomplete_features)] +// revisions: full min + +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] pub fn works() { let array/*: [_; _]*/ = default_array(); diff --git a/src/test/ui/const-generics/issue-70180-2-stalled_on.rs b/src/test/ui/const-generics/issue-70180-2-stalled_on.rs index 83338668f4ffd..bbde404966ccf 100644 --- a/src/test/ui/const-generics/issue-70180-2-stalled_on.rs +++ b/src/test/ui/const-generics/issue-70180-2-stalled_on.rs @@ -1,6 +1,9 @@ // build-pass -#![feature(const_generics)] -#![allow(incomplete_features)] +// revisions: full min + +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] fn works() { let array/*: [u8; _]*/ = default_byte_array(); diff --git a/src/test/ui/const-generics/issue-71986.rs b/src/test/ui/const-generics/issue-71986.rs index 048ed18c927bf..d4c962452d182 100644 --- a/src/test/ui/const-generics/issue-71986.rs +++ b/src/test/ui/const-generics/issue-71986.rs @@ -1,6 +1,9 @@ // check-pass -#![allow(incomplete_features)] -#![feature(const_generics)] +// revisions: full min + +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] pub trait Foo {} pub fn bar>() {} diff --git a/src/test/ui/const-generics/mut-ref-const-param-array.rs b/src/test/ui/const-generics/mut-ref-const-param-array.rs index 9ca1f4552f596..cf24cbe7e82ba 100644 --- a/src/test/ui/const-generics/mut-ref-const-param-array.rs +++ b/src/test/ui/const-generics/mut-ref-const-param-array.rs @@ -1,7 +1,10 @@ // run-pass +// revisions: full min + +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete use std::ops::AddAssign; diff --git a/src/test/ui/const-generics/mut-ref-const-param-array.stderr b/src/test/ui/const-generics/mut-ref-const-param-array.stderr deleted file mode 100644 index acbc2df1d740f..0000000000000 --- a/src/test/ui/const-generics/mut-ref-const-param-array.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/mut-ref-const-param-array.rs:3:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/const-generics/nested-type.stderr b/src/test/ui/const-generics/nested-type.full.stderr similarity index 76% rename from src/test/ui/const-generics/nested-type.stderr rename to src/test/ui/const-generics/nested-type.full.stderr index da0e8032404fc..012b8fe587b30 100644 --- a/src/test/ui/const-generics/nested-type.stderr +++ b/src/test/ui/const-generics/nested-type.full.stderr @@ -1,154 +1,154 @@ error[E0391]: cycle detected when computing type of `Foo` - --> $DIR/nested-type.rs:4:1 + --> $DIR/nested-type.rs:7:1 | LL | struct Foo $DIR/nested-type.rs:4:18 + --> $DIR/nested-type.rs:7:18 | LL | struct Foo $DIR/nested-type.rs:4:26 + --> $DIR/nested-type.rs:7:26 | LL | struct Foo; +LL | | ... | LL | | Foo::<17>::value() LL | | }]>; | |_^ note: ...which requires const-evaluating + checking `Foo::{{constant}}#0`... - --> $DIR/nested-type.rs:4:26 + --> $DIR/nested-type.rs:7:26 | LL | struct Foo; +LL | | ... | LL | | Foo::<17>::value() LL | | }]>; | |_^ note: ...which requires const-evaluating `Foo::{{constant}}#0`... - --> $DIR/nested-type.rs:4:26 + --> $DIR/nested-type.rs:7:26 | LL | struct Foo; +LL | | ... | LL | | Foo::<17>::value() LL | | }]>; | |_^ note: ...which requires type-checking `Foo::{{constant}}#0`... - --> $DIR/nested-type.rs:4:26 + --> $DIR/nested-type.rs:7:26 | LL | struct Foo; +LL | | ... | LL | | Foo::<17>::value() LL | | }]>; | |_^ note: ...which requires computing the variances of `Foo::{{constant}}#0::Foo`... - --> $DIR/nested-type.rs:7:5 + --> $DIR/nested-type.rs:11:5 | LL | struct Foo; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: ...which requires computing the variances for items in this crate... = note: ...which again requires computing type of `Foo`, completing the cycle note: cycle used when collecting item types in top-level module - --> $DIR/nested-type.rs:1:1 + --> $DIR/nested-type.rs:3:1 | -LL | / #![feature(const_generics)] -LL | | #![allow(incomplete_features)] +LL | / #![cfg_attr(full, feature(const_generics))] +LL | | #![cfg_attr(full, allow(incomplete_features))] +LL | | #![cfg_attr(min, feature(min_const_generics))] LL | | -LL | | struct Foo $DIR/nested-type.rs:4:1 + --> $DIR/nested-type.rs:7:1 | LL | struct Foo $DIR/nested-type.rs:4:18 + --> $DIR/nested-type.rs:7:18 | LL | struct Foo $DIR/nested-type.rs:4:26 + --> $DIR/nested-type.rs:7:26 | LL | struct Foo; +LL | | ... | LL | | Foo::<17>::value() LL | | }]>; | |_^ note: ...which requires const-evaluating + checking `Foo::{{constant}}#0`... - --> $DIR/nested-type.rs:4:26 + --> $DIR/nested-type.rs:7:26 | LL | struct Foo; +LL | | ... | LL | | Foo::<17>::value() LL | | }]>; | |_^ note: ...which requires const-evaluating `Foo::{{constant}}#0`... - --> $DIR/nested-type.rs:4:26 + --> $DIR/nested-type.rs:7:26 | LL | struct Foo; +LL | | ... | LL | | Foo::<17>::value() LL | | }]>; | |_^ note: ...which requires type-checking `Foo::{{constant}}#0`... - --> $DIR/nested-type.rs:4:26 + --> $DIR/nested-type.rs:7:26 | LL | struct Foo; +LL | | ... | LL | | Foo::<17>::value() LL | | }]>; | |_^ note: ...which requires computing the variances of `Foo::{{constant}}#0::Foo`... - --> $DIR/nested-type.rs:7:5 + --> $DIR/nested-type.rs:11:5 | LL | struct Foo; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: ...which requires computing the variances for items in this crate... = note: ...which again requires computing type of `Foo`, completing the cycle note: cycle used when collecting item types in top-level module - --> $DIR/nested-type.rs:1:1 + --> $DIR/nested-type.rs:3:1 | -LL | / #![feature(const_generics)] -LL | | #![allow(incomplete_features)] +LL | / #![cfg_attr(full, feature(const_generics))] +LL | | #![cfg_attr(full, allow(incomplete_features))] +LL | | #![cfg_attr(min, feature(min_const_generics))] LL | | -LL | | struct Foo $DIR/nested-type.rs:7:21 + | +LL | struct Foo::value() +LL | | }]>; + | |__^ + | + = note: the only supported types are integers, `bool` and `char` + = note: more complex types are supported with `#[feature(const_generics)]` + +error[E0391]: cycle detected when computing type of `Foo` + --> $DIR/nested-type.rs:7:1 + | +LL | struct Foo $DIR/nested-type.rs:7:18 + | +LL | struct Foo $DIR/nested-type.rs:7:26 + | +LL | struct Foo::value() +LL | | }]>; + | |_^ +note: ...which requires const-evaluating + checking `Foo::{{constant}}#0`... + --> $DIR/nested-type.rs:7:26 + | +LL | struct Foo::value() +LL | | }]>; + | |_^ +note: ...which requires const-evaluating `Foo::{{constant}}#0`... + --> $DIR/nested-type.rs:7:26 + | +LL | struct Foo::value() +LL | | }]>; + | |_^ +note: ...which requires type-checking `Foo::{{constant}}#0`... + --> $DIR/nested-type.rs:7:26 + | +LL | struct Foo::value() +LL | | }]>; + | |_^ +note: ...which requires computing the variances of `Foo::{{constant}}#0::Foo`... + --> $DIR/nested-type.rs:11:5 + | +LL | struct Foo; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: ...which requires computing the variances for items in this crate... + = note: ...which again requires computing type of `Foo`, completing the cycle +note: cycle used when collecting item types in top-level module + --> $DIR/nested-type.rs:3:1 + | +LL | / #![cfg_attr(full, feature(const_generics))] +LL | | #![cfg_attr(full, allow(incomplete_features))] +LL | | #![cfg_attr(min, feature(min_const_generics))] +LL | | +... | +LL | | +LL | | fn main() {} + | |____________^ + +error[E0391]: cycle detected when computing type of `Foo` + --> $DIR/nested-type.rs:7:1 + | +LL | struct Foo $DIR/nested-type.rs:7:18 + | +LL | struct Foo $DIR/nested-type.rs:7:26 + | +LL | struct Foo::value() +LL | | }]>; + | |_^ +note: ...which requires const-evaluating + checking `Foo::{{constant}}#0`... + --> $DIR/nested-type.rs:7:26 + | +LL | struct Foo::value() +LL | | }]>; + | |_^ +note: ...which requires const-evaluating `Foo::{{constant}}#0`... + --> $DIR/nested-type.rs:7:26 + | +LL | struct Foo::value() +LL | | }]>; + | |_^ +note: ...which requires type-checking `Foo::{{constant}}#0`... + --> $DIR/nested-type.rs:7:26 + | +LL | struct Foo::value() +LL | | }]>; + | |_^ +note: ...which requires computing the variances of `Foo::{{constant}}#0::Foo`... + --> $DIR/nested-type.rs:11:5 + | +LL | struct Foo; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: ...which requires computing the variances for items in this crate... + = note: ...which again requires computing type of `Foo`, completing the cycle +note: cycle used when collecting item types in top-level module + --> $DIR/nested-type.rs:3:1 + | +LL | / #![cfg_attr(full, feature(const_generics))] +LL | | #![cfg_attr(full, allow(incomplete_features))] +LL | | #![cfg_attr(min, feature(min_const_generics))] +LL | | +... | +LL | | +LL | | fn main() {} + | |____________^ + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0391`. diff --git a/src/test/ui/const-generics/nested-type.rs b/src/test/ui/const-generics/nested-type.rs index 12ea850c8f686..98a5a0dd3d8fd 100644 --- a/src/test/ui/const-generics/nested-type.rs +++ b/src/test/ui/const-generics/nested-type.rs @@ -1,9 +1,13 @@ -#![feature(const_generics)] -#![allow(incomplete_features)] +// revisions: full min + +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] struct Foo; impl Foo { diff --git a/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.stderr b/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.full.stderr similarity index 54% rename from src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.stderr rename to src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.full.stderr index 571be91683b7c..3dccfd73dcccb 100644 --- a/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.stderr +++ b/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.full.stderr @@ -1,5 +1,5 @@ error: type parameters with a default must be trailing - --> $DIR/params-in-ct-in-ty-param-lazy-norm.rs:7:12 + --> $DIR/params-in-ct-in-ty-param-lazy-norm.rs:12:12 | LL | struct Bar(T); | ^ @@ -7,25 +7,16 @@ LL | struct Bar(T); = note: using type defaults and const parameters in the same parameter list is currently not permitted error: constant values inside of type parameter defaults must not depend on generic parameters - --> $DIR/params-in-ct-in-ty-param-lazy-norm.rs:3:44 + --> $DIR/params-in-ct-in-ty-param-lazy-norm.rs:7:44 | LL | struct Foo()]>(T, U); | ^ the anonymous constant must not depend on the parameter `T` error: constant values inside of type parameter defaults must not depend on generic parameters - --> $DIR/params-in-ct-in-ty-param-lazy-norm.rs:7:21 + --> $DIR/params-in-ct-in-ty-param-lazy-norm.rs:12:21 | LL | struct Bar(T); | ^ the anonymous constant must not depend on the parameter `N` -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/params-in-ct-in-ty-param-lazy-norm.rs:1:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -error: aborting due to 3 previous errors; 1 warning emitted +error: aborting due to 3 previous errors diff --git a/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.min.stderr b/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.min.stderr new file mode 100644 index 0000000000000..461822a96083b --- /dev/null +++ b/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.min.stderr @@ -0,0 +1,24 @@ +error: type parameters with a default must be trailing + --> $DIR/params-in-ct-in-ty-param-lazy-norm.rs:12:12 + | +LL | struct Bar(T); + | ^ + | + = note: using type defaults and const parameters in the same parameter list is currently not permitted + +error: generic parameters must not be used inside of non trivial constant values + --> $DIR/params-in-ct-in-ty-param-lazy-norm.rs:7:44 + | +LL | struct Foo()]>(T, U); + | ^ non-trivial anonymous constants must not depend on the parameter `T` + | + = help: it is currently only allowed to use either `T` or `{ T }` as generic constants + +error: constant values inside of type parameter defaults must not depend on generic parameters + --> $DIR/params-in-ct-in-ty-param-lazy-norm.rs:12:21 + | +LL | struct Bar(T); + | ^ the anonymous constant must not depend on the parameter `N` + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.rs b/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.rs index 84bbea5b88057..e52773c78dbd3 100644 --- a/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.rs +++ b/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.rs @@ -1,7 +1,12 @@ -#![feature(const_generics)] //~ WARN the feature `const_generics` is incomplete +// revisions: full min + +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] struct Foo()]>(T, U); -//~^ ERROR constant values inside of type parameter defaults +//[full]~^ ERROR constant values inside of type parameter defaults +//[min]~^^ ERROR generic parameters must not be used inside of non trivial // FIXME(const_generics:defaults): We still don't know how to we deal with type defaults. struct Bar(T); diff --git a/src/test/ui/const-generics/raw-ptr-const-param-deref.full.stderr b/src/test/ui/const-generics/raw-ptr-const-param-deref.full.stderr new file mode 100644 index 0000000000000..ffaab51f766d8 --- /dev/null +++ b/src/test/ui/const-generics/raw-ptr-const-param-deref.full.stderr @@ -0,0 +1,14 @@ +error: using raw pointers as const generic parameters is forbidden + --> $DIR/raw-ptr-const-param-deref.rs:10:23 + | +LL | struct Const; + | ^^^^^^^^^^ + +error: using raw pointers as const generic parameters is forbidden + --> $DIR/raw-ptr-const-param-deref.rs:12:15 + | +LL | impl Const

{ + | ^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/const-generics/raw-ptr-const-param-deref.min.stderr b/src/test/ui/const-generics/raw-ptr-const-param-deref.min.stderr new file mode 100644 index 0000000000000..dc4bb8b0f042a --- /dev/null +++ b/src/test/ui/const-generics/raw-ptr-const-param-deref.min.stderr @@ -0,0 +1,20 @@ +error: using raw pointers as const generic parameters is forbidden + --> $DIR/raw-ptr-const-param-deref.rs:10:23 + | +LL | struct Const; + | ^^^^^^^^^^ + | + = note: the only supported types are integers, `bool` and `char` + = note: more complex types are supported with `#[feature(const_generics)]` + +error: using raw pointers as const generic parameters is forbidden + --> $DIR/raw-ptr-const-param-deref.rs:12:15 + | +LL | impl Const

{ + | ^^^^^^^^^^ + | + = note: the only supported types are integers, `bool` and `char` + = note: more complex types are supported with `#[feature(const_generics)]` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/const-generics/raw-ptr-const-param-deref.rs b/src/test/ui/const-generics/raw-ptr-const-param-deref.rs index 97ca9d6a44c9e..20cc62ebc17cd 100644 --- a/src/test/ui/const-generics/raw-ptr-const-param-deref.rs +++ b/src/test/ui/const-generics/raw-ptr-const-param-deref.rs @@ -1,5 +1,9 @@ -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +// Checks that pointers must not be used as the type of const params. +// revisions: full min + +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] const A: u32 = 3; diff --git a/src/test/ui/const-generics/raw-ptr-const-param-deref.stderr b/src/test/ui/const-generics/raw-ptr-const-param-deref.stderr deleted file mode 100644 index 1ce8bb9c05423..0000000000000 --- a/src/test/ui/const-generics/raw-ptr-const-param-deref.stderr +++ /dev/null @@ -1,23 +0,0 @@ -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/raw-ptr-const-param-deref.rs:1:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -error: using raw pointers as const generic parameters is forbidden - --> $DIR/raw-ptr-const-param-deref.rs:6:23 - | -LL | struct Const; - | ^^^^^^^^^^ - -error: using raw pointers as const generic parameters is forbidden - --> $DIR/raw-ptr-const-param-deref.rs:8:15 - | -LL | impl Const

{ - | ^^^^^^^^^^ - -error: aborting due to 2 previous errors; 1 warning emitted - diff --git a/src/test/ui/const-generics/raw-ptr-const-param.full.stderr b/src/test/ui/const-generics/raw-ptr-const-param.full.stderr new file mode 100644 index 0000000000000..d317aa0f585cf --- /dev/null +++ b/src/test/ui/const-generics/raw-ptr-const-param.full.stderr @@ -0,0 +1,8 @@ +error: using raw pointers as const generic parameters is forbidden + --> $DIR/raw-ptr-const-param.rs:7:23 + | +LL | struct Const; + | ^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/const-generics/raw-ptr-const-param.min.stderr b/src/test/ui/const-generics/raw-ptr-const-param.min.stderr new file mode 100644 index 0000000000000..f387974a21aca --- /dev/null +++ b/src/test/ui/const-generics/raw-ptr-const-param.min.stderr @@ -0,0 +1,11 @@ +error: using raw pointers as const generic parameters is forbidden + --> $DIR/raw-ptr-const-param.rs:7:23 + | +LL | struct Const; + | ^^^^^^^^^^ + | + = note: the only supported types are integers, `bool` and `char` + = note: more complex types are supported with `#[feature(const_generics)]` + +error: aborting due to previous error + diff --git a/src/test/ui/const-generics/raw-ptr-const-param.rs b/src/test/ui/const-generics/raw-ptr-const-param.rs index 237b410e073d6..36e593aa21022 100644 --- a/src/test/ui/const-generics/raw-ptr-const-param.rs +++ b/src/test/ui/const-generics/raw-ptr-const-param.rs @@ -1,5 +1,8 @@ -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +// revisions: full min + +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] struct Const; //~ ERROR: using raw pointers as const generic parameters diff --git a/src/test/ui/const-generics/raw-ptr-const-param.stderr b/src/test/ui/const-generics/raw-ptr-const-param.stderr deleted file mode 100644 index 6e64f8a327fd5..0000000000000 --- a/src/test/ui/const-generics/raw-ptr-const-param.stderr +++ /dev/null @@ -1,17 +0,0 @@ -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/raw-ptr-const-param.rs:1:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -error: using raw pointers as const generic parameters is forbidden - --> $DIR/raw-ptr-const-param.rs:4:23 - | -LL | struct Const; - | ^^^^^^^^^^ - -error: aborting due to previous error; 1 warning emitted - diff --git a/src/test/ui/const-generics/slice-const-param-mismatch.stderr b/src/test/ui/const-generics/slice-const-param-mismatch.full.stderr similarity index 66% rename from src/test/ui/const-generics/slice-const-param-mismatch.stderr rename to src/test/ui/const-generics/slice-const-param-mismatch.full.stderr index cc21f197e08b1..d06da2ef0630a 100644 --- a/src/test/ui/const-generics/slice-const-param-mismatch.stderr +++ b/src/test/ui/const-generics/slice-const-param-mismatch.full.stderr @@ -1,14 +1,5 @@ -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/slice-const-param-mismatch.rs:1:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - error[E0308]: mismatched types - --> $DIR/slice-const-param-mismatch.rs:9:35 + --> $DIR/slice-const-param-mismatch.rs:15:35 | LL | let _: ConstString<"Hello"> = ConstString::<"World">; | -------------------- ^^^^^^^^^^^^^^^^^^^^^^ expected `"Hello"`, found `"World"` @@ -19,7 +10,7 @@ LL | let _: ConstString<"Hello"> = ConstString::<"World">; found struct `ConstString<"World">` error[E0308]: mismatched types - --> $DIR/slice-const-param-mismatch.rs:11:33 + --> $DIR/slice-const-param-mismatch.rs:17:33 | LL | let _: ConstString<"ℇ㇈↦"> = ConstString::<"ℇ㇈↥">; | ------------------- ^^^^^^^^^^^^^^^^^^^^^ expected `"ℇ㇈↦"`, found `"ℇ㇈↥"` @@ -30,7 +21,7 @@ LL | let _: ConstString<"ℇ㇈↦"> = ConstString::<"ℇ㇈↥">; found struct `ConstString<"ℇ㇈↥">` error[E0308]: mismatched types - --> $DIR/slice-const-param-mismatch.rs:13:33 + --> $DIR/slice-const-param-mismatch.rs:19:33 | LL | let _: ConstBytes = ConstBytes::; | ------------------ ^^^^^^^^^^^^^^^^^^^^ expected `b"AAA"`, found `b"BBB"` @@ -40,6 +31,6 @@ LL | let _: ConstBytes = ConstBytes::; = note: expected struct `ConstBytes` found struct `ConstBytes` -error: aborting due to 3 previous errors; 1 warning emitted +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/const-generics/slice-const-param-mismatch.min.stderr b/src/test/ui/const-generics/slice-const-param-mismatch.min.stderr new file mode 100644 index 0000000000000..e86f885b9bbad --- /dev/null +++ b/src/test/ui/const-generics/slice-const-param-mismatch.min.stderr @@ -0,0 +1,20 @@ +error: using `&'static str` as const generic parameters is forbidden + --> $DIR/slice-const-param-mismatch.rs:8:29 + | +LL | struct ConstString; + | ^^^^^^^^^^^^ + | + = note: the only supported types are integers, `bool` and `char` + = note: more complex types are supported with `#[feature(const_generics)]` + +error: using `&'static [u8]` as const generic parameters is forbidden + --> $DIR/slice-const-param-mismatch.rs:10:28 + | +LL | struct ConstBytes; + | ^^^^^^^^^^^^^ + | + = note: the only supported types are integers, `bool` and `char` + = note: more complex types are supported with `#[feature(const_generics)]` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/const-generics/slice-const-param-mismatch.rs b/src/test/ui/const-generics/slice-const-param-mismatch.rs index 4f321b02b8277..0f8ae9bac4a3c 100644 --- a/src/test/ui/const-generics/slice-const-param-mismatch.rs +++ b/src/test/ui/const-generics/slice-const-param-mismatch.rs @@ -1,14 +1,20 @@ -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +// revisions: full min + +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] + struct ConstString; +//[min]~^ ERROR struct ConstBytes; +//[min]~^ ERROR pub fn main() { let _: ConstString<"Hello"> = ConstString::<"Hello">; - let _: ConstString<"Hello"> = ConstString::<"World">; //~ ERROR mismatched types + let _: ConstString<"Hello"> = ConstString::<"World">; //[full]~ ERROR mismatched types let _: ConstString<"ℇ㇈↦"> = ConstString::<"ℇ㇈↦">; - let _: ConstString<"ℇ㇈↦"> = ConstString::<"ℇ㇈↥">; //~ ERROR mismatched types + let _: ConstString<"ℇ㇈↦"> = ConstString::<"ℇ㇈↥">; //[full]~ ERROR mismatched types let _: ConstBytes = ConstBytes::<{&[0x41, 0x41, 0x41]}>; - let _: ConstBytes = ConstBytes::; //~ ERROR mismatched types + let _: ConstBytes = ConstBytes::; //[full]~ ERROR mismatched types } diff --git a/src/test/ui/const-generics/slice-const-param.min.stderr b/src/test/ui/const-generics/slice-const-param.min.stderr new file mode 100644 index 0000000000000..e2ffc67c3579c --- /dev/null +++ b/src/test/ui/const-generics/slice-const-param.min.stderr @@ -0,0 +1,20 @@ +error: using `&'static str` as const generic parameters is forbidden + --> $DIR/slice-const-param.rs:8:40 + | +LL | pub fn function_with_str() -> &'static str { + | ^^^^^^^^^^^^ + | + = note: the only supported types are integers, `bool` and `char` + = note: more complex types are supported with `#[feature(const_generics)]` + +error: using `&'static [u8]` as const generic parameters is forbidden + --> $DIR/slice-const-param.rs:13:41 + | +LL | pub fn function_with_bytes() -> &'static [u8] { + | ^^^^^^^^^^^^^ + | + = note: the only supported types are integers, `bool` and `char` + = note: more complex types are supported with `#[feature(const_generics)]` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/const-generics/slice-const-param.rs b/src/test/ui/const-generics/slice-const-param.rs index 9668f7ddabb38..1b6d2f6216c44 100644 --- a/src/test/ui/const-generics/slice-const-param.rs +++ b/src/test/ui/const-generics/slice-const-param.rs @@ -1,13 +1,17 @@ -// run-pass +//[full] run-pass +// revisions: min full -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] pub fn function_with_str() -> &'static str { + //[min]~^ ERROR using `&'static str` as const STRING } pub fn function_with_bytes() -> &'static [u8] { + //[min]~^ ERROR using `&'static [u8]` as const BYTES } diff --git a/src/test/ui/const-generics/slice-const-param.stderr b/src/test/ui/const-generics/slice-const-param.stderr deleted file mode 100644 index 524bd41a669b4..0000000000000 --- a/src/test/ui/const-generics/slice-const-param.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/slice-const-param.rs:3:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/const-generics/struct-with-invalid-const-param.full.stderr b/src/test/ui/const-generics/struct-with-invalid-const-param.full.stderr new file mode 100644 index 0000000000000..e73a297c878f8 --- /dev/null +++ b/src/test/ui/const-generics/struct-with-invalid-const-param.full.stderr @@ -0,0 +1,9 @@ +error[E0573]: expected type, found const parameter `C` + --> $DIR/struct-with-invalid-const-param.rs:8:23 + | +LL | struct S(C); + | ^ not a type + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0573`. diff --git a/src/test/ui/const-generics/struct-with-invalid-const-param.min.stderr b/src/test/ui/const-generics/struct-with-invalid-const-param.min.stderr new file mode 100644 index 0000000000000..e73a297c878f8 --- /dev/null +++ b/src/test/ui/const-generics/struct-with-invalid-const-param.min.stderr @@ -0,0 +1,9 @@ +error[E0573]: expected type, found const parameter `C` + --> $DIR/struct-with-invalid-const-param.rs:8:23 + | +LL | struct S(C); + | ^ not a type + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0573`. diff --git a/src/test/ui/const-generics/struct-with-invalid-const-param.rs b/src/test/ui/const-generics/struct-with-invalid-const-param.rs index 0b00481d903e0..f0122ace3aec3 100644 --- a/src/test/ui/const-generics/struct-with-invalid-const-param.rs +++ b/src/test/ui/const-generics/struct-with-invalid-const-param.rs @@ -1,5 +1,9 @@ -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +// Checks that a const param cannot be stored in a struct. +// revisions: full min + +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] struct S(C); //~ ERROR expected type, found const parameter diff --git a/src/test/ui/const-generics/trait-const-args.rs b/src/test/ui/const-generics/trait-const-args.rs index b60d7e8965142..b66d79845f971 100644 --- a/src/test/ui/const-generics/trait-const-args.rs +++ b/src/test/ui/const-generics/trait-const-args.rs @@ -1,6 +1,9 @@ // check-pass -#![allow(incomplete_features)] -#![feature(const_generics)] +// revisions: full min + +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] struct Const; trait Foo {} diff --git a/src/test/ui/const-generics/transparent-maybeunit-array-wrapper.rs b/src/test/ui/const-generics/transparent-maybeunit-array-wrapper.rs index 1aed9cfe92730..e041e9709d0ec 100644 --- a/src/test/ui/const-generics/transparent-maybeunit-array-wrapper.rs +++ b/src/test/ui/const-generics/transparent-maybeunit-array-wrapper.rs @@ -1,7 +1,9 @@ // run-pass +// revisions: full min -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] use std::mem::MaybeUninit; diff --git a/src/test/ui/const-generics/transparent-maybeunit-array-wrapper.stderr b/src/test/ui/const-generics/transparent-maybeunit-array-wrapper.stderr deleted file mode 100644 index 6077fe5b1ed39..0000000000000 --- a/src/test/ui/const-generics/transparent-maybeunit-array-wrapper.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/transparent-maybeunit-array-wrapper.rs:3:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/const-generics/type_of_anon_const.rs b/src/test/ui/const-generics/type_of_anon_const.rs index 588c7b9523aad..f424fd03341fe 100644 --- a/src/test/ui/const-generics/type_of_anon_const.rs +++ b/src/test/ui/const-generics/type_of_anon_const.rs @@ -1,7 +1,9 @@ // run-pass +// revisions: full min -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] trait T { fn l() -> usize; diff --git a/src/test/ui/const-generics/type_of_anon_const.stderr b/src/test/ui/const-generics/type_of_anon_const.stderr deleted file mode 100644 index 8afed0d39866a..0000000000000 --- a/src/test/ui/const-generics/type_of_anon_const.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/type_of_anon_const.rs:3:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/const-generics/uninferred-consts.full.stderr b/src/test/ui/const-generics/uninferred-consts.full.stderr new file mode 100644 index 0000000000000..2c5af9e65f827 --- /dev/null +++ b/src/test/ui/const-generics/uninferred-consts.full.stderr @@ -0,0 +1,11 @@ +error[E0282]: type annotations needed + --> $DIR/uninferred-consts.rs:14:5 + | +LL | Foo.foo(); + | ^^^^^^^^^ + | + = note: unable to infer the value of a const parameter + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/const-generics/uninferred-consts.min.stderr b/src/test/ui/const-generics/uninferred-consts.min.stderr new file mode 100644 index 0000000000000..2c5af9e65f827 --- /dev/null +++ b/src/test/ui/const-generics/uninferred-consts.min.stderr @@ -0,0 +1,11 @@ +error[E0282]: type annotations needed + --> $DIR/uninferred-consts.rs:14:5 + | +LL | Foo.foo(); + | ^^^^^^^^^ + | + = note: unable to infer the value of a const parameter + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/const-generics/uninferred-consts.rs b/src/test/ui/const-generics/uninferred-consts.rs index 3b2bb49197d01..ec5b3ffe5440b 100644 --- a/src/test/ui/const-generics/uninferred-consts.rs +++ b/src/test/ui/const-generics/uninferred-consts.rs @@ -1,5 +1,9 @@ -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +// Test that we emit an error if we cannot properly infer a constant. +// revisions: full min + +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] // taken from https://github.com/rust-lang/rust/issues/70507#issuecomment-615268893 struct Foo; diff --git a/src/test/ui/const-generics/uninferred-consts.stderr b/src/test/ui/const-generics/uninferred-consts.stderr deleted file mode 100644 index a3620084a4289..0000000000000 --- a/src/test/ui/const-generics/uninferred-consts.stderr +++ /dev/null @@ -1,20 +0,0 @@ -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/uninferred-consts.rs:1:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -error[E0282]: type annotations needed - --> $DIR/uninferred-consts.rs:10:5 - | -LL | Foo.foo(); - | ^^^^^^^^^ - | - = note: unable to infer the value of a const parameter - -error: aborting due to previous error; 1 warning emitted - -For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/const-generics/unknown_adt.stderr b/src/test/ui/const-generics/unknown_adt.full.stderr similarity index 89% rename from src/test/ui/const-generics/unknown_adt.stderr rename to src/test/ui/const-generics/unknown_adt.full.stderr index b2e287b762c69..94f3165eaec31 100644 --- a/src/test/ui/const-generics/unknown_adt.stderr +++ b/src/test/ui/const-generics/unknown_adt.full.stderr @@ -1,5 +1,5 @@ error[E0412]: cannot find type `UnknownStruct` in this scope - --> $DIR/unknown_adt.rs:5:12 + --> $DIR/unknown_adt.rs:8:12 | LL | let _: UnknownStruct<7>; | ^^^^^^^^^^^^^ not found in this scope diff --git a/src/test/ui/const-generics/unknown_adt.min.stderr b/src/test/ui/const-generics/unknown_adt.min.stderr new file mode 100644 index 0000000000000..94f3165eaec31 --- /dev/null +++ b/src/test/ui/const-generics/unknown_adt.min.stderr @@ -0,0 +1,9 @@ +error[E0412]: cannot find type `UnknownStruct` in this scope + --> $DIR/unknown_adt.rs:8:12 + | +LL | let _: UnknownStruct<7>; + | ^^^^^^^^^^^^^ not found in this scope + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/const-generics/unknown_adt.rs b/src/test/ui/const-generics/unknown_adt.rs index 0ba9945b399ae..c6131402aeb6c 100644 --- a/src/test/ui/const-generics/unknown_adt.rs +++ b/src/test/ui/const-generics/unknown_adt.rs @@ -1,5 +1,8 @@ -#![feature(const_generics)] -#![allow(incomplete_features)] +// revisions: full min + +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] fn main() { let _: UnknownStruct<7>; diff --git a/src/test/ui/const-generics/unused-const-param.rs b/src/test/ui/const-generics/unused-const-param.rs index d9292efc21b74..3c305167b4b64 100644 --- a/src/test/ui/const-generics/unused-const-param.rs +++ b/src/test/ui/const-generics/unused-const-param.rs @@ -1,7 +1,9 @@ // check-pass +// revisions: full min -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] struct A; // ok diff --git a/src/test/ui/const-generics/unused-const-param.stderr b/src/test/ui/const-generics/unused-const-param.stderr deleted file mode 100644 index be015a689ae14..0000000000000 --- a/src/test/ui/const-generics/unused-const-param.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/unused-const-param.rs:3:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -warning: 1 warning emitted - diff --git a/src/test/ui/const-generics/unused_braces.full.fixed b/src/test/ui/const-generics/unused_braces.full.fixed new file mode 100644 index 0000000000000..1b075ade16a06 --- /dev/null +++ b/src/test/ui/const-generics/unused_braces.full.fixed @@ -0,0 +1,17 @@ +// check-pass +// run-rustfix +// revisions: full min + +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] +#![warn(unused_braces)] + + +struct A; + +fn main() { + let _: A<7>; // ok + let _: A<7>; //~ WARN unnecessary braces + let _: A<{ 3 + 5 }>; // ok +} diff --git a/src/test/ui/const-generics/unused_braces.stderr b/src/test/ui/const-generics/unused_braces.full.stderr similarity index 80% rename from src/test/ui/const-generics/unused_braces.stderr rename to src/test/ui/const-generics/unused_braces.full.stderr index 618698a323445..1752779a60a3a 100644 --- a/src/test/ui/const-generics/unused_braces.stderr +++ b/src/test/ui/const-generics/unused_braces.full.stderr @@ -1,11 +1,11 @@ warning: unnecessary braces around const expression - --> $DIR/unused_braces.rs:13:14 + --> $DIR/unused_braces.rs:15:14 | LL | let _: A<{ 7 }>; | ^^^^^ help: remove these braces | note: the lint level is defined here - --> $DIR/unused_braces.rs:5:9 + --> $DIR/unused_braces.rs:8:9 | LL | #![warn(unused_braces)] | ^^^^^^^^^^^^^ diff --git a/src/test/ui/const-generics/unused_braces.min.fixed b/src/test/ui/const-generics/unused_braces.min.fixed new file mode 100644 index 0000000000000..1b075ade16a06 --- /dev/null +++ b/src/test/ui/const-generics/unused_braces.min.fixed @@ -0,0 +1,17 @@ +// check-pass +// run-rustfix +// revisions: full min + +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] +#![warn(unused_braces)] + + +struct A; + +fn main() { + let _: A<7>; // ok + let _: A<7>; //~ WARN unnecessary braces + let _: A<{ 3 + 5 }>; // ok +} diff --git a/src/test/ui/const-generics/unused_braces.min.stderr b/src/test/ui/const-generics/unused_braces.min.stderr new file mode 100644 index 0000000000000..1752779a60a3a --- /dev/null +++ b/src/test/ui/const-generics/unused_braces.min.stderr @@ -0,0 +1,14 @@ +warning: unnecessary braces around const expression + --> $DIR/unused_braces.rs:15:14 + | +LL | let _: A<{ 7 }>; + | ^^^^^ help: remove these braces + | +note: the lint level is defined here + --> $DIR/unused_braces.rs:8:9 + | +LL | #![warn(unused_braces)] + | ^^^^^^^^^^^^^ + +warning: 1 warning emitted + diff --git a/src/test/ui/const-generics/unused_braces.rs b/src/test/ui/const-generics/unused_braces.rs index c3e02b45ed5a2..31c4caf7ab850 100644 --- a/src/test/ui/const-generics/unused_braces.rs +++ b/src/test/ui/const-generics/unused_braces.rs @@ -1,10 +1,12 @@ // check-pass // run-rustfix +// revisions: full min -#![allow(incomplete_features)] +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] #![warn(unused_braces)] -#![feature(const_generics)] struct A; diff --git a/src/test/ui/const-generics/wf-misc.full.stderr b/src/test/ui/const-generics/wf-misc.full.stderr new file mode 100644 index 0000000000000..4af48fa159090 --- /dev/null +++ b/src/test/ui/const-generics/wf-misc.full.stderr @@ -0,0 +1,18 @@ +error: constant expression depends on a generic parameter + --> $DIR/wf-misc.rs:9:12 + | +LL | let _: [u8; N + 1]; + | ^^^^^^^^^^^ + | + = note: this may fail depending on what value the parameter takes + +error: constant expression depends on a generic parameter + --> $DIR/wf-misc.rs:17:12 + | +LL | let _: Const::<{N + 1}>; + | ^^^^^^^^^^^^^^^^ + | + = note: this may fail depending on what value the parameter takes + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/const-generics/wf-misc.min.stderr b/src/test/ui/const-generics/wf-misc.min.stderr new file mode 100644 index 0000000000000..f2acb8fc06e93 --- /dev/null +++ b/src/test/ui/const-generics/wf-misc.min.stderr @@ -0,0 +1,18 @@ +error: generic parameters must not be used inside of non trivial constant values + --> $DIR/wf-misc.rs:9:17 + | +LL | let _: [u8; N + 1]; + | ^ non-trivial anonymous constants must not depend on the parameter `N` + | + = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + +error: generic parameters must not be used inside of non trivial constant values + --> $DIR/wf-misc.rs:17:21 + | +LL | let _: Const::<{N + 1}>; + | ^ non-trivial anonymous constants must not depend on the parameter `N` + | + = help: it is currently only allowed to use either `N` or `{ N }` as generic constants + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/const-generics/wf-misc.rs b/src/test/ui/const-generics/wf-misc.rs index 4ff1b9e2da5b2..e6f7a9963e8f1 100644 --- a/src/test/ui/const-generics/wf-misc.rs +++ b/src/test/ui/const-generics/wf-misc.rs @@ -1,16 +1,22 @@ -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete +// Tests miscellaneous well-formedness examples. +// revisions: full min + +#![cfg_attr(full, feature(const_generics))] +#![cfg_attr(full, allow(incomplete_features))] +#![cfg_attr(min, feature(min_const_generics))] pub fn arr_len() { let _: [u8; N + 1]; - //~^ ERROR constant expression depends on a generic parameter + //[full]~^ ERROR constant expression depends on a generic parameter + //[min]~^^ ERROR generic parameters must not be used inside of non trivial } struct Const; pub fn func_call() { let _: Const::<{N + 1}>; - //~^ ERROR constant expression depends on a generic parameter + //[full]~^ ERROR constant expression depends on a generic parameter + //[min]~^^ ERROR generic parameters must not be used inside of non trivial } fn main() {} diff --git a/src/test/ui/const-generics/wf-misc.stderr b/src/test/ui/const-generics/wf-misc.stderr deleted file mode 100644 index 03f2bf3f52699..0000000000000 --- a/src/test/ui/const-generics/wf-misc.stderr +++ /dev/null @@ -1,27 +0,0 @@ -warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/wf-misc.rs:1:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #44580 for more information - -error: constant expression depends on a generic parameter - --> $DIR/wf-misc.rs:5:12 - | -LL | let _: [u8; N + 1]; - | ^^^^^^^^^^^ - | - = note: this may fail depending on what value the parameter takes - -error: constant expression depends on a generic parameter - --> $DIR/wf-misc.rs:12:12 - | -LL | let _: Const::<{N + 1}>; - | ^^^^^^^^^^^^^^^^ - | - = note: this may fail depending on what value the parameter takes - -error: aborting due to 2 previous errors; 1 warning emitted -