-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #82881 - Manishearth:crate-root, r=estebank
diagnostics: Be clear about "crate root" and `::foo` paths in resolve diagnostics Various changes to make sure the diagnostics are clear about the differences in `::foo` paths across editions: - `::foo` will say "crate root" in 2015 and "list of imported crates" in 2018 - `crate::` will never reference imported crates in 2018 Fixes #82876
- Loading branch information
Showing
11 changed files
with
129 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// edition:2015 | ||
|
||
mod inner { | ||
fn global_inner(_: ::nonexistant::Foo) { | ||
//~^ ERROR failed to resolve: maybe a missing crate `nonexistant`? | ||
} | ||
fn crate_inner(_: crate::nonexistant::Foo) { | ||
//~^ ERROR failed to resolve: maybe a missing crate `nonexistant`? | ||
} | ||
|
||
fn bare_global(_: ::nonexistant) { | ||
//~^ ERROR cannot find type `nonexistant` in the crate root | ||
} | ||
fn bare_crate(_: crate::nonexistant) { | ||
//~^ ERROR cannot find type `nonexistant` in the crate root | ||
} | ||
} | ||
|
||
fn main() { | ||
|
||
} |
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,28 @@ | ||
error[E0433]: failed to resolve: maybe a missing crate `nonexistant`? | ||
--> $DIR/editions-crate-root-2015.rs:4:26 | ||
| | ||
LL | fn global_inner(_: ::nonexistant::Foo) { | ||
| ^^^^^^^^^^^ maybe a missing crate `nonexistant`? | ||
|
||
error[E0433]: failed to resolve: maybe a missing crate `nonexistant`? | ||
--> $DIR/editions-crate-root-2015.rs:7:30 | ||
| | ||
LL | fn crate_inner(_: crate::nonexistant::Foo) { | ||
| ^^^^^^^^^^^ maybe a missing crate `nonexistant`? | ||
|
||
error[E0412]: cannot find type `nonexistant` in the crate root | ||
--> $DIR/editions-crate-root-2015.rs:11:25 | ||
| | ||
LL | fn bare_global(_: ::nonexistant) { | ||
| ^^^^^^^^^^^ not found in the crate root | ||
|
||
error[E0412]: cannot find type `nonexistant` in the crate root | ||
--> $DIR/editions-crate-root-2015.rs:14:29 | ||
| | ||
LL | fn bare_crate(_: crate::nonexistant) { | ||
| ^^^^^^^^^^^ not found in the crate root | ||
|
||
error: aborting due to 4 previous errors | ||
|
||
Some errors have detailed explanations: E0412, E0433. | ||
For more information about an error, try `rustc --explain E0412`. |
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 @@ | ||
// edition:2018 | ||
|
||
mod inner { | ||
fn global_inner(_: ::nonexistant::Foo) { | ||
//~^ ERROR failed to resolve: could not find `nonexistant` in the list of imported crates | ||
} | ||
fn crate_inner(_: crate::nonexistant::Foo) { | ||
//~^ ERROR failed to resolve: could not find `nonexistant` in the crate root | ||
} | ||
|
||
fn bare_global(_: ::nonexistant) { | ||
//~^ ERROR cannot find crate `nonexistant` in the list of imported crates | ||
} | ||
fn bare_crate(_: crate::nonexistant) { | ||
//~^ ERROR cannot find type `nonexistant` in the crate root | ||
} | ||
} | ||
|
||
fn main() { | ||
|
||
} |
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,28 @@ | ||
error[E0433]: failed to resolve: could not find `nonexistant` in the list of imported crates | ||
--> $DIR/editions-crate-root-2018.rs:4:26 | ||
| | ||
LL | fn global_inner(_: ::nonexistant::Foo) { | ||
| ^^^^^^^^^^^ could not find `nonexistant` in the list of imported crates | ||
|
||
error[E0433]: failed to resolve: could not find `nonexistant` in the crate root | ||
--> $DIR/editions-crate-root-2018.rs:7:30 | ||
| | ||
LL | fn crate_inner(_: crate::nonexistant::Foo) { | ||
| ^^^^^^^^^^^ could not find `nonexistant` in the crate root | ||
|
||
error[E0412]: cannot find crate `nonexistant` in the list of imported crates | ||
--> $DIR/editions-crate-root-2018.rs:11:25 | ||
| | ||
LL | fn bare_global(_: ::nonexistant) { | ||
| ^^^^^^^^^^^ not found in the list of imported crates | ||
|
||
error[E0412]: cannot find type `nonexistant` in the crate root | ||
--> $DIR/editions-crate-root-2018.rs:14:29 | ||
| | ||
LL | fn bare_crate(_: crate::nonexistant) { | ||
| ^^^^^^^^^^^ not found in the crate root | ||
|
||
error: aborting due to 4 previous errors | ||
|
||
Some errors have detailed explanations: E0412, E0433. | ||
For more information about an error, try `rustc --explain E0412`. |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// Regression test for issue #63882. | ||
|
||
type A = crate::r#break; //~ ERROR cannot find type `r#break` in module `crate` | ||
type A = crate::r#break; //~ ERROR cannot find type `r#break` in the crate root | ||
|
||
fn main() {} |
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
4 changes: 2 additions & 2 deletions
4
src/test/ui/rfc-2126-extern-absolute-paths/non-existent-2.stderr
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