rust/tests/ui/suggestions/assoc-const-as-fn.rs

19 lines
458 B
Rust
Raw Normal View History

2022-12-03 09:32:29 +00:00
unsafe fn pointer(v: usize, w: u32) {}
pub trait UniformScalar {}
impl UniformScalar for u32 {}
pub trait GlUniformScalar: UniformScalar {
const FACTORY: unsafe fn(usize, Self) -> ();
}
impl GlUniformScalar for u32 {
const FACTORY: unsafe fn(usize, Self) -> () = pointer;
}
pub fn foo<T: UniformScalar>(value: T) {
<T as GlUniformScalar>::FACTORY(1, value);
//~^ ERROR the trait bound `T: GlUniformScalar` is not satisfied
}
fn main() {}