diff options
| author | Michael Goulet <michael@errs.io> | 2024-05-11 19:28:58 -0400 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-05-11 19:29:26 -0400 |
| commit | d13e5c483dcdfed9724d03dbb2c28827fda4c365 (patch) | |
| tree | 0fd735aa256a3621df0dfe7a9671bff02f2e8bd7 | |
| parent | 905f5658246ae2f108dee3620ace203c0d5286e1 (diff) | |
| download | rust-d13e5c483dcdfed9724d03dbb2c28827fda4c365.tar.gz rust-d13e5c483dcdfed9724d03dbb2c28827fda4c365.zip | |
And `ImplPolarity` too
| -rw-r--r-- | compiler/rustc_middle/src/ty/mod.rs | 24 | ||||
| -rw-r--r-- | compiler/rustc_type_ir/src/predicate.rs | 24 |
2 files changed, 24 insertions, 24 deletions
diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs index 2b0d8796968..4d3b92bf2af 100644 --- a/compiler/rustc_middle/src/ty/mod.rs +++ b/compiler/rustc_middle/src/ty/mod.rs @@ -277,30 +277,6 @@ pub enum ImplSubject<'tcx> { #[derive(Copy, Clone, PartialEq, Eq, Hash, TyEncodable, TyDecodable, HashStable, Debug)] #[derive(TypeFoldable, TypeVisitable)] -pub enum ImplPolarity { - /// `impl Trait for Type` - Positive, - /// `impl !Trait for Type` - Negative, - /// `#[rustc_reservation_impl] impl Trait for Type` - /// - /// This is a "stability hack", not a real Rust feature. - /// See #64631 for details. - Reservation, -} - -impl fmt::Display for ImplPolarity { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - Self::Positive => f.write_str("positive"), - Self::Negative => f.write_str("negative"), - Self::Reservation => f.write_str("reservation"), - } - } -} - -#[derive(Copy, Clone, PartialEq, Eq, Hash, TyEncodable, TyDecodable, HashStable, Debug)] -#[derive(TypeFoldable, TypeVisitable)] pub enum Asyncness { Yes, No, diff --git a/compiler/rustc_type_ir/src/predicate.rs b/compiler/rustc_type_ir/src/predicate.rs index b2510cb01df..f84f8f47c67 100644 --- a/compiler/rustc_type_ir/src/predicate.rs +++ b/compiler/rustc_type_ir/src/predicate.rs @@ -115,6 +115,30 @@ impl<I: Interner> fmt::Debug for TraitPredicate<I> { } } +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] +#[cfg_attr(feature = "nightly", derive(TyDecodable, TyEncodable, HashStable_NoContext))] +pub enum ImplPolarity { + /// `impl Trait for Type` + Positive, + /// `impl !Trait for Type` + Negative, + /// `#[rustc_reservation_impl] impl Trait for Type` + /// + /// This is a "stability hack", not a real Rust feature. + /// See #64631 for details. + Reservation, +} + +impl fmt::Display for ImplPolarity { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::Positive => f.write_str("positive"), + Self::Negative => f.write_str("negative"), + Self::Reservation => f.write_str("reservation"), + } + } +} + /// Polarity for a trait predicate. May either be negative or positive. /// Distinguished from [`ImplPolarity`] since we never compute goals with /// "reservation" level. |
