2022-01-26 17:02:58 +00:00
|
|
|
#![feature(associated_const_equality)]
|
|
|
|
#![allow(unused)]
|
|
|
|
|
|
|
|
pub trait Foo {
|
2023-11-24 08:53:10 +00:00
|
|
|
const N: usize;
|
2022-01-26 17:02:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pub trait FooTy {
|
2023-11-24 08:53:10 +00:00
|
|
|
type T;
|
2022-01-26 17:02:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pub struct Bar;
|
|
|
|
|
|
|
|
impl Foo for Bar {
|
2023-11-24 08:53:10 +00:00
|
|
|
const N: usize = 3;
|
2022-01-26 17:02:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl FooTy for Bar {
|
2023-11-24 08:53:10 +00:00
|
|
|
type T = usize;
|
2022-01-26 17:02:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-11-24 08:53:10 +00:00
|
|
|
fn foo<F: Foo<N = usize>>() {}
|
|
|
|
//~^ ERROR expected constant, found type
|
|
|
|
fn foo2<F: FooTy<T = 3usize>>() {}
|
|
|
|
//~^ ERROR expected type, found constant
|
2022-01-26 17:02:58 +00:00
|
|
|
|
|
|
|
fn main() {
|
2023-11-24 08:53:10 +00:00
|
|
|
foo::<Bar>();
|
|
|
|
foo2::<Bar>();
|
2022-01-26 17:02:58 +00:00
|
|
|
}
|