Skip to content

Commit 0fe507d

Browse files
ehusstraviscross
authored andcommitted
Add an example for no_implicit_prelude
1 parent 2f10103 commit 0fe507d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/names/preludes.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,18 @@ r[names.preludes.no_implicit_prelude]
157157
r[names.preludes.no_implicit_prelude.intro]
158158
The *`no_implicit_prelude` [attribute]* may be applied at the crate level or on a module to indicate that it should not automatically bring the [standard library prelude], [extern prelude], or [tool prelude] into scope for that module or any of its descendants.
159159
160+
> [!EXAMPLE]
161+
> ```rust
162+
> // It can be applied to the crate root to apply to all modules.
163+
> #![no_implicit_prelude]
164+
>
165+
> // Or it can be applied to a module to only affect that module or any of its descendants.
166+
> #[no_implicit_prelude]
167+
> mod example {
168+
> // ...
169+
> }
170+
> ```
171+
160172
r[names.preludes.no_implicit_prelude.lang]
161173
This attribute does not affect the [language prelude].
162174

0 commit comments

Comments
 (0)