Implementation not general enough

⚓ rust    📅 2025-06-09    👤 surdeus    👁️ 1      

surdeus

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?

link to the playground

4 posts - 2 participants

Read full topic

🏷️ rust_feed