File tree 3 files changed +21
-7
lines changed
tests/ui/type-alias-impl-trait
3 files changed +21
-7
lines changed Original file line number Diff line number Diff line change
1
+ error: `Bar` is forbidden as the type of a const generic parameter
2
+ --> $DIR/const_generic_type.rs:7:24
3
+ |
4
+ LL | async fn test<const N: crate::Bar>() {
5
+ | ^^^^^^^^^^
6
+ |
7
+ = note: the only supported types are integers, `bool` and `char`
8
+
9
+ error: aborting due to 1 previous error
10
+
Original file line number Diff line number Diff line change 1
1
error[E0283]: type annotations needed
2
- --> $DIR/const_generic_type.rs:6 :1
2
+ --> $DIR/const_generic_type.rs:7 :1
3
3
|
4
- LL | async fn test<const N: crate::Bar>() {}
4
+ LL | async fn test<const N: crate::Bar>() {
5
5
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type
6
6
|
7
7
= note: cannot satisfy `_: std::fmt::Display`
8
8
9
9
error: `Bar` is forbidden as the type of a const generic parameter
10
- --> $DIR/const_generic_type.rs:6 :24
10
+ --> $DIR/const_generic_type.rs:7 :24
11
11
|
12
- LL | async fn test<const N: crate::Bar>() {}
12
+ LL | async fn test<const N: crate::Bar>() {
13
13
| ^^^^^^^^^^
14
14
|
15
15
= note: the only supported types are integers, `bool` and `char`
Original file line number Diff line number Diff line change 1
1
//@edition: 2021
2
+ //@revisions: infer no_infer
2
3
3
4
#![ feature( type_alias_impl_trait) ]
4
5
type Bar = impl std:: fmt:: Display ;
5
6
6
- async fn test < const N : crate :: Bar > ( ) { }
7
- //~^ ERROR: type annotations needed
8
- //~| ERROR: `Bar` is forbidden as the type of a const generic parameter
7
+ async fn test < const N : crate :: Bar > ( ) {
8
+ //[no_infer]~^ ERROR: type annotations needed
9
+ //~^^ ERROR: `Bar` is forbidden as the type of a const generic parameter
10
+ #[ cfg( infer) ]
11
+ let x: u32 = N ;
12
+ }
9
13
10
14
fn main ( ) { }
You can’t perform that action at this time.
0 commit comments