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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
458 B
Rust
Raw Normal View History

2022-12-03 03:32:29 -06: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() {}