diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-04-21 15:29:58 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-04-21 15:29:58 +0300 |
| commit | 4eb94b44072697be70fc2a74ed9989e88f9cd70c (patch) | |
| tree | 876462433c27a3f8b34f94bb4a57bc753677b1b3 /src/libsyntax | |
| parent | 53ffcd96b7588669029467e5f23b699ff3283173 (diff) | |
| download | rust-4eb94b44072697be70fc2a74ed9989e88f9cd70c.tar.gz rust-4eb94b44072697be70fc2a74ed9989e88f9cd70c.zip | |
AST/HIR: Use `Mutability` instead of bool in foreign statics
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 5 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 2 |
3 files changed, 4 insertions, 5 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 0668730b3ef..a5472c622e6 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -2340,9 +2340,8 @@ pub struct ForeignItem { pub enum ForeignItemKind { /// A foreign function. Fn(P<FnDecl>, Generics), - /// A foreign static item (`static ext: u8`), with optional mutability. - /// (The boolean is `true` for mutable items). - Static(P<Ty>, bool), + /// A foreign static item (`static ext: u8`). + Static(P<Ty>, Mutability), /// A foreign type. Ty, /// A macro invocation. diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 29d2d2ad73d..233ea472e98 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -7683,7 +7683,7 @@ impl<'a> Parser<'a> { /// Assumes that the `static` keyword is already parsed. fn parse_item_foreign_static(&mut self, vis: ast::Visibility, lo: Span, attrs: Vec<Attribute>) -> PResult<'a, ForeignItem> { - let mutbl = self.eat_keyword(keywords::Mut); + let mutbl = self.parse_mutability(); let ident = self.parse_ident()?; self.expect(&token::Colon)?; let ty = self.parse_ty()?; diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index ca05ff71c94..d94e4762e67 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -1142,7 +1142,7 @@ impl<'a> State<'a> { } ast::ForeignItemKind::Static(ref t, m) => { self.head(visibility_qualified(&item.vis, "static"))?; - if m { + if m == ast::Mutability::Mutable { self.word_space("mut")?; } self.print_ident(item.ident)?; |
