@@ -34,6 +34,7 @@ use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
34
34
use rustc_span:: source_map:: { respan, Spanned } ;
35
35
use rustc_span:: symbol:: { kw, sym, Ident , Symbol } ;
36
36
use rustc_span:: { ErrorGuaranteed , Span , DUMMY_SP } ;
37
+ pub use rustc_type_ir:: { Movability , Mutability } ;
37
38
use std:: fmt;
38
39
use std:: mem;
39
40
use thin_vec:: { thin_vec, ThinVec } ;
@@ -800,57 +801,6 @@ pub enum PatKind {
800
801
MacCall ( P < MacCall > ) ,
801
802
}
802
803
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
-
854
804
/// The kind of borrow in an `AddrOf` expression,
855
805
/// e.g., `&place` or `&raw const place`.
856
806
#[ derive( Clone , Copy , PartialEq , Eq , Debug ) ]
@@ -1579,17 +1529,6 @@ pub enum CaptureBy {
1579
1529
Ref ,
1580
1530
}
1581
1531
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
-
1593
1532
/// Closure lifetime binder, `for<'a, 'b>` in `for<'a, 'b> |_: &'a (), _: &'b ()|`.
1594
1533
#[ derive( Clone , Encodable , Decodable , Debug ) ]
1595
1534
pub enum ClosureBinder {
0 commit comments