mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +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.
26 lines
471 B
Rust
26 lines
471 B
Rust
#![feature(associated_const_equality)]
|
|
#![allow(unused)]
|
|
|
|
pub trait Foo {
|
|
const N: usize;
|
|
}
|
|
|
|
pub struct Bar;
|
|
|
|
impl Foo for Bar {
|
|
const N: usize = 3;
|
|
}
|
|
|
|
fn foo1<F: Foo<Z = 3>>() {}
|
|
//~^ ERROR associated constant `Z` not found for `Foo`
|
|
fn foo2<F: Foo<Z = usize>>() {}
|
|
//~^ ERROR associated type `Z` not found for `Foo`
|
|
fn foo3<F: Foo<Z = 5>>() {}
|
|
//~^ ERROR associated constant `Z` not found for `Foo`
|
|
|
|
fn main() {
|
|
foo1::<Bar>();
|
|
foo2::<Bar>();
|
|
foo3::<Bar>();
|
|
}
|