Skip to content

Commit 291d048

Browse files
committed
update path-vs-textual ambiguity text
1 parent d479387 commit 291d048

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/names/name-resolution.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,7 @@ fn ambiguous_shadow() {
191191
}
192192
```
193193

194-
Multiple glob imports are allowed to import the same name, and that name is
195-
allowed to be used if the imports are of the same item (following re-exports).
196-
The visibility of the name is the maximum visibility of the imports.
194+
Multiple glob imports are allowed to import the same name, and that name is allowed to be used if the imports are of the same item (following re-exports). The visibility of the name is the maximum visibility of the imports.
197195

198196
```rust
199197
mod m1 {
@@ -281,7 +279,7 @@ const _: () = {
281279
> ```
282280
283281
r[names.resolution.expansion.imports.ambiguity.path-vs-textual-macro]
284-
Path-based scope bindings for macros may not shadow textual scope bindings to macros.
282+
Names may not be resolved through ambiguous macro re-exports. Macro re-exports are ambiguous when they would shadow a textual macro candidate for the same name in an [outer scope].
285283
286284
```rust,compile_fail,E0659
287285
macro_rules! ambig {
@@ -300,6 +298,11 @@ pub fn f() {
300298
}
301299
```
302300
301+
// [!NOTE]
302+
// This restriction is needed due to implementation details in the compiler,
303+
// specifically the current scope visitation logic and the complexity of supporting
304+
// this behavior. This ambiguity error may be removed in the future.
305+
303306
r[names.resolution.expansion.macros]
304307
### Macros
305308

@@ -322,6 +325,12 @@ The available scope kinds are visited in the following order. Each of these scop
322325
>
323326
> For more info see [derive helper scope].
324327
328+
> [!NOTE]
329+
>
330+
> This visitation order may change in the future, such as interleaving the
331+
> visitation of textual and path-based scope candidates based on their lexical
332+
> scopes.
333+
325334
> [!EDITION-2018]
326335
>
327336
> Starting in edition 2018 the `#[macro_use]` prelude is not visited when `#[no_implicit_prelude]` is present.

0 commit comments

Comments
 (0)