about summary refs log tree commit diff
path: root/tests/ui/suggestions/suggest-imm-mut-trait-implementations.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/suggestions/suggest-imm-mut-trait-implementations.rs')
-rw-r--r--tests/ui/suggestions/suggest-imm-mut-trait-implementations.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/ui/suggestions/suggest-imm-mut-trait-implementations.rs b/tests/ui/suggestions/suggest-imm-mut-trait-implementations.rs
new file mode 100644
index 00000000000..a62669d5b2d
--- /dev/null
+++ b/tests/ui/suggestions/suggest-imm-mut-trait-implementations.rs
@@ -0,0 +1,23 @@
+trait Trait {}
+
+struct A;
+struct B;
+struct C;
+
+impl Trait for &A {}
+impl Trait for &mut A {}
+
+impl Trait for &B {}
+
+impl Trait for &mut C {}
+
+fn foo<X: Trait>(_: X) {}
+
+fn main() {
+    let a = A;
+    let b = B;
+    let c = C;
+    foo(a); //~ ERROR the trait bound `A: Trait` is not satisfied
+    foo(b); //~ ERROR the trait bound `B: Trait` is not satisfied
+    foo(c); //~ ERROR the trait bound `C: Trait` is not satisfied
+}