-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Fix linker error by resolving regions for main return type obligations #151377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| // check-fail | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Can you add a comment for what this is testing (and link to the issue in the file (and not necessarily in the test name))
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay will add. |
||
|
|
||
| use std::process::ExitCode; | ||
| use std::process::Termination; | ||
|
|
||
| trait IsStatic {} | ||
| impl<'a: 'static> IsStatic for &'a () {} | ||
|
|
||
| struct Thing; | ||
|
|
||
| impl Termination for Thing where for<'a> &'a (): IsStatic { | ||
| fn report(self) -> ExitCode { panic!() } | ||
| } | ||
|
|
||
| fn main() -> Thing { Thing } //~ ERROR implementation of `IsStatic` is not general enough | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| error: implementation of `IsStatic` is not general enough | ||
| --> $DIR/main-termination-lifetime-issue-148421.rs:15:14 | ||
| | | ||
| LL | fn main() -> Thing { Thing } | ||
| | ^^^^^ implementation of `IsStatic` is not general enough | ||
| | | ||
| = note: `IsStatic` would have to be implemented for the type `&'0 ()`, for any lifetime `'0`... | ||
| = note: ...but `IsStatic` is actually implemented for the type `&'1 ()`, for some specific lifetime `'1` | ||
|
|
||
| error: aborting due to 1 previous error | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not part of the
and🤔There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kept it separate to make sure error is propagated.