]> git.lizzy.rs Git - rust.git/commit - src/tools/clippy
Rollup merge of #67059 - TommasoBianchi:dropck_fix_pr, r=pnkfelix
authorMazdak Farrokhzad <twingoow@gmail.com>
Sat, 21 Dec 2019 14:29:40 +0000 (15:29 +0100)
committerGitHub <noreply@github.com>
Sat, 21 Dec 2019 14:29:40 +0000 (15:29 +0100)
commit1113eb5cc07f19eab34fa7984f08a4ba9fd2c987
treefa2b0cd93202f26c9fe26bd435edca5f95c34607
parentc64eecf4d0907095928fb36fd3a1dd5fb2d9ff06
parentb08d697236b236e96b0e8e6894e05aefe5a11b39
Rollup merge of #67059 - TommasoBianchi:dropck_fix_pr, r=pnkfelix

Fix too restrictive checks on Drop impls

Fixes #34426. Fixes #58311.

This PR completes and extends #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.
src/librustc_typeck/check/dropck.rs