You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: src/names/namespaces.md
+16
Original file line number
Diff line number
Diff line change
@@ -104,24 +104,40 @@ imported.
104
104
105
105
<!-- TODO: describe how `use` works on the use-declarations page, and link to it here. -->
106
106
107
+
## Sub-namespaces
108
+
109
+
The macro namespace is split into two sub-namespaces: one for [bang-style macros] and one for [attributes].
110
+
When an attribute is resolved, any bang-style macros in scope will be ignored.
111
+
And conversely resolving a bang-style macro will ignore attribute macros in scope.
112
+
This prevents one style from shadowing another.
113
+
114
+
For example, the [`cfg` attribute] and the [`cfg` macro] are two different entities with the same name in the macro namespace, but they can still be used in their respective context.
115
+
116
+
It is still an error for a [`use` import] to shadow another macro, regardless of their sub-namespaces.
117
+
107
118
[^rustc-lifetime-shadow]: `rustc` currently warns about shadowing when using
108
119
the same name for a label and lifetime in the same scope, but it still
109
120
treats them independently. This is intended as a future-compatibility
110
121
warning about a possible extension to the language. See [PR
0 commit comments