diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-12-21 15:29:42 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-12-21 15:29:42 +0100 |
| commit | c0bf3afc96246ddefd3bcecc77c62bed1f00f14e (patch) | |
| tree | 08c77e36e090a85f5d9693b605bb74b145457984 /src/libsyntax | |
| parent | 1113eb5cc07f19eab34fa7984f08a4ba9fd2c987 (diff) | |
| parent | 6d7c6d7384233b58ba98090797f7c45b8040a68d (diff) | |
| download | rust-c0bf3afc96246ddefd3bcecc77c62bed1f00f14e.tar.gz rust-c0bf3afc96246ddefd3bcecc77c62bed1f00f14e.zip | |
Rollup merge of #67355 - Centril:merge-mut, r=oli-obk
Merge `ast::Mutability` and `mir::Mutability` r? @oli-obk
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 20 | ||||
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 14 |
2 files changed, 17 insertions, 17 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index c1458236788..aa38a8135ce 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -509,7 +509,7 @@ impl Pat { // In a type expression `_` is an inference variable. PatKind::Wild => TyKind::Infer, // An IDENT pattern with no binding mode would be valid as path to a type. E.g. `u32`. - PatKind::Ident(BindingMode::ByValue(Mutability::Immutable), ident, None) => { + PatKind::Ident(BindingMode::ByValue(Mutability::Not), ident, None) => { TyKind::Path(None, Path::from_ident(*ident)) } PatKind::Path(qself, path) => TyKind::Path(qself.clone(), path.clone()), @@ -695,30 +695,30 @@ pub enum PatKind { #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable, Debug, Copy, HashStable_Generic)] pub enum Mutability { - Mutable, - Immutable, + Mut, + Not, } impl Mutability { /// Returns `MutMutable` only if both `self` and `other` are mutable. pub fn and(self, other: Self) -> Self { match self { - Mutability::Mutable => other, - Mutability::Immutable => Mutability::Immutable, + Mutability::Mut => other, + Mutability::Not => Mutability::Not, } } pub fn invert(self) -> Self { match self { - Mutability::Mutable => Mutability::Immutable, - Mutability::Immutable => Mutability::Mutable, + Mutability::Mut => Mutability::Not, + Mutability::Not => Mutability::Mut, } } pub fn prefix_str(&self) -> &'static str { match self { - Mutability::Mutable => "mut ", - Mutability::Immutable => "", + Mutability::Mut => "mut ", + Mutability::Not => "", } } } @@ -2037,7 +2037,7 @@ impl Param { SelfKind::Explicit(ty, mutbl) => param(mutbl, ty), SelfKind::Value(mutbl) => param(mutbl, infer_ty), SelfKind::Region(lt, mutbl) => param( - Mutability::Immutable, + Mutability::Not, P(Ty { id: DUMMY_NODE_ID, kind: TyKind::Rptr( diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 87f6ae85b69..e63d11ce832 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -1071,7 +1071,7 @@ impl<'a> State<'a> { } ast::ForeignItemKind::Static(ref t, m) => { self.head(visibility_qualified(&item.vis, "static")); - if m == ast::Mutability::Mutable { + if m == ast::Mutability::Mut { self.word_space("mut"); } self.print_ident(item.ident); @@ -1162,7 +1162,7 @@ impl<'a> State<'a> { } ast::ItemKind::Static(ref ty, m, ref expr) => { self.head(visibility_qualified(&item.vis, "static")); - if m == ast::Mutability::Mutable { + if m == ast::Mutability::Mut { self.word_space("mut"); } self.print_ident(item.ident); @@ -2302,8 +2302,8 @@ impl<'a> State<'a> { self.word_nbsp("ref"); self.print_mutability(mutbl, false); } - ast::BindingMode::ByValue(ast::Mutability::Immutable) => {} - ast::BindingMode::ByValue(ast::Mutability::Mutable) => { + ast::BindingMode::ByValue(ast::Mutability::Not) => {} + ast::BindingMode::ByValue(ast::Mutability::Mut) => { self.word_nbsp("mut"); } } @@ -2366,7 +2366,7 @@ impl<'a> State<'a> { } PatKind::Ref(ref inner, mutbl) => { self.s.word("&"); - if mutbl == ast::Mutability::Mutable { + if mutbl == ast::Mutability::Mut { self.s.word("mut "); } self.print_pat(inner); @@ -2667,8 +2667,8 @@ impl<'a> State<'a> { pub fn print_mutability(&mut self, mutbl: ast::Mutability, print_const: bool) { match mutbl { - ast::Mutability::Mutable => self.word_nbsp("mut"), - ast::Mutability::Immutable => if print_const { self.word_nbsp("const"); }, + ast::Mutability::Mut => self.word_nbsp("mut"), + ast::Mutability::Not => if print_const { self.word_nbsp("const"); }, } } |
