File tree Expand file tree Collapse file tree 1 file changed +60
-0
lines changed Expand file tree Collapse file tree 1 file changed +60
-0
lines changed Original file line number Diff line number Diff line change 1+ // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+ // file at the top-level directory of this distribution and at
3+ // http://rust-lang.org/COPYRIGHT.
4+ //
5+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+ // option. This file may not be copied, modified, or distributed
9+ // except according to those terms.
10+
11+ // Beginners write `mod.item` when they should write `mod::item`.
12+ // This tests that we suggest the latter when we encounter the former.
13+
14+ pub mod a {
15+ pub const I : i32 = 1 ;
16+
17+ pub fn f ( ) -> i32 { 2 }
18+
19+ pub mod b {
20+ pub const J : i32 = 3 ;
21+
22+ pub fn g ( ) -> i32 { 4 }
23+ }
24+ }
25+
26+ fn h1 ( ) -> i32 {
27+ a. I
28+ //~^ ERROR E0425
29+ //~| HELP To reference an item from the `a` module, use `a::I`
30+ }
31+
32+ fn h2 ( ) -> i32 {
33+ a. g ( )
34+ //~^ ERROR E0425
35+ //~| HELP To call a function from the `a` module, use `a::g(..)`
36+ }
37+
38+ fn h3 ( ) -> i32 {
39+ a. b . J
40+ //~^ ERROR E0425
41+ //~| HELP To reference an item from the `a` module, use `a::b`
42+ }
43+
44+ fn h4 ( ) -> i32 {
45+ a:: b. J
46+ //~^ ERROR E0425
47+ //~| HELP To reference an item from the `a::b` module, use `a::b::J`
48+ }
49+
50+ fn h5 ( ) -> i32 {
51+ a. b . f ( )
52+ //~^ ERROR E0425
53+ //~| HELP To reference an item from the `a` module, use `a::b`
54+ }
55+
56+ fn h6 ( ) -> i32 {
57+ a:: b. f ( )
58+ //~^ ERROR E0425
59+ //~| HELP To call a function from the `a::b` module, use `a::b::f(..)`
60+ }
You can’t perform that action at this time.
0 commit comments