diff options
| author | Michael Goulet <michael@errs.io> | 2023-09-07 05:11:41 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2023-09-07 05:18:54 +0000 |
| commit | 4da6eb2ec6141eb7b4172d62e48c277ea8a191fb (patch) | |
| tree | 6acc0d22ff2078c1242b70d4037e8a0fa902d15a | |
| parent | f00c1399987c60b4e884afc42f4aa6226855e9ae (diff) | |
| download | rust-4da6eb2ec6141eb7b4172d62e48c277ea8a191fb.tar.gz rust-4da6eb2ec6141eb7b4172d62e48c277ea8a191fb.zip | |
Test showing it doesnt work
3 files changed, 45 insertions, 0 deletions
diff --git a/tests/ui/resolve/suggest-import-without-clobbering-attrs.fixed b/tests/ui/resolve/suggest-import-without-clobbering-attrs.fixed new file mode 100644 index 00000000000..881b973e3ef --- /dev/null +++ b/tests/ui/resolve/suggest-import-without-clobbering-attrs.fixed @@ -0,0 +1,16 @@ +// run-rustfix +// compile-flags: --cfg=whatever -Aunused + +#[cfg(whatever)] +use y::z; +use y::Whatever; + +mod y { + pub(crate) fn z() {} + pub(crate) struct Whatever; +} + +fn main() { + z(); + //~^ ERROR cannot find function `z` in this scope +} diff --git a/tests/ui/resolve/suggest-import-without-clobbering-attrs.rs b/tests/ui/resolve/suggest-import-without-clobbering-attrs.rs new file mode 100644 index 00000000000..38a1095703b --- /dev/null +++ b/tests/ui/resolve/suggest-import-without-clobbering-attrs.rs @@ -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 +} diff --git a/tests/ui/resolve/suggest-import-without-clobbering-attrs.stderr b/tests/ui/resolve/suggest-import-without-clobbering-attrs.stderr new file mode 100644 index 00000000000..d3574851d5c --- /dev/null +++ b/tests/ui/resolve/suggest-import-without-clobbering-attrs.stderr @@ -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`. |
