about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDrMeepster <19316085+DrMeepster@users.noreply.github.com>2022-01-14 21:01:20 -0800
committerMichael Goulet <michael@errs.io>2022-01-17 21:37:38 -0800
commitf9eb0b3b7ba13ea80733f418ac28e8988d60588d (patch)
tree8fb91dd7686c7f65d5236a1afcdf36c8f9424d0c
parentee5d8d37baaf5b5a81a98396952839c73ae41c68 (diff)
downloadrust-f9eb0b3b7ba13ea80733f418ac28e8988d60588d.tar.gz
rust-f9eb0b3b7ba13ea80733f418ac28e8988d60588d.zip
ignore constness when checking dtor predicates
-rw-r--r--compiler/rustc_typeck/src/check/dropck.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/compiler/rustc_typeck/src/check/dropck.rs b/compiler/rustc_typeck/src/check/dropck.rs
index c8986aa7f53..46610a0e08d 100644
--- a/compiler/rustc_typeck/src/check/dropck.rs
+++ b/compiler/rustc_typeck/src/check/dropck.rs
@@ -228,9 +228,15 @@ fn ensure_drop_predicates_are_implied_by_item_defn<'tcx>(
             let predicate = predicate.kind();
             let p = p.kind();
             match (predicate.skip_binder(), p.skip_binder()) {
-                (ty::PredicateKind::Trait(a), ty::PredicateKind::Trait(b)) => {
-                    relator.relate(predicate.rebind(a), p.rebind(b)).is_ok()
-                }
+                (ty::PredicateKind::Trait(a), ty::PredicateKind::Trait(b)) => relator
+                    .relate(
+                        predicate.rebind(ty::TraitPredicate {
+                            constness: ty::BoundConstness::NotConst,
+                            ..a
+                        }),
+                        p.rebind(b),
+                    )
+                    .is_ok(),
                 (ty::PredicateKind::Projection(a), ty::PredicateKind::Projection(b)) => {
                     relator.relate(predicate.rebind(a), p.rebind(b)).is_ok()
                 }