@@ -34,6 +34,7 @@ use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
3434use rustc_span:: source_map:: { respan, Spanned } ;
3535use rustc_span:: symbol:: { kw, sym, Ident , Symbol } ;
3636use rustc_span:: { ErrorGuaranteed , Span , DUMMY_SP } ;
37+ pub use rustc_type_ir:: { Movability , Mutability } ;
3738use std:: fmt;
3839use std:: mem;
3940use thin_vec:: { thin_vec, ThinVec } ;
@@ -800,57 +801,6 @@ pub enum PatKind {
800801 MacCall ( P < MacCall > ) ,
801802}
802803
803- #[ derive( Clone , PartialEq , Eq , PartialOrd , Ord , Hash , Debug , Copy ) ]
804- #[ derive( HashStable_Generic , Encodable , Decodable ) ]
805- pub enum Mutability {
806- // N.B. Order is deliberate, so that Not < Mut
807- Not ,
808- Mut ,
809- }
810-
811- impl Mutability {
812- pub fn invert ( self ) -> Self {
813- match self {
814- Mutability :: Mut => Mutability :: Not ,
815- Mutability :: Not => Mutability :: Mut ,
816- }
817- }
818-
819- /// Returns `""` (empty string) or `"mut "` depending on the mutability.
820- pub fn prefix_str ( self ) -> & ' static str {
821- match self {
822- Mutability :: Mut => "mut " ,
823- Mutability :: Not => "" ,
824- }
825- }
826-
827- /// Returns `"&"` or `"&mut "` depending on the mutability.
828- pub fn ref_prefix_str ( self ) -> & ' static str {
829- match self {
830- Mutability :: Not => "&" ,
831- Mutability :: Mut => "&mut " ,
832- }
833- }
834-
835- /// Returns `""` (empty string) or `"mutably "` depending on the mutability.
836- pub fn mutably_str ( self ) -> & ' static str {
837- match self {
838- Mutability :: Not => "" ,
839- Mutability :: Mut => "mutably " ,
840- }
841- }
842-
843- /// Return `true` if self is mutable
844- pub fn is_mut ( self ) -> bool {
845- matches ! ( self , Self :: Mut )
846- }
847-
848- /// Return `true` if self is **not** mutable
849- pub fn is_not ( self ) -> bool {
850- matches ! ( self , Self :: Not )
851- }
852- }
853-
854804/// The kind of borrow in an `AddrOf` expression,
855805/// e.g., `&place` or `&raw const place`.
856806#[ derive( Clone , Copy , PartialEq , Eq , Debug ) ]
@@ -1579,17 +1529,6 @@ pub enum CaptureBy {
15791529 Ref ,
15801530}
15811531
1582- /// The movability of a generator / closure literal:
1583- /// whether a generator contains self-references, causing it to be `!Unpin`.
1584- #[ derive( Clone , PartialEq , Eq , PartialOrd , Ord , Hash , Encodable , Decodable , Debug , Copy ) ]
1585- #[ derive( HashStable_Generic ) ]
1586- pub enum Movability {
1587- /// May contain self-references, `!Unpin`.
1588- Static ,
1589- /// Must not contain self-references, `Unpin`.
1590- Movable ,
1591- }
1592-
15931532/// Closure lifetime binder, `for<'a, 'b>` in `for<'a, 'b> |_: &'a (), _: &'b ()|`.
15941533#[ derive( Clone , Encodable , Decodable , Debug ) ]
15951534pub enum ClosureBinder {
0 commit comments