Fix missing diagnostic span for impl Trait with const generics
This commit is contained in:
parent
8fe73e80d7
commit
0801263279
3 changed files with 31 additions and 1 deletions
|
|
@ -0,0 +1,22 @@
|
|||
#![feature(min_const_generics)]
|
||||
|
||||
trait Usizer {
|
||||
fn m(self) -> usize;
|
||||
}
|
||||
|
||||
fn f<const N: usize>(u: impl Usizer) -> usize {
|
||||
N + u.m()
|
||||
}
|
||||
|
||||
struct Usizable;
|
||||
|
||||
impl Usizer for Usizable {
|
||||
fn m(self) -> usize {
|
||||
16
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
assert_eq!(f::<4usize>(Usizable), 20usize);
|
||||
//~^ ERROR cannot provide explicit generic arguments when `impl Trait` is used in argument position
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
error[E0632]: cannot provide explicit generic arguments when `impl Trait` is used in argument position
|
||||
--> $DIR/impl-trait-with-const-arguments.rs:20:20
|
||||
|
|
||||
LL | assert_eq!(f::<4usize>(Usizable), 20usize);
|
||||
| ^^^^^^ explicit generic argument not allowed
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue