about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty/predicate.rs
diff options
context:
space:
mode:
authorOli Scherer <github35764891676564198441@oli-obk.de>2024-02-14 11:53:38 +0100
committerGitHub <noreply@github.com>2024-02-14 11:53:38 +0100
commitcc54612ac33fc858e19e85eb9d76b6ece83c25e7 (patch)
tree6f1a53cfd9ae9483228739d0aee8fc0250c1f9f6 /compiler/rustc_middle/src/ty/predicate.rs
parent407de0ee3354d0cfcdb903f9715f942750e4cb41 (diff)
parent7e80867f3c270f360a64294e421d4a9b010e28f8 (diff)
downloadrust-cc54612ac33fc858e19e85eb9d76b6ece83c25e7.tar.gz
rust-cc54612ac33fc858e19e85eb9d76b6ece83c25e7.zip
Rollup merge of #120498 - compiler-errors:type-flags, r=lcnr
Uplift `TypeVisitableExt` into `rustc_type_ir`

This uplifts `TypeVisitableExt` into `rustc_type_ir` so it can be used in an interner-agnostic way. It also moves some `TypeSuperVisitable` bounds onto `Interner` since we don't expect to support libraries that have types which aren't foldable by default.

This restores a couple of asserts in the canonicalizer code we uplifted, and also makes it so that we can use type-flags-based helpers in the solver code, which I'm interested in uplifting.

r? lcnr
Diffstat (limited to 'compiler/rustc_middle/src/ty/predicate.rs')
-rw-r--r--compiler/rustc_middle/src/ty/predicate.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/ty/predicate.rs b/compiler/rustc_middle/src/ty/predicate.rs
index 200811940ed..b63f9c6dfa0 100644
--- a/compiler/rustc_middle/src/ty/predicate.rs
+++ b/compiler/rustc_middle/src/ty/predicate.rs
@@ -29,6 +29,16 @@ pub struct Predicate<'tcx>(
     pub(super) Interned<'tcx, WithCachedTypeInfo<ty::Binder<'tcx, PredicateKind<'tcx>>>>,
 );
 
+impl<'tcx> rustc_type_ir::visit::Flags for Predicate<'tcx> {
+    fn flags(&self) -> TypeFlags {
+        self.0.flags
+    }
+
+    fn outer_exclusive_binder(&self) -> ty::DebruijnIndex {
+        self.0.outer_exclusive_binder
+    }
+}
+
 impl<'tcx> Predicate<'tcx> {
     /// Gets the inner `ty::Binder<'tcx, PredicateKind<'tcx>>`.
     #[inline]
@@ -36,11 +46,13 @@ impl<'tcx> Predicate<'tcx> {
         self.0.internee
     }
 
+    // FIXME(compiler-errors): Think about removing this.
     #[inline(always)]
     pub fn flags(self) -> TypeFlags {
         self.0.flags
     }
 
+    // FIXME(compiler-errors): Think about removing this.
     #[inline(always)]
     pub fn outer_exclusive_binder(self) -> DebruijnIndex {
         self.0.outer_exclusive_binder