-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issues in suggesting importing extern crate paths
- Loading branch information
1 parent
43d3470
commit 16be272
Showing
8 changed files
with
94 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub struct Foo<T>(pub core::ptr::NonNull<T>); |
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,12 @@ | ||
//@ edition: 2018 | ||
//@ compile-flags: --extern issue_121168_extern | ||
//@ aux-build: issue-121168-extern.rs | ||
|
||
extern crate issue_121168_extern as nice_crate_name; | ||
|
||
fn use_foo_from_another_crate_without_importing_it_first() { | ||
//use nice_crate_name::Foo; | ||
let _: Foo<i32> = todo!(); //~ ERROR cannot find type `Foo` in this scope | ||
} | ||
|
||
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,16 @@ | ||
error[E0412]: cannot find type `Foo` in this scope | ||
--> $DIR/issue-121168-2.rs:9:12 | ||
| | ||
LL | let _: Foo<i32> = todo!(); | ||
| ^^^ not found in this scope | ||
| | ||
help: consider importing one of these items | ||
| | ||
LL + use crate::nice_crate_name::Foo; | ||
| | ||
LL + use issue_121168_extern::Foo; | ||
| | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this 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,12 @@ | ||
//@ edition: 2015 | ||
//@ compile-flags: --extern issue_121168_extern | ||
//@ aux-build: issue-121168-extern.rs | ||
|
||
extern crate issue_121168_extern as nice_crate_name; | ||
|
||
fn use_foo_from_another_crate_without_importing_it_first() { | ||
//use nice_crate_name::Foo; | ||
let _: Foo<i32> = todo!(); //~ ERROR cannot find type `Foo` in this scope | ||
} | ||
|
||
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,14 @@ | ||
error[E0412]: cannot find type `Foo` in this scope | ||
--> $DIR/issue-121168-3.rs:9:12 | ||
| | ||
LL | let _: Foo<i32> = todo!(); | ||
| ^^^ not found in this scope | ||
| | ||
help: consider importing this struct | ||
| | ||
LL + use nice_crate_name::Foo; | ||
| | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this 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,12 @@ | ||
//@ edition: 2021 | ||
//@ compile-flags: --extern issue_121168_extern | ||
//@ aux-build: issue-121168-extern.rs | ||
|
||
extern crate issue_121168_extern as nice_crate_name; | ||
|
||
fn use_foo_from_another_crate_without_importing_it_first() { | ||
//use nice_crate_name::Foo; | ||
let _: Foo<i32> = todo!(); //~ ERROR cannot find type `Foo` in this scope | ||
} | ||
|
||
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,16 @@ | ||
error[E0412]: cannot find type `Foo` in this scope | ||
--> $DIR/issue-121168.rs:9:12 | ||
| | ||
LL | let _: Foo<i32> = todo!(); | ||
| ^^^ not found in this scope | ||
| | ||
help: consider importing one of these items | ||
| | ||
LL + use crate::nice_crate_name::Foo; | ||
| | ||
LL + use issue_121168_extern::Foo; | ||
| | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0412`. |