about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection
diff options
context:
space:
mode:
authorSantiago Pastorino <spastorino@gmail.com>2021-10-20 18:05:06 -0300
committerSantiago Pastorino <spastorino@gmail.com>2021-10-20 18:05:06 -0300
commit5a727538f8aeff650b48f7d23a12cef84b549e01 (patch)
treea8f84a50c3962043982801fe294a5ffc0ce8687f /compiler/rustc_trait_selection
parent68d444ffa19fa5feda8550a4a8d4dfb2f1da04b6 (diff)
Fix allow_negative_impls logic
Diffstat (limited to 'compiler/rustc_trait_selection')
-rw-r--r--compiler/rustc_trait_selection/src/traits/select/mod.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs
index 77763188054..94c4bc55f79 100644
--- a/compiler/rustc_trait_selection/src/traits/select/mod.rs
+++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs
@@ -1129,8 +1129,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
         candidates.retain(|candidate| {
             if let ImplCandidate(def_id) = candidate {
                 ty::ImplPolarity::Reservation == tcx.impl_polarity(*def_id)
-                    || !self.allow_negative_impls
-                        && stack.obligation.polarity() == tcx.impl_polarity(*def_id)
+                    || stack.obligation.polarity() == tcx.impl_polarity(*def_id)
+                    || self.allow_negative_impls
             } else {
                 true
             }