Skip to content

Commit f751568

Browse files
ehusstraviscross
authored andcommitted
Add a no_link example
1 parent 237b3bd commit f751568

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/items/extern-crates.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,15 @@ r[items.extern-crate.no_link]
7979
r[items.extern-crate.no_link.intro]
8080
The *`no_link` [attribute][attributes]* may be specified on an `extern crate` item to prevent linking the crate into the output. This is commonly used to load a crate to access only its macros.
8181

82+
> [!EXAMPLE]
83+
> <!-- ignore: requires external crates -->
84+
> ```rust,ignore
85+
> #[no_link]
86+
> extern crate other_crate;
87+
>
88+
> other_crate::some_macro!();
89+
> ```
90+
8291
[identifier]: ../identifiers.md
8392
[RFC 940]: https://github.com/rust-lang/rfcs/blob/master/text/0940-hyphens-considered-harmful.md
8493
[`macro_use` attribute]: ../macros-by-example.md#the-macro_use-attribute

0 commit comments

Comments
 (0)