-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adjust
#[macro_export]
/doctest help suggestion for non_local_defs lint
- Loading branch information
Showing
6 changed files
with
49 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
//@ check-pass | ||
//@ compile-flags:--test --test-args --test-threads=1 --nocapture -Zunstable-options | ||
//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" | ||
//@ normalize-stderr-test: "tests/rustdoc-ui/doctest" -> "$$DIR" | ||
//@ normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" | ||
|
||
//! ``` | ||
//! #[macro_export] | ||
//! macro_rules! a_macro { () => {} } | ||
//! ``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
warning: non-local `macro_rules!` definition, they should be avoided as they go against expectation | ||
--> $DIR/non_local_defs.rs:9:1 | ||
| | ||
LL | macro_rules! a_macro { () => {} } | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: remove the `#[macro_export]` or make this doc-test a standalone test with its own `fn main() { ... }` | ||
= note: a `macro_rules!` definition is non-local if it is nested inside an item and has a `#[macro_export]` attribute | ||
= note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module | ||
= note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363> | ||
= note: `#[warn(non_local_definitions)]` on by default | ||
|
||
warning: 1 warning emitted | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
running 1 test | ||
test $DIR/non_local_defs.rs - (line 7) ... ok | ||
|
||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME | ||
|