From 5a727538f8aeff650b48f7d23a12cef84b549e01 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Wed, 20 Oct 2021 18:05:06 -0300 Subject: [PATCH] Fix allow_negative_impls logic --- compiler/rustc_trait_selection/src/traits/select/mod.rs | 4 ++-- 1 file 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 }