Closed
Description
I think this code shows a bad error message:
trait Foo { const FOO: Self; }
impl Foo for u32 { const FOO: Self = 1; }
fn bar<T: Foo>(n: T) {
const BASE: T = T::FOO;
}
fn main() {}
rustc 1.22.0-nightly (4279e2b 2017-10-21) gives:
error[E0401]: can't use type parameters from outer function; try using a local type parameter instead
--> ...\test.rs:4:17
|
4 | const BASE: T = T::FOO;
| ^ use of type variable from outer function
error[E0401]: can't use type parameters from outer function; try using a local type parameter instead
--> ...\test.rs:4:21
|
4 | const BASE: T = T::FOO;
| ^^^^^^ use of type variable from outer function
error: aborting due to 2 previous errors