summaryrefslogtreecommitdiffstats
path: root/tests/ui/suggestions/suggest-remove-deref.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/suggestions/suggest-remove-deref.rs')
-rw-r--r--tests/ui/suggestions/suggest-remove-deref.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/ui/suggestions/suggest-remove-deref.rs b/tests/ui/suggestions/suggest-remove-deref.rs
new file mode 100644
index 000000000..c2d385cbd
--- /dev/null
+++ b/tests/ui/suggestions/suggest-remove-deref.rs
@@ -0,0 +1,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();
+}