about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-04-25 21:06:34 +0200
committerGitHub <noreply@github.com>2023-04-25 21:06:34 +0200
commit95e9f68eb50cfdaa830b07b3d960a311e4a0e540 (patch)
treecbdea99a2b39fc3a006ee565697ee6b90c6488c5 /compiler/rustc_middle/src
parent94dfb3ba78e211ea2a650b7aaeff2b79e0235003 (diff)
parentbb2cb89ead84128441472ffec7e5c9174ce204e7 (diff)
downloadrust-95e9f68eb50cfdaa830b07b3d960a311e4a0e540.tar.gz
rust-95e9f68eb50cfdaa830b07b3d960a311e4a0e540.zip
Rollup merge of #110671 - compiler-errors:polarity, r=lcnr
Consider polarity in new solver

It's kinda ugly to have a polarity check in all of the builtin impls -- I guess I could consider the polarity at the top of assemble-builtin but that would require adding a polarity fn to `GoalKind`...

:shrug: putting this up just so i dont forget, since it's needed to bootstrap core during coherence (this alone does not allow core to bootstrap though, additional work is needed!)

r? ``@lcnr``
Diffstat (limited to 'compiler/rustc_middle/src')
-rw-r--r--compiler/rustc_middle/src/ty/mod.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs
index 7855749e586..8e4e708b73c 100644
--- a/compiler/rustc_middle/src/ty/mod.rs
+++ b/compiler/rustc_middle/src/ty/mod.rs
@@ -861,6 +861,11 @@ impl<'tcx> PolyTraitPredicate<'tcx> {
     pub fn is_const_if_const(self) -> bool {
         self.skip_binder().is_const_if_const()
     }
+
+    #[inline]
+    pub fn polarity(self) -> ImplPolarity {
+        self.skip_binder().polarity
+    }
 }
 
 /// `A: B`