Get rid of check_opaque_type_well_formed#132757
Conversation
| 'a: 'b, | ||
| { | ||
| || {} | ||
| //~^ ERROR lifetime bound not satisfied |
There was a problem hiding this comment.
This is as bad as outlives errors we get within a defining scope, like:
fn foo<'a, T>(t: T) -> impl Sized + 'a { t }error[E0309]: the parameter type `T` may not live long enough
--> src/lib.rs:1:42
|
1 | fn foo<'a, T>(t: T) -> impl Sized + 'a { t }
| -- ^ ...so that the type `T` will meet its required lifetime bounds
| |
| the parameter type `T` must be valid for the lifetime `'a` as defined here...
There was a problem hiding this comment.
can we also emit the "this definition site has more where clauses than the opaque type" note for region errors, I feel like it's even more useful there
There was a problem hiding this comment.
really annoying to do that given the way that region error reporting is handled with a totally different error path :/
72940c7 to
97dfe8b
Compare
| } | ||
| } | ||
|
|
||
| fn best_definition_site_of_opaque<'tcx>( |
There was a problem hiding this comment.
This is kinda annoyingly duplicated w/ the TAIT visitor, but also I could not find a way to genericize that without making it a mess, since it has a lot of responsibilities.
|
cc @oli-obk r=me after suggestion |
|
I remember we added the duplicate check in borrowck because the wf check failed to handle lifetimes in all cases. |
|
@oli-obk: #96736 does not seem to suggest that this extra well-formedness check is necessary for correctness, and instead is used for improving diagnostics.
We don't even check lifetimes in the borrowck copy of the well-formedness check, so I'm not totally sure what you mean.... As far as I can tell, the checks in |
|
Ah, I misremembered. Thanks for investigating. |
|
I spent an hour on this and could not get the lifetime error reporting machinery to work correctly, so I won't do anything else to this PR. @bors r=lcnr |
Get rid of `check_opaque_type_well_formed` Instead, replicate it by improving the span of the opaque in `check_opaque_meets_bounds`. This has two consequences: 1. We now prefer "concrete type differs" errors, since we'll hit those first before we check the opaque is WF. 2. Spans have gotten slightly worse. Specifically, (2.) could be improved by adding a new obligation cause that explains that the definition's environment has stronger assumptions than the declaration. r? lcnr
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
💔 Test failed - checks-actions |
|
lol that definitely has nothing to do with opaques @bors retry |
…kingjubilee Rollup of 5 pull requests Successful merges: - rust-lang#132755 (Do not reveal opaques in the param-env, we got lazy norm instead) - rust-lang#132757 (Get rid of `check_opaque_type_well_formed`) - rust-lang#132760 (Don't suggest `.into_iter()` on iterators) - rust-lang#132778 (update io::Error::into_inner to acknowledge io::Error::other) - rust-lang#132780 (use verbose for path separator suggestion) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#132757 - compiler-errors:yeet-check-wf, r=lcnr Get rid of `check_opaque_type_well_formed` Instead, replicate it by improving the span of the opaque in `check_opaque_meets_bounds`. This has two consequences: 1. We now prefer "concrete type differs" errors, since we'll hit those first before we check the opaque is WF. 2. Spans have gotten slightly worse. Specifically, (2.) could be improved by adding a new obligation cause that explains that the definition's environment has stronger assumptions than the declaration. r? lcnr
Get rid of `check_opaque_type_well_formed` Instead, replicate it by improving the span of the opaque in `check_opaque_meets_bounds`. This has two consequences: 1. We now prefer "concrete type differs" errors, since we'll hit those first before we check the opaque is WF. 2. Spans have gotten slightly worse. Specifically, (2.) could be improved by adding a new obligation cause that explains that the definition's environment has stronger assumptions than the declaration. r? lcnr
…kingjubilee Rollup of 5 pull requests Successful merges: - rust-lang#132755 (Do not reveal opaques in the param-env, we got lazy norm instead) - rust-lang#132757 (Get rid of `check_opaque_type_well_formed`) - rust-lang#132760 (Don't suggest `.into_iter()` on iterators) - rust-lang#132778 (update io::Error::into_inner to acknowledge io::Error::other) - rust-lang#132780 (use verbose for path separator suggestion) r? `@ghost` `@rustbot` modify labels: rollup
Instead, replicate it by improving the span of the opaque in
check_opaque_meets_bounds.This has two consequences:
Specifically, (2.) could be improved by adding a new obligation cause that explains that the definition's environment has stronger assumptions than the declaration.
r? lcnr