summaryrefslogtreecommitdiffstats
path: root/tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.rs')
-rw-r--r--tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.rs b/tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.rs
new file mode 100644
index 000000000..89b077d67
--- /dev/null
+++ b/tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.rs
@@ -0,0 +1,15 @@
+// run-rustfix
+fn wat<T>(t: &T) -> T {
+ t.clone() //~ ERROR E0308
+}
+
+struct Foo;
+
+fn wut(t: &Foo) -> Foo {
+ t.clone() //~ ERROR E0308
+}
+
+fn main() {
+ wat(&42);
+ wut(&Foo);
+}