]> git.proxmox.com Git - rustc.git/blob - tests/ui/suggestions/suggest-field-through-deref.rs
New upstream version 1.76.0+dfsg1
[rustc.git] / tests / ui / suggestions / suggest-field-through-deref.rs
1 // run-rustfix
2 #![allow(dead_code)]
3 use std::sync::Arc;
4 struct S {
5 long_name: (),
6 foo: (),
7 }
8 fn main() {
9 let x = Arc::new(S { long_name: (), foo: () });
10 let _ = x.longname; //~ ERROR no field `longname`
11 let y = S { long_name: (), foo: () };
12 let _ = y.longname; //~ ERROR no field `longname`
13 let a = Some(Arc::new(S { long_name: (), foo: () }));
14 let _ = a.longname; //~ ERROR no field `longname`
15 let b = Some(S { long_name: (), foo: () });
16 let _ = b.long_name; //~ ERROR no field `long_name`
17 let c = Ok::<_, ()>(Arc::new(S { long_name: (), foo: () }));
18 let _ = c.longname; //~ ERROR no field `longname`
19 let d = Ok::<_, ()>(S { long_name: (), foo: () });
20 let _ = d.long_name; //~ ERROR no field `long_name`
21 }