summaryrefslogtreecommitdiffstats
path: root/src/test/ui/issues/issue-32122-1.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/issues/issue-32122-1.rs')
-rw-r--r--src/test/ui/issues/issue-32122-1.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/ui/issues/issue-32122-1.rs b/src/test/ui/issues/issue-32122-1.rs
new file mode 100644
index 000000000..3c4859f07
--- /dev/null
+++ b/src/test/ui/issues/issue-32122-1.rs
@@ -0,0 +1,17 @@
+// run-rustfix
+use std::ops::Deref;
+
+struct Foo(u8);
+
+impl Deref for Foo {
+ type Target = u8;
+ fn deref(&self) -> &Self::Target {
+ &self.0
+ }
+}
+
+fn main() {
+ let a = Foo(0);
+ // Should suggest `&*` when coercing &ty to *const ty
+ let _: *const u8 = &a; //~ ERROR mismatched types
+}