1 error[E0308]: mismatched types
2 --> $DIR/clone-on-unconstrained-borrowed-type-param.rs:3:5
4 LL | fn wat<T>(t: &T) -> T {
5 | - - expected `T` because of return type
9 | ^^^^^^^^^ expected type parameter `T`, found `&T`
11 = note: expected type parameter `T`
13 note: `T` does not implement `Clone`, so `&T` was cloned instead
14 --> $DIR/clone-on-unconstrained-borrowed-type-param.rs:3:5
18 help: consider restricting type parameter `T`
20 LL | fn wat<T: Clone>(t: &T) -> T {
23 error[E0308]: mismatched types
24 --> $DIR/clone-on-unconstrained-borrowed-type-param.rs:9:5
26 LL | fn wut(t: &Foo) -> Foo {
27 | --- expected `Foo` because of return type
29 | ^^^^^^^^^ expected struct `Foo`, found `&Foo`
31 note: `Foo` does not implement `Clone`, so `&Foo` was cloned instead
32 --> $DIR/clone-on-unconstrained-borrowed-type-param.rs:9:5
36 help: consider annotating `Foo` with `#[derive(Clone)]`
41 error: aborting due to 2 previous errors
43 For more information about this error, try `rustc --explain E0308`.