Skip to content

Commit 3f0b766

Browse files
committed
No unused macro warning in compile_error example.
1 parent 44c343b commit 3f0b766

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/libstd/macros.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,14 +288,17 @@ pub mod builtin {
288288
/// # Examples
289289
/// Two such examples are macros and `#[cfg]` environments.
290290
///
291-
/// ```
291+
/// ```compile_fail
292292
/// macro_rules! give_me_foo_or_bar {
293293
/// (foo) => {};
294294
/// (bar) => {};
295295
/// ($x:ident) => {
296296
/// compile_error!("This macro only accepts `foo` or `bar`");
297297
/// }
298298
/// }
299+
///
300+
/// give_me_foo_or_bar!(neither);
301+
/// // ^ will fail at compile time with message "This macro only accepts `foo` or `bar`"
299302
/// ```
300303
///
301304
/// ```compile_fail

0 commit comments

Comments
 (0)