Fix linker error by resolving regions for main return type obligations#151377
Fix linker error by resolving regions for main return type obligations#151377xonx4l wants to merge 6 commits intorust-lang:mainfrom
Conversation
|
r? @fee1-dead rustbot has assigned @fee1-dead. Use |
| } | ||
|
|
||
| let region_errors = | ||
| infcx.resolve_regions(main_diagnostics_def_id, param_env, tcx.mk_type_list(&[])); |
There was a problem hiding this comment.
One thing I'm slightly unsure about is the diagnostic span main_diagnostics_def_id as this points to the function as a whole.
There was a problem hiding this comment.
This DefId is the context in which we're emitting the errors, so it should be the DefId of the whole body. This is correct. Please use ty::List::empty() instead of mk_type_list
Also, can you change this function to return Result<(), ErrorGuaranteed> and instead of using error = true just return Err(guar).
We shouldn't emit region errors if there are fulfillment errors
There was a problem hiding this comment.
@lcnr sorry I was a bit busy . I have made the the changes you asked for . Thanks!
This comment has been minimized.
This comment has been minimized.
|
Reminder, once the PR becomes ready for a review, use |
This comment has been minimized.
This comment has been minimized.
|
@rustbot ready |
|
Overall looks correct, but for signoff: r? lcnr |
This comment has been minimized.
This comment has been minimized.
ddf220c to
48c7506
Compare
This comment has been minimized.
This comment has been minimized.
|
@rustbot ready |
|
|
||
| if error { | ||
| return; | ||
| return Ok(()); |
There was a problem hiding this comment.
?
we should return Err(ErrorGuaranteed) here
There was a problem hiding this comment.
I am sorry I got a bit busy and it just slipped out of my focus . Updated to enforce Err(ErrorGuaranteed). Thanks !
| .is_err() | ||
| { | ||
| return; | ||
| return Ok(()); |
This comment has been minimized.
This comment has been minimized.
48c7506 to
ce665cd
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
This comment has been minimized.
This comment has been minimized.
| .and(items.par_opaques(|item| tcx.ensure_result().check_well_formed(item))); | ||
| super::entry::check_for_entry_fn(tcx); | ||
|
|
||
| super::entry::check_for_entry_fn(tcx)?; |
There was a problem hiding this comment.
I kept it separate to make sure error is propagated.
| @@ -0,0 +1,15 @@ | |||
| // check-fail | |||
There was a problem hiding this comment.
check-fail isn't necessary.
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))
This PR fix linker error by resolving regions for main return type obligations as discussed in #148421
Added a final check . Now the compiler double-checks the lifetimes for main right away. If they don't work it stops and gives the user a clean compiler error instead of a linker crash.