forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
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 rust-lang#115630 - compiler-errors:dont-suggest-use-btw-use-and-attr, r=wesleywiser Dont suggest use between `use` and cfg attr Fixes rust-lang#115618
- Loading branch information
Showing
4 changed files
with
52 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
16 changes: 16 additions & 0 deletions
16
tests/ui/resolve/suggest-import-without-clobbering-attrs.fixed
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 @@ | ||
// run-rustfix | ||
// compile-flags: --cfg=whatever -Aunused | ||
|
||
use y::z; | ||
#[cfg(whatever)] | ||
use y::Whatever; | ||
|
||
mod y { | ||
pub(crate) fn z() {} | ||
pub(crate) struct Whatever; | ||
} | ||
|
||
fn main() { | ||
z(); | ||
//~^ ERROR cannot find function `z` in this scope | ||
} |
15 changes: 15 additions & 0 deletions
15
tests/ui/resolve/suggest-import-without-clobbering-attrs.rs
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,15 @@ | ||
// run-rustfix | ||
// compile-flags: --cfg=whatever -Aunused | ||
|
||
#[cfg(whatever)] | ||
use y::Whatever; | ||
|
||
mod y { | ||
pub(crate) fn z() {} | ||
pub(crate) struct Whatever; | ||
} | ||
|
||
fn main() { | ||
z(); | ||
//~^ ERROR cannot find function `z` in this scope | ||
} |
14 changes: 14 additions & 0 deletions
14
tests/ui/resolve/suggest-import-without-clobbering-attrs.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
error[E0425]: cannot find function `z` in this scope | ||
--> $DIR/suggest-import-without-clobbering-attrs.rs:13:5 | ||
| | ||
LL | z(); | ||
| ^ not found in this scope | ||
| | ||
help: consider importing this function | ||
| | ||
LL + use y::z; | ||
| | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0425`. |