File tree 2 files changed +31
-0
lines changed
2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ //@ check-pass
2
+ //@ compile-flags:--test --test-args=--test-threads=1
3
+ //@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
4
+ //@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME"
5
+
6
+ // Regression test for <https://github.com/rust-lang/rust/issues/131893>.
7
+ // It ensures that if a function called `main` is nested, it will not consider
8
+ // it as the `main` function.
9
+
10
+ /// ```
11
+ /// fn dox() {
12
+ /// fn main() {}
13
+ /// }
14
+ /// ```
15
+ pub fn foo ( ) { }
16
+
17
+ // This one ensures that having a nested `main` doesn't prevent the
18
+ // actual `main` function to be detected.
19
+ /// ```
20
+ /// fn main() {
21
+ /// fn main() {}
22
+ /// }
23
+ /// ```
24
+ pub fn foo2 ( ) { }
Original file line number Diff line number Diff line change
1
+
2
+ running 2 tests
3
+ test $DIR/nested-main.rs - foo (line 10) ... ok
4
+ test $DIR/nested-main.rs - foo2 (line 19) ... ok
5
+
6
+ test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
7
+
You can’t perform that action at this time.
0 commit comments