-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix #101749, use . instead of :: when accessing a method of an object
- Loading branch information
1 parent
2ed65da
commit 54b58fc
Showing
10 changed files
with
214 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
struct Rectangle { | ||
width: i32, | ||
height: i32, | ||
} | ||
impl Rectangle { | ||
fn new(width: i32, height: i32) -> Self { | ||
Self { width, height } | ||
} | ||
} | ||
|
||
fn main() { | ||
let rect = Rectangle::new(3, 4); | ||
// `area` is not implemented for `Rectangle`, so this should not suggest | ||
let _ = rect::area(); | ||
//~^ ERROR failed to resolve: use of undeclared crate or module `rect` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
error[E0433]: failed to resolve: use of undeclared crate or module `rect` | ||
--> $DIR/issue-101749-2.rs:14:13 | ||
| | ||
LL | let _ = rect::area(); | ||
| ^^^^ use of undeclared crate or module `rect` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0433`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// run-rustfix | ||
struct Rectangle { | ||
width: i32, | ||
height: i32, | ||
} | ||
impl Rectangle { | ||
fn new(width: i32, height: i32) -> Self { | ||
Self { width, height } | ||
} | ||
fn area(&self) -> i32 { | ||
self.height * self.width | ||
} | ||
} | ||
|
||
fn main() { | ||
let rect = Rectangle::new(3, 4); | ||
//~^ WARNING ident `rect` is defined at here | ||
let _ = rect.area(); | ||
//~^ ERROR failed to resolve: use of undeclared crate or module `rect` | ||
//~| ERROR `rect` is not a crate or module | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// run-rustfix | ||
struct Rectangle { | ||
width: i32, | ||
height: i32, | ||
} | ||
impl Rectangle { | ||
fn new(width: i32, height: i32) -> Self { | ||
Self { width, height } | ||
} | ||
fn area(&self) -> i32 { | ||
self.height * self.width | ||
} | ||
} | ||
|
||
fn main() { | ||
let rect = Rectangle::new(3, 4); | ||
//~^ WARNING ident `rect` is defined at here | ||
let _ = rect::area(); | ||
//~^ ERROR failed to resolve: use of undeclared crate or module `rect` | ||
//~| ERROR `rect` is not a crate or module | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
error[E0433]: failed to resolve: use of undeclared crate or module `rect` | ||
--> $DIR/issue-101749.rs:18:13 | ||
| | ||
LL | let _ = rect::area(); | ||
| ^^^^ use of undeclared crate or module `rect` | ||
|
||
error: `rect` is not a crate or module | ||
--> $DIR/issue-101749.rs:18:13 | ||
| | ||
LL | let _ = rect::area(); | ||
| ^^^^ | ||
| | ||
warning: ident `rect` is defined at here | ||
--> $DIR/issue-101749.rs:16:9 | ||
| | ||
LL | let rect = Rectangle::new(3, 4); | ||
| ^^^^ | ||
help: maybe you meant to call instance method | ||
| | ||
LL | let _ = rect.area(); | ||
| ~ | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0433`. |