-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0e0a84a
commit aab2b67
Showing
2 changed files
with
31 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
//@ check-pass | ||
//@ compile-flags:--test --test-args=--test-threads=1 | ||
//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" | ||
//@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME" | ||
|
||
// Regression test for <https://github.com/rust-lang/rust/issues/131893>. | ||
// It ensures that if a function called `main` is nested, it will not consider | ||
// it as the `main` function. | ||
|
||
/// ``` | ||
/// fn dox() { | ||
/// fn main() {} | ||
/// } | ||
/// ``` | ||
pub fn foo() {} | ||
|
||
// This one ensures that having a nested `main` doesn't prevent the | ||
// actual `main` function to be detected. | ||
/// ``` | ||
/// fn main() { | ||
/// fn main() {} | ||
/// } | ||
/// ``` | ||
pub fn foo2() {} |
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,7 @@ | ||
|
||
running 2 tests | ||
test $DIR/nested-main.rs - foo (line 10) ... ok | ||
test $DIR/nested-main.rs - foo2 (line 19) ... ok | ||
|
||
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME | ||
|