Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
forbid
#[track_caller]
on main
- Loading branch information
Showing
5 changed files
with
70 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#[track_caller] //~ ERROR `main` function is not allowed to be | ||
fn main() { | ||
panic!("{}: oh no", std::panic::Location::caller()); | ||
} |
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,12 @@ | ||
error: `main` function is not allowed to be `#[track_caller]` | ||
--> $DIR/error-with-main.rs:1:1 | ||
| | ||
LL | #[track_caller] | ||
| ^^^^^^^^^^^^^^^ | ||
LL | / fn main() { | ||
LL | | panic!("{}: oh no", std::panic::Location::caller()); | ||
LL | | } | ||
| |_- `main` function is not allowed to be `#[track_caller]` | ||
|
||
error: aborting due to previous error | ||
|
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 @@ | ||
#![feature(start)] | ||
|
||
#[start] | ||
#[track_caller] //~ ERROR start is not allowed to be `#[track_caller]` | ||
fn start(_argc: isize, _argv: *const *const u8) -> isize { | ||
panic!("{}: oh no", std::panic::Location::caller()); | ||
} |
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,12 @@ | ||
error: start is not allowed to be `#[track_caller]` | ||
--> $DIR/error-with-start.rs:4:1 | ||
| | ||
LL | #[track_caller] | ||
| ^^^^^^^^^^^^^^^ | ||
LL | / fn start(_argc: isize, _argv: *const *const u8) -> isize { | ||
LL | | panic!("{}: oh no", std::panic::Location::caller()); | ||
LL | | } | ||
| |_- start is not allowed to be `#[track_caller]` | ||
|
||
error: aborting due to previous error | ||
|