1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
// run-rustfix //issue #106496 struct S; trait X {} impl X for S {} fn foo<T: X>(_: &T) {} fn test_foo() { let hello = &S; foo(hello); //~^ ERROR mismatched types } fn bar(_: &String) {} fn test_bar() { let v = String::from("hello"); let s = &v; bar(s); //~^ ERROR mismatched types } fn main() { test_foo(); test_bar(); }