rust/tests/rustdoc-ui/doctest/nested-main.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

25 lines
655 B
Rust
Raw Normal View History

2024-10-24 08:05:39 -05:00
//@ 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() {}