]> git.lizzy.rs Git - rust.git/blob - src/test/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs
Rollup merge of #100147 - Bryanskiy:private-in-public, r=petrochenkov
[rust.git] / src / test / ui / resolve / typo-suggestion-for-variable-with-name-similar-to-struct-field.rs
1 struct A {
2     config: String,
3 }
4
5 impl A {
6     fn new(cofig: String) -> Self {
7         Self { config } //~ Error cannot find value `config` in this scope
8     }
9
10     fn do_something(cofig: String) {
11         println!("{config}"); //~ Error cannot find value `config` in this scope
12     }
13
14     fn self_is_available(self, cofig: String) {
15         println!("{config}"); //~ Error cannot find value `config` in this scope
16     }
17 }
18
19 trait B {
20     const BAR: u32 = 3;
21     type Baz;
22     fn bar(&self);
23     fn baz(&self) {}
24     fn bah() {}
25 }
26
27 impl B for Box<isize> {
28     type Baz = String;
29     fn bar(&self) {
30         // let baz = 3;
31         baz();
32         //~^ ERROR cannot find function `baz`
33         bah;
34         //~^ ERROR cannot find value `bah`
35         BAR;
36         //~^ ERROR cannot find value `BAR` in this scope
37         let foo: Baz = "".to_string();
38         //~^ ERROR cannot find type `Baz` in this scope
39     }
40 }
41
42 fn ba() {}
43 const BARR: u32 = 3;
44 type Bar = String;
45
46 fn main() {}