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/librustc_parse/parser | |
| 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/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 16daefd1450..353f6607c1d 100644 --- a/src/librustc_parse/parser/diagnostics.rs +++ b/src/librustc_parse/parser/diagnostics.rs @@ -22,7 +22,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 229ca07f13b..271e5092018 100644 --- a/src/librustc_parse/parser/item.rs +++ b/src/librustc_parse/parser/item.rs @@ -1239,8 +1239,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)); @@ -1960,7 +1960,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) } @@ -2032,7 +2032,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. @@ -2044,23 +2044,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); @@ -2083,12 +2083,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 255e789b58e..16bc2e1a8d6 100644 --- a/src/librustc_parse/parser/mod.rs +++ b/src/librustc_parse/parser/mod.rs @@ -974,18 +974,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 593fb30bb75..33cac1aacee 100644 --- a/src/librustc_parse/parser/pat.rs +++ b/src/librustc_parse/parser/pat.rs @@ -325,7 +325,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() { @@ -539,7 +539,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. @@ -552,10 +552,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); @@ -986,10 +986,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 }) |
