summaryrefslogtreecommitdiffstats
path: root/tests/ui/suggestions/suggest-field-through-deref.fixed
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/suggestions/suggest-field-through-deref.fixed')
-rw-r--r--tests/ui/suggestions/suggest-field-through-deref.fixed21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/ui/suggestions/suggest-field-through-deref.fixed b/tests/ui/suggestions/suggest-field-through-deref.fixed
new file mode 100644
index 000000000..07ba3aa91
--- /dev/null
+++ b/tests/ui/suggestions/suggest-field-through-deref.fixed
@@ -0,0 +1,21 @@
+// run-rustfix
+#![allow(dead_code)]
+use std::sync::Arc;
+struct S {
+ long_name: (),
+ foo: (),
+}
+fn main() {
+ let x = Arc::new(S { long_name: (), foo: () });
+ let _ = x.long_name; //~ ERROR no field `longname`
+ let y = S { long_name: (), foo: () };
+ let _ = y.long_name; //~ ERROR no field `longname`
+ let a = Some(Arc::new(S { long_name: (), foo: () }));
+ let _ = a.unwrap().long_name; //~ ERROR no field `longname`
+ let b = Some(S { long_name: (), foo: () });
+ let _ = b.unwrap().long_name; //~ ERROR no field `long_name`
+ let c = Ok::<_, ()>(Arc::new(S { long_name: (), foo: () }));
+ let _ = c.unwrap().long_name; //~ ERROR no field `longname`
+ let d = Ok::<_, ()>(S { long_name: (), foo: () });
+ let _ = d.unwrap().long_name; //~ ERROR no field `long_name`
+}