mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-28 01:34:21 +00:00
Fix missing diagnostic span for impl Trait
with const generics
This commit is contained in:
parent
8fe73e80d7
commit
0801263279
@ -562,7 +562,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
.args
|
||||
.iter()
|
||||
.filter_map(|arg| match arg {
|
||||
GenericArg::Type(_) => Some(arg.span()),
|
||||
GenericArg::Type(_) | GenericArg::Const(_) => Some(arg.span()),
|
||||
_ => None,
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
@ -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…
Reference in New Issue
Block a user