Info
This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: Implementation not general enough
Howdy folks. I have this code here:
trait Input {}
impl Input for &usize {}
trait System {}
impl<A: Input,> System for fn(A) {}
fn test_system(_: &usize) {}
fn is_system<T>(_: T) where T: System {
println!("{} is a system", type_name::<T>());
}
fn main() {
is_system(test_system as fn(&usize)); // implementation of `System` is not general enough
}
But I'm having trouble understanding the error it generates. Would anyone be able to explain it to me, please?
4 posts - 2 participants
🏷️ rust_feed