forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(doctest): detect extern crate items in statement doctests
This partially reverts rust-lang#91026, because rustdoc needs to detect the extern statements, even when they appear inside implicit `main()`. It does not entirely revert it, so the old bug is still fixed, by duplicating some of the logic from `parse_mod` instead of trying to use it directly. Fixes rust-lang#91134
- Loading branch information
Showing
5 changed files
with
38 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// no-prefer-dynamic | ||
#![crate_type = "lib"] | ||
pub fn empty() {} |
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 @@ | ||
// compile-flags: --test --crate-name=empty_fn --extern=empty_fn --test-args=--test-threads=1 | ||
// aux-build:empty-fn.rs | ||
// check-pass | ||
// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR" | ||
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" | ||
// edition:2021 | ||
|
||
/// <https://github.com/rust-lang/rust/issues/91134> | ||
/// | ||
/// ``` | ||
/// extern crate empty_fn; | ||
/// empty_fn::empty(); | ||
/// ``` | ||
pub struct Something; |
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/issue-91134.rs - something (line 10) ... ok | ||
|
||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME | ||
|