Skip to content

Commit 350330e

Browse files
committed
Make diagnostic for unsatisfied Termination bounds more precise
1 parent ff00132 commit 350330e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

std/src/process.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2154,8 +2154,16 @@ pub fn id() -> u32 {
21542154
#[cfg_attr(not(test), lang = "termination")]
21552155
#[stable(feature = "termination_trait_lib", since = "1.61.0")]
21562156
#[rustc_on_unimplemented(
2157-
message = "`main` has invalid return type `{Self}`",
2158-
label = "`main` can only return types that implement `{Termination}`"
2157+
on(
2158+
all(not(bootstrap), cause = "MainFunctionType"),
2159+
message = "`main` has invalid return type `{Self}`",
2160+
label = "`main` can only return types that implement `{Termination}`"
2161+
),
2162+
on(
2163+
bootstrap,
2164+
message = "`main` has invalid return type `{Self}`",
2165+
label = "`main` can only return types that implement `{Termination}`"
2166+
)
21592167
)]
21602168
pub trait Termination {
21612169
/// Is called to get the representation of the value as status code.

0 commit comments

Comments
 (0)