-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Spurious error "The requirement ... is added only by the Drop impl" #34426
Labels
A-destructors
Area: Destructors (`Drop`, …)
C-feature-request
Category: A feature request, i.e: not implemented / a PR.
Comments
As an aside, the error message rephrased the bound to |
Mark-Simulacrum
added
the
C-feature-request
Category: A feature request, i.e: not implemented / a PR.
label
Jul 25, 2017
I'd be willing to try and tackle this issue! Is there anyone that would be able to do any mentoring? The attempts I've made to figure out the proper way of fixing this have resulted in me getting lost in the compiler's code, and I'm running out of stamina going at it alone. |
TommasoBianchi
added a commit
to TommasoBianchi/rust
that referenced
this issue
Dec 5, 2019
Centril
added a commit
to Centril/rust
that referenced
this issue
Dec 21, 2019
…felix Fix too restrictive checks on Drop impls Fixes rust-lang#34426. Fixes rust-lang#58311. This PR completes and extends rust-lang#59497 (which has been inactive for a while now). The problem generating both issues was that when checking that the `Predicate`s of the `Drop` impl are exactly the same as the ones of the struct definition, the check was essentially performed by a simple `==` operator, which was not handling correctly HRTBs and involved `Fn` types. The implemented solution relies on the `relate` machinery to more correctly equate `Predicate`s, and on `anonymize_late_bound_regions` to handle HRTB in a more general way. As the `Relate` trait currently is implemented only for `TraitPredicate` and `ProjectionPredicate` (and as they were the ones generating problems), `relate` is used only for them while for other `Predicate`s the equality check is kept. I'm currently considering whether it would make sense to implement the `Relate` trait also for all other `Predicate`s to render the proposed solution more general.
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-destructors
Area: Destructors (`Drop`, …)
C-feature-request
Category: A feature request, i.e: not implemented / a PR.
It seems like it's not possible to implement
Drop
for types that have higher ranked trait bounds on their type arguments.This gives the error "The requirement
for<'a> A: WithLifetime<'a>
is added only by the Drop impl" which is obviously untrue. Removing that bound from theDrop
impl gives the error "the trait boundfor<'a> A: WithLifetime<'a>
is not satisfied" as it should.The text was updated successfully, but these errors were encountered: