diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-12-16 17:28:40 +0100 |
|---|---|---|
| committer | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-12-20 22:22:44 +0100 |
| commit | a7aec3f207fb40f0c4c857fb91a03372ac8bcd69 (patch) | |
| tree | e38449760063595a6d65b15f5beadbf8d76094d4 /src/librustc_parse/parser | |
| parent | 01a46509a4c2dc430ebebf940a26232fdaeeba81 (diff) | |
| download | rust-a7aec3f207fb40f0c4c857fb91a03372ac8bcd69.tar.gz rust-a7aec3f207fb40f0c4c857fb91a03372ac8bcd69.zip | |
1. ast::Mutability::{Mutable -> Mut, Immutable -> Not}.
2. mir::Mutability -> ast::Mutability.
Diffstat (limited to 'src/librustc_parse/parser')
| -rw-r--r-- | src/librustc_parse/parser/diagnostics.rs | 2 | ||||
| -rw-r--r-- | src/librustc_parse/parser/item.rs | 20 | ||||
| -rw-r--r-- | src/librustc_parse/parser/mod.rs | 8 | ||||
| -rw-r--r-- | src/librustc_parse/parser/pat.rs | 16 | ||||
| -rw-r--r-- | src/librustc_parse/parser/ty.rs | 2 |
5 files changed, 24 insertions, 24 deletions
diff --git a/src/librustc_parse/parser/diagnostics.rs b/src/librustc_parse/parser/diagnostics.rs index ba125cacab4..1f4a1dda170 100644 --- a/src/librustc_parse/parser/diagnostics.rs +++ b/src/librustc_parse/parser/diagnostics.rs @@ -23,7 +23,7 @@ const TURBOFISH: &'static str = "use `::<...>` instead of `<...>` to specify typ pub(super) fn dummy_arg(ident: Ident) -> Param { let pat = P(Pat { id: ast::DUMMY_NODE_ID, - kind: PatKind::Ident(BindingMode::ByValue(Mutability::Immutable), ident, None), + kind: PatKind::Ident(BindingMode::ByValue(Mutability::Not), ident, None), span: ident.span, }); let ty = Ty { diff --git a/src/librustc_parse/parser/item.rs b/src/librustc_parse/parser/item.rs index 0840a1551db..544760a4e10 100644 --- a/src/librustc_parse/parser/item.rs +++ b/src/librustc_parse/parser/item.rs @@ -1240,8 +1240,8 @@ impl<'a> Parser<'a> { // Construct the error and stash it away with the hope // that typeck will later enrich the error with a type. let kind = match m { - Some(Mutability::Mutable) => "static mut", - Some(Mutability::Immutable) => "static", + Some(Mutability::Mut) => "static mut", + Some(Mutability::Not) => "static", None => "const", }; let mut err = self.struct_span_err(id.span, &format!("missing type for `{}` item", kind)); @@ -1961,7 +1961,7 @@ impl<'a> Parser<'a> { match ty { Ok(ty) => { let ident = Ident::new(kw::Invalid, self.prev_span); - let bm = BindingMode::ByValue(Mutability::Immutable); + let bm = BindingMode::ByValue(Mutability::Not); let pat = self.mk_pat_ident(ty.span, bm, ident); (pat, ty) } @@ -2033,7 +2033,7 @@ impl<'a> Parser<'a> { .span_label(span, msg) .emit(); - Ok((SelfKind::Value(Mutability::Immutable), expect_self_ident(this), this.prev_span)) + Ok((SelfKind::Value(Mutability::Not), expect_self_ident(this), this.prev_span)) }; // Parse optional `self` parameter of a method. @@ -2045,23 +2045,23 @@ impl<'a> Parser<'a> { let eself = if is_isolated_self(self, 1) { // `&self` self.bump(); - SelfKind::Region(None, Mutability::Immutable) + SelfKind::Region(None, Mutability::Not) } else if is_isolated_mut_self(self, 1) { // `&mut self` self.bump(); self.bump(); - SelfKind::Region(None, Mutability::Mutable) + SelfKind::Region(None, Mutability::Mut) } else if self.look_ahead(1, |t| t.is_lifetime()) && is_isolated_self(self, 2) { // `&'lt self` self.bump(); let lt = self.expect_lifetime(); - SelfKind::Region(Some(lt), Mutability::Immutable) + SelfKind::Region(Some(lt), Mutability::Not) } else if self.look_ahead(1, |t| t.is_lifetime()) && is_isolated_mut_self(self, 2) { // `&'lt mut self` self.bump(); let lt = self.expect_lifetime(); self.bump(); - SelfKind::Region(Some(lt), Mutability::Mutable) + SelfKind::Region(Some(lt), Mutability::Mut) } else { // `¬_self` return Ok(None); @@ -2084,12 +2084,12 @@ impl<'a> Parser<'a> { } // `self` and `self: TYPE` token::Ident(..) if is_isolated_self(self, 0) => { - parse_self_possibly_typed(self, Mutability::Immutable)? + parse_self_possibly_typed(self, Mutability::Not)? } // `mut self` and `mut self: TYPE` token::Ident(..) if is_isolated_mut_self(self, 0) => { self.bump(); - parse_self_possibly_typed(self, Mutability::Mutable)? + parse_self_possibly_typed(self, Mutability::Mut)? } _ => return Ok(None), }; diff --git a/src/librustc_parse/parser/mod.rs b/src/librustc_parse/parser/mod.rs index 07e99cfe012..c584f378b87 100644 --- a/src/librustc_parse/parser/mod.rs +++ b/src/librustc_parse/parser/mod.rs @@ -979,18 +979,18 @@ impl<'a> Parser<'a> { /// Parses mutability (`mut` or nothing). fn parse_mutability(&mut self) -> Mutability { if self.eat_keyword(kw::Mut) { - Mutability::Mutable + Mutability::Mut } else { - Mutability::Immutable + Mutability::Not } } /// Possibly parses mutability (`const` or `mut`). fn parse_const_or_mut(&mut self) -> Option<Mutability> { if self.eat_keyword(kw::Mut) { - Some(Mutability::Mutable) + Some(Mutability::Mut) } else if self.eat_keyword(kw::Const) { - Some(Mutability::Immutable) + Some(Mutability::Not) } else { None } diff --git a/src/librustc_parse/parser/pat.rs b/src/librustc_parse/parser/pat.rs index 117b92dc9a5..21fa8b54396 100644 --- a/src/librustc_parse/parser/pat.rs +++ b/src/librustc_parse/parser/pat.rs @@ -326,7 +326,7 @@ impl<'a> Parser<'a> { // Parse `ident @ pat` // This can give false positives and parse nullary enums, // they are dealt with later in resolve. - self.parse_pat_ident(BindingMode::ByValue(Mutability::Immutable))? + self.parse_pat_ident(BindingMode::ByValue(Mutability::Not))? } else if self.is_start_of_pat_with_path() { // Parse pattern starting with a path let (qself, path) = if self.eat_lt() { @@ -540,7 +540,7 @@ impl<'a> Parser<'a> { ) .emit(); - self.parse_pat_ident(BindingMode::ByRef(Mutability::Mutable)) + self.parse_pat_ident(BindingMode::ByRef(Mutability::Mut)) } /// Turn all by-value immutable bindings in a pattern into mutable bindings. @@ -553,10 +553,10 @@ impl<'a> Parser<'a> { } fn visit_pat(&mut self, pat: &mut P<Pat>) { - if let PatKind::Ident(BindingMode::ByValue(ref mut m @ Mutability::Immutable), ..) + if let PatKind::Ident(BindingMode::ByValue(ref mut m @ Mutability::Not), ..) = pat.kind { - *m = Mutability::Mutable; + *m = Mutability::Mut; self.0 = true; } noop_visit_pat(pat, self); @@ -987,10 +987,10 @@ impl<'a> Parser<'a> { hi = self.prev_span; let bind_type = match (is_ref, is_mut) { - (true, true) => BindingMode::ByRef(Mutability::Mutable), - (true, false) => BindingMode::ByRef(Mutability::Immutable), - (false, true) => BindingMode::ByValue(Mutability::Mutable), - (false, false) => BindingMode::ByValue(Mutability::Immutable), + (true, true) => BindingMode::ByRef(Mutability::Mut), + (true, false) => BindingMode::ByRef(Mutability::Not), + (false, true) => BindingMode::ByValue(Mutability::Mut), + (false, false) => BindingMode::ByValue(Mutability::Not), }; let fieldpat = self.mk_pat_ident(boxed_span.to(hi), bind_type, fieldname); diff --git a/src/librustc_parse/parser/ty.rs b/src/librustc_parse/parser/ty.rs index 6f7ab0542d5..86692610324 100644 --- a/src/librustc_parse/parser/ty.rs +++ b/src/librustc_parse/parser/ty.rs @@ -261,7 +261,7 @@ impl<'a> Parser<'a> { .span_label(span, msg) .help("use `*mut T` or `*const T` as appropriate") .emit(); - Mutability::Immutable + Mutability::Not }); let t = self.parse_ty_no_plus()?; Ok(MutTy { ty: t, mutbl }) |
