//@ build-fail // The regex below normalizes the long type file name to make it suitable for compare-modes. //@ normalize-stderr: "'\$TEST_BUILD_DIR/.*\.long-type.txt'" -> "'$$TEST_BUILD_DIR/$$FILE.long-type.txt'" trait ToOpt: Sized { fn to_option(&self) -> Option; } impl ToOpt for usize { fn to_option(&self) -> Option { Some(*self) } } impl ToOpt for Option { fn to_option(&self) -> Option> { Some((*self).clone()) } } fn function(counter: usize, t: T) { if counter > 0 { function(counter - 1, t.to_option()); //~^ ERROR reached the recursion limit while instantiating `function::