summaryrefslogtreecommitdiffstats
path: root/tests/ui/suggestions/issue-106443-sugg-clone-for-arg.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/suggestions/issue-106443-sugg-clone-for-arg.rs')
-rw-r--r--tests/ui/suggestions/issue-106443-sugg-clone-for-arg.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/ui/suggestions/issue-106443-sugg-clone-for-arg.rs b/tests/ui/suggestions/issue-106443-sugg-clone-for-arg.rs
new file mode 100644
index 000000000..48efdb82c
--- /dev/null
+++ b/tests/ui/suggestions/issue-106443-sugg-clone-for-arg.rs
@@ -0,0 +1,23 @@
+#[derive(Clone)]
+struct S;
+
+// without Clone
+struct T;
+
+fn foo(_: S) {}
+
+fn test1() {
+ let s = &S;
+ foo(s); //~ ERROR mismatched types
+}
+
+fn bar(_: T) {}
+fn test2() {
+ let t = &T;
+ bar(t); //~ ERROR mismatched types
+}
+
+fn main() {
+ test1();
+ test2();
+}