1
Fork 0

Make diagnostic for unsatisfied Termination bounds more precise

This commit is contained in:
León Orell Valerian Liehr 2022-10-17 12:04:16 +02:00
parent bf286a82e2
commit 684df4d24e
No known key found for this signature in database
GPG key ID: CD75E31CE2CFD7D9
8 changed files with 78 additions and 5 deletions

View file

@ -2154,8 +2154,16 @@ pub fn id() -> u32 {
#[cfg_attr(not(test), lang = "termination")]
#[stable(feature = "termination_trait_lib", since = "1.61.0")]
#[rustc_on_unimplemented(
message = "`main` has invalid return type `{Self}`",
label = "`main` can only return types that implement `{Termination}`"
on(
all(not(bootstrap), cause = "MainFunctionType"),
message = "`main` has invalid return type `{Self}`",
label = "`main` can only return types that implement `{Termination}`"
),
on(
bootstrap,
message = "`main` has invalid return type `{Self}`",
label = "`main` can only return types that implement `{Termination}`"
)
)]
pub trait Termination {
/// Is called to get the representation of the value as status code.