Skip to content

Commit 6004916

Browse files
committed
Re-register unsized_const_params as language feature to bring back the warning
1 parent 573b95a commit 6004916

File tree

15 files changed

+85
-14
lines changed

15 files changed

+85
-14
lines changed

compiler/rustc_feature/src/unstable.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,9 @@ declare_features! (
661661
(incomplete, unsafe_binders, "1.85.0", Some(130516)),
662662
/// Allows declaring fields `unsafe`.
663663
(incomplete, unsafe_fields, "1.85.0", Some(132922)),
664+
/// Allows const generic parameters to be defined with types that
665+
/// are not `Sized`, e.g. `fn foo<const N: [u8]>() {`.
666+
(incomplete, unsized_const_params, "1.82.0", Some(95174)),
664667
/// Allows unsized fn parameters.
665668
(internal, unsized_fn_params, "1.49.0", Some(48055)),
666669
/// Allows using the `#[used(linker)]` (or `#[used(compiler)]`) attribute.

tests/ui/coherence/negative-coherence/regions-in-canonical.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//@ check-pass
22

33
#![feature(adt_const_params, unsized_const_params)]
4+
//~^ WARN the feature `unsized_const_params` is incomplete
45
#![feature(with_negative_coherence, negative_impls)]
56

67
pub trait A<const K: &'static str> {}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
warning: the feature `unsized_const_params` is incomplete and may not be safe to use and/or cause compiler crashes
2+
--> $DIR/regions-in-canonical.rs:3:30
3+
|
4+
LL | #![feature(adt_const_params, unsized_const_params)]
5+
| ^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: see issue #95174 <https://github.com/rust-lang/rust/issues/95174> for more information
8+
= note: `#[warn(incomplete_features)]` on by default
9+
10+
warning: 1 warning emitted
11+

tests/ui/const-generics/defaults/concrete-const-param-type.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#![feature(generic_const_parameter_types, unsized_const_params, adt_const_params)]
22
//~^ WARN the feature `generic_const_parameter_types` is incomplete
3+
//~^^ WARN the feature `unsized_const_params` is incomplete
34
// Make sure that we test the const param type of default const parameters
45
// if both the type of the default and the type of the parameter are concrete.
56

tests/ui/const-generics/defaults/concrete-const-param-type.stderr

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,19 @@ LL | #![feature(generic_const_parameter_types, unsized_const_params, adt_const_p
77
= note: see issue #137626 <https://github.com/rust-lang/rust/issues/137626> for more information
88
= note: `#[warn(incomplete_features)]` on by default
99

10+
warning: the feature `unsized_const_params` is incomplete and may not be safe to use and/or cause compiler crashes
11+
--> $DIR/concrete-const-param-type.rs:1:43
12+
|
13+
LL | #![feature(generic_const_parameter_types, unsized_const_params, adt_const_params)]
14+
| ^^^^^^^^^^^^^^^^^^^^
15+
|
16+
= note: see issue #95174 <https://github.com/rust-lang/rust/issues/95174> for more information
17+
1018
error: the constant `N` is not of type `u64`
11-
--> $DIR/concrete-const-param-type.rs:8:26
19+
--> $DIR/concrete-const-param-type.rs:9:26
1220
|
1321
LL | struct Foo<const N: u32, const M: u64 = N>;
1422
| ^^^^^^^^^^^^^^^^ expected `u64`, found `u32`
1523

16-
error: aborting due to 1 previous error; 1 warning emitted
24+
error: aborting due to 1 previous error; 2 warnings emitted
1725

tests/ui/const-generics/generic_const_exprs/issue-97047-ice-1.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#![feature(adt_const_params, unsized_const_params, generic_const_exprs)]
44
//~^ WARN the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
5+
//~^^ WARN the feature `unsized_const_params` is incomplete
56

67
pub struct Changes<const CHANGES: &'static [&'static str]>
78
where
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
1+
warning: the feature `unsized_const_params` is incomplete and may not be safe to use and/or cause compiler crashes
2+
--> $DIR/issue-97047-ice-1.rs:3:30
3+
|
4+
LL | #![feature(adt_const_params, unsized_const_params, generic_const_exprs)]
5+
| ^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: see issue #95174 <https://github.com/rust-lang/rust/issues/95174> for more information
8+
= note: `#[warn(incomplete_features)]` on by default
9+
110
warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
211
--> $DIR/issue-97047-ice-1.rs:3:52
312
|
413
LL | #![feature(adt_const_params, unsized_const_params, generic_const_exprs)]
514
| ^^^^^^^^^^^^^^^^^^^
615
|
716
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
8-
= note: `#[warn(incomplete_features)]` on by default
917

10-
warning: 1 warning emitted
18+
warning: 2 warnings emitted
1119

tests/ui/const-generics/generic_const_exprs/issue-97047-ice-2.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#![feature(adt_const_params, unsized_const_params, generic_const_exprs)]
44
//~^ WARN the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
5+
//~^^ WARN the feature `unsized_const_params` is incomplete
56

67
pub struct Changes<const CHANGES: &'static [&'static str]>
78
where
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
1+
warning: the feature `unsized_const_params` is incomplete and may not be safe to use and/or cause compiler crashes
2+
--> $DIR/issue-97047-ice-2.rs:3:30
3+
|
4+
LL | #![feature(adt_const_params, unsized_const_params, generic_const_exprs)]
5+
| ^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: see issue #95174 <https://github.com/rust-lang/rust/issues/95174> for more information
8+
= note: `#[warn(incomplete_features)]` on by default
9+
110
warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
211
--> $DIR/issue-97047-ice-2.rs:3:52
312
|
413
LL | #![feature(adt_const_params, unsized_const_params, generic_const_exprs)]
514
| ^^^^^^^^^^^^^^^^^^^
615
|
716
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
8-
= note: `#[warn(incomplete_features)]` on by default
917

10-
warning: 1 warning emitted
18+
warning: 2 warnings emitted
1119

tests/ui/const-generics/generic_const_parameter_types/check-type-in-mir.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#![feature(unsized_const_params, adt_const_params, generic_const_parameter_types)]
44
//~^ WARN the feature `generic_const_parameter_types` is incomplete
5+
//~^^ WARN the feature `unsized_const_params` is incomplete
56

67
fn foo<'a, const N: &'a u32>() {
78
let b: &'static u32 = N;

0 commit comments

Comments
 (0)