mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-03 04:04:06 +00:00
55559d93e7
If a const is expected, resolve a const. If a type is expected, resolve a type. Don't try to resolve a type first falling back to consts.
32 lines
438 B
Rust
32 lines
438 B
Rust
#![feature(associated_const_equality)]
|
|
#![allow(unused)]
|
|
|
|
pub trait Foo {
|
|
const N: usize;
|
|
}
|
|
|
|
pub trait FooTy {
|
|
type T;
|
|
}
|
|
|
|
pub struct Bar;
|
|
|
|
impl Foo for Bar {
|
|
const N: usize = 3;
|
|
}
|
|
|
|
impl FooTy for Bar {
|
|
type T = usize;
|
|
}
|
|
|
|
|
|
fn foo<F: Foo<N = usize>>() {}
|
|
//~^ ERROR expected constant, found type
|
|
fn foo2<F: FooTy<T = 3usize>>() {}
|
|
//~^ ERROR expected type, found constant
|
|
|
|
fn main() {
|
|
foo::<Bar>();
|
|
foo2::<Bar>();
|
|
}
|