summaryrefslogtreecommitdiffstats
path: root/tests/ui/issues/issue-71676-1.fixed
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:03 +0000
commit64d98f8ee037282c35007b64c2649055c56af1db (patch)
tree5492bcf97fce41ee1c0b1cc2add283f3e66cdab0 /tests/ui/issues/issue-71676-1.fixed
parentAdding debian version 1.67.1+dfsg1-1. (diff)
downloadrustc-64d98f8ee037282c35007b64c2649055c56af1db.tar.xz
rustc-64d98f8ee037282c35007b64c2649055c56af1db.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/issues/issue-71676-1.fixed')
-rw-r--r--tests/ui/issues/issue-71676-1.fixed53
1 files changed, 53 insertions, 0 deletions
diff --git a/tests/ui/issues/issue-71676-1.fixed b/tests/ui/issues/issue-71676-1.fixed
new file mode 100644
index 000000000..cbc0e8c06
--- /dev/null
+++ b/tests/ui/issues/issue-71676-1.fixed
@@ -0,0 +1,53 @@
+// run-rustfix
+use std::ops::Deref;
+use std::ops::DerefMut;
+struct Bar(u8);
+struct Foo(Bar);
+struct Emm(Foo);
+impl Deref for Bar{
+ type Target = u8;
+ fn deref(&self) -> &Self::Target {
+ &self.0
+ }
+}
+impl Deref for Foo {
+ type Target = Bar;
+ fn deref(&self) -> &Self::Target {
+ &self.0
+ }
+}
+impl Deref for Emm {
+ type Target = Foo;
+ fn deref(&self) -> &Self::Target {
+ &self.0
+ }
+}
+impl DerefMut for Bar{
+ fn deref_mut(&mut self) -> &mut Self::Target {
+ &mut self.0
+ }
+}
+impl DerefMut for Foo {
+ fn deref_mut(&mut self) -> &mut Self::Target {
+ &mut self.0
+ }
+}
+impl DerefMut for Emm {
+ fn deref_mut(&mut self) -> &mut Self::Target {
+ &mut self.0
+ }
+}
+fn main() {
+ // Suggest dereference with arbitrary mutability
+ let a = Emm(Foo(Bar(0)));
+ let _: *const u8 = &***a; //~ ERROR mismatched types
+
+ let mut a = Emm(Foo(Bar(0)));
+ let _: *mut u8 = &mut ***a; //~ ERROR mismatched types
+
+ let a = Emm(Foo(Bar(0)));
+ let _: *const u8 = &***a; //~ ERROR mismatched types
+
+ let mut a = Emm(Foo(Bar(0)));
+ let _: *mut u8 = &mut ***a; //~ ERROR mismatched types
+}