Skip to content

Commit d13e5c4

Browse files
And ImplPolarity too
1 parent 905f565 commit d13e5c4

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

compiler/rustc_middle/src/ty/mod.rs

-24
Original file line numberDiff line numberDiff line change
@@ -275,30 +275,6 @@ pub enum ImplSubject<'tcx> {
275275
Inherent(Ty<'tcx>),
276276
}
277277

278-
#[derive(Copy, Clone, PartialEq, Eq, Hash, TyEncodable, TyDecodable, HashStable, Debug)]
279-
#[derive(TypeFoldable, TypeVisitable)]
280-
pub enum ImplPolarity {
281-
/// `impl Trait for Type`
282-
Positive,
283-
/// `impl !Trait for Type`
284-
Negative,
285-
/// `#[rustc_reservation_impl] impl Trait for Type`
286-
///
287-
/// This is a "stability hack", not a real Rust feature.
288-
/// See #64631 for details.
289-
Reservation,
290-
}
291-
292-
impl fmt::Display for ImplPolarity {
293-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
294-
match self {
295-
Self::Positive => f.write_str("positive"),
296-
Self::Negative => f.write_str("negative"),
297-
Self::Reservation => f.write_str("reservation"),
298-
}
299-
}
300-
}
301-
302278
#[derive(Copy, Clone, PartialEq, Eq, Hash, TyEncodable, TyDecodable, HashStable, Debug)]
303279
#[derive(TypeFoldable, TypeVisitable)]
304280
pub enum Asyncness {

compiler/rustc_type_ir/src/predicate.rs

+24
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,30 @@ impl<I: Interner> fmt::Debug for TraitPredicate<I> {
115115
}
116116
}
117117

118+
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
119+
#[cfg_attr(feature = "nightly", derive(TyDecodable, TyEncodable, HashStable_NoContext))]
120+
pub enum ImplPolarity {
121+
/// `impl Trait for Type`
122+
Positive,
123+
/// `impl !Trait for Type`
124+
Negative,
125+
/// `#[rustc_reservation_impl] impl Trait for Type`
126+
///
127+
/// This is a "stability hack", not a real Rust feature.
128+
/// See #64631 for details.
129+
Reservation,
130+
}
131+
132+
impl fmt::Display for ImplPolarity {
133+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
134+
match self {
135+
Self::Positive => f.write_str("positive"),
136+
Self::Negative => f.write_str("negative"),
137+
Self::Reservation => f.write_str("reservation"),
138+
}
139+
}
140+
}
141+
118142
/// Polarity for a trait predicate. May either be negative or positive.
119143
/// Distinguished from [`ImplPolarity`] since we never compute goals with
120144
/// "reservation" level.

0 commit comments

Comments
 (0)