Conversation
|
r? @mu001999 rustbot has assigned @mu001999. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
This doesn't feel 100% sufficient and don't have the capacity to fully dive into this myself rn, started a zulip thread about it https://rust-lang.zulipchat.com/#narrow/channel/618216-t-types.2Fcall-for-participation/topic/yeet.20.27empty.20in.20region.20handling/with/621318591 |
| ty::ReVar(_) => (alt_span, "revar", region.to_string()), | ||
|
|
||
| ty::ReBound(..) => { | ||
| bug!("unexpected region for DescriptionCtx: {:?}", region); |
There was a problem hiding this comment.
any idea why we have ReVar/ReErases now? I kinda lost track of this.
There was a problem hiding this comment.
added separate handling for ReVar and ReErased because they represent different kinds of regions... so thought differentiating those would be better...
There was a problem hiding this comment.
So nothing blows up if we don't change them? Better keep them as is then. We want them to fail loud.
There was a problem hiding this comment.
This actually the upstream panics when it gets a ReErased region... so keeping it for now
There was a problem hiding this comment.
what code triggers the panic? some ui test?
There was a problem hiding this comment.
Oh, this is annoying. It has never been actually called before because it's a fallback for try_report_nice_region_error. And the diagnostics type must outlive [reerased] is confusing.
Would you like to investigate why try_report_trait_placeholder_mismatch doesn't work and try to make it work so that this fallback doesn't get triggered? The error kind we handle here is RegionResolutionError::UpperBoundUniverseConflict if I'm not mistaken.
There was a problem hiding this comment.
Yeah I think the blocker is that RelateParamBound doesn't carry the TypeTrace/ValuePairs data that try_report_trait_placeholder_mismatch needs.. it's (Span, Ty, Option) a completely different shape. we can't just add a match arm..
That's a separate, larger task with its own design and review. [This issue is truly annoying while working on this we just encountered 3 more]
There was a problem hiding this comment.
I guess we have to create a new diagnostics on our own then. Are you interested in doing that? 😃
It probably amounts to adding a new method try_report_placeholder_leak in fn try_report(), which would handle RegionResolutionError::UpperBoundUniverseConflict and emit a custom error.
The wording is likely similiar to TypeError::RegionsPlaceholderMismatch, plus regions' spans.
There was a problem hiding this comment.
yeah i will give it a try..
There was a problem hiding this comment.
Thanks! Feel free to ask if anything's unclear.
| ty::ReVar(_) => (alt_span, "revar", region.to_string()), | ||
|
|
||
| ty::ReBound(..) => { | ||
| bug!("unexpected region for DescriptionCtx: {:?}", region); |
There was a problem hiding this comment.
So nothing blows up if we don't change them? Better keep them as is then. We want them to fail loud.
|
Reminder, once the PR becomes ready for a review, use |
| // Regression test for https://github.com/rust-lang/rust/issues/161864 | ||
| //@ revisions: current next | ||
| //[next] compile-flags: -Znext-solver=coherence | ||
| //@ compile-flags: -Znext-solver |
There was a problem hiding this comment.
| // Regression test for https://github.com/rust-lang/rust/issues/161864 | |
| //@ revisions: current next | |
| //[next] compile-flags: -Znext-solver=coherence | |
| //@ compile-flags: -Znext-solver | |
| //@ revisions: current next | |
| //@[next] compile-flags: -Znext-solver | |
| // Regression test for https://github.com/rust-lang/rust/issues/161864 | |
| // We used to allow placeholders to outlive `'empty` in any universe, | |
| // which can be exploited to extend lifetimes. | |
| // `'empty` is a misleading name because the region can cover function body | |
| // for the callee. |
|
r? me so I don't forget about this. |
This comment was marked as duplicate.
This comment was marked as duplicate.
|
Requested reviewer is already assigned to this pull request. Please choose another assignee. |
stop skipping the check in
lexical_region_resolve/mod.rsand actually validate Empty lifetimes..follow-up - make
note_and_explain.rshandleReVarandReErasedso it prints a normal error message instead of exploding.. - (added ui-test and .stderr)fixes: #161864
r? @lcnr