diff options
| author | bors <bors@rust-lang.org> | 2025-08-13 22:52:17 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-08-13 22:52:17 +0000 |
| commit | e7d8d34eae23bd91164510b03e6b239ccbcfdf07 (patch) | |
| tree | 3cf1badc9a1556f2af394445e9055acf12ca6069 | |
| parent | cf42ac6bf2e8effc1d84bdaec16531a6cbb42f62 (diff) | |
| parent | cb3dedc6244493f2c36bf3d8f115e120faa91710 (diff) | |
| download | rust-e7d8d34eae23bd91164510b03e6b239ccbcfdf07.tar.gz rust-e7d8d34eae23bd91164510b03e6b239ccbcfdf07.zip | |
Auto merge of #144793 - petrochenkov:extprel3, r=davidtwco
resolve: Split extern prelude into two scopes One scope for `extern crate` items and another for `--extern` options, with the former shadowing the latter. If in a single scope some things can overwrite other things, especially with ad hoc restrictions like `MacroExpandedExternCrateCannotShadowExternArguments`, then it's not really a single scope. So this PR splits `Scope::ExternPrelude` into two cleaner scopes. This is similar to how https://github.com/rust-lang/rust/pull/144131 splits module scope into two scopes for globs and non-globs, but simpler.
| -rw-r--r-- | tests/ui/crashes/ice-6255.rs | 2 | ||||
| -rw-r--r-- | tests/ui/crashes/ice-6255.stderr | 22 |
2 files changed, 22 insertions, 2 deletions
diff --git a/tests/ui/crashes/ice-6255.rs b/tests/ui/crashes/ice-6255.rs index ef1e01f80ef..5f31696c791 100644 --- a/tests/ui/crashes/ice-6255.rs +++ b/tests/ui/crashes/ice-6255.rs @@ -9,7 +9,7 @@ macro_rules! define_other_core { } fn main() { - core::panic!(); + core::panic!(); //~ ERROR: `core` is ambiguous } define_other_core!(); diff --git a/tests/ui/crashes/ice-6255.stderr b/tests/ui/crashes/ice-6255.stderr index 738e9d1bd5c..420e4af936f 100644 --- a/tests/ui/crashes/ice-6255.stderr +++ b/tests/ui/crashes/ice-6255.stderr @@ -9,5 +9,25 @@ LL | define_other_core!(); | = note: this error originates in the macro `define_other_core` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 1 previous error +error[E0659]: `core` is ambiguous + --> tests/ui/crashes/ice-6255.rs:12:5 + | +LL | core::panic!(); + | ^^^^ ambiguous name + | + = note: ambiguous because of a conflict between a macro-expanded name and a less macro-expanded name from outer scope during import or macro resolution + = note: `core` could refer to a built-in crate +note: `core` could also refer to the crate imported here + --> tests/ui/crashes/ice-6255.rs:6:9 + | +LL | extern crate std as core; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +... +LL | define_other_core!(); + | -------------------- in this macro invocation + = help: use `crate::core` to refer to this crate unambiguously + = note: this error originates in the macro `define_other_core` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0659`. |
