File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 1+ // This test ensures that if there is an expression alongside a `main`
2+ // function, it will not consider the entire code to be part of the `main`
3+ // function and will generate its own function to wrap everything.
4+ //
5+ // This is a regression test for:
6+ // * <https://github.com/rust-lang/rust/issues/140162>
7+ // * <https://github.com/rust-lang/rust/issues/139651>
8+ //@ compile-flags:--test
9+ //@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR"
10+ //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
11+ //@ check-pass
12+
13+ #![ crate_name = "foo" ]
14+
15+ //! ```
16+ //! # if cfg!(miri) { return; }
17+ //! use std::ops::Deref;
18+ //!
19+ //! fn main() {
20+ //! println!("Hi!");
21+ //! }
22+ //! ```
Original file line number Diff line number Diff line change 1+
2+ running 1 test
3+ test $DIR/test-main-alongside-exprs.rs - (line 15) ... ok
4+
5+ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
6+
You can’t perform that action at this time.
0 commit comments