diff options
| author | Jacob Pratt <jacob@jhpratt.dev> | 2022-08-09 23:31:45 -0400 |
|---|---|---|
| committer | Jacob Pratt <jacob@jhpratt.dev> | 2022-08-09 23:31:45 -0400 |
| commit | be5672ecb2f9397bf9280c6a9d72fa0d6014993d (patch) | |
| tree | 1c6e4a5f71d81daf1c96d6d91cc591d3ca07475f /compiler/rustc_parse/src | |
| parent | 34a6cae28e7013ff0e640026a8e46f315426829d (diff) | |
| download | rust-be5672ecb2f9397bf9280c6a9d72fa0d6014993d.tar.gz rust-be5672ecb2f9397bf9280c6a9d72fa0d6014993d.zip | |
Stringify non-shorthand visibility correctly
Diffstat (limited to 'compiler/rustc_parse/src')
| -rw-r--r-- | compiler/rustc_parse/src/parser/mod.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs index 0c523ad22c2..c088b6e1e0e 100644 --- a/compiler/rustc_parse/src/parser/mod.rs +++ b/compiler/rustc_parse/src/parser/mod.rs @@ -1295,7 +1295,11 @@ impl<'a> Parser<'a> { self.bump(); // `in` let path = self.parse_path(PathStyle::Mod)?; // `path` self.expect(&token::CloseDelim(Delimiter::Parenthesis))?; // `)` - let vis = VisibilityKind::Restricted { path: P(path), id: ast::DUMMY_NODE_ID }; + let vis = VisibilityKind::Restricted { + path: P(path), + id: ast::DUMMY_NODE_ID, + shorthand: false, + }; return Ok(Visibility { span: lo.to(self.prev_token.span), kind: vis, @@ -1308,7 +1312,11 @@ impl<'a> Parser<'a> { self.bump(); // `(` let path = self.parse_path(PathStyle::Mod)?; // `crate`/`super`/`self` self.expect(&token::CloseDelim(Delimiter::Parenthesis))?; // `)` - let vis = VisibilityKind::Restricted { path: P(path), id: ast::DUMMY_NODE_ID }; + let vis = VisibilityKind::Restricted { + path: P(path), + id: ast::DUMMY_NODE_ID, + shorthand: true, + }; return Ok(Visibility { span: lo.to(self.prev_token.span), kind: vis, |
