#![recursion_limit = "256"] pub trait Visit { fn visit(&mut self, elem: &T); } pub enum Ast { Null, App(Box, Box), } impl Visit for T where T: Visit>, { fn visit(&mut self, elem: &Ast) {} } impl Visit> for T where T: Visit, { fn visit(&mut self, elem: &Box) {} } pub struct MyVisitor {} fn test() { MyVisitor {}.visit(&Ast::Null) } fn test_static() { fn require_bound>() {} require_bound::(); } fn main() {}