diff options
| author | Jeffrey Seyfried <jeffrey.seyfried@gmail.com> | 2016-10-23 21:43:41 +0000 |
|---|---|---|
| committer | Jeffrey Seyfried <jeffrey.seyfried@gmail.com> | 2016-10-23 22:02:39 +0000 |
| commit | 4a9364868949a5390d85d26af4d6562bc4a18fb3 (patch) | |
| tree | 415b97589fad7e896ff7398bd5d2cf7cebefc689 /src/libsyntax/parse/parser.rs | |
| parent | 4845adde360c306624faa3305ea95f95cd11e2b4 (diff) | |
| download | rust-4a9364868949a5390d85d26af4d6562bc4a18fb3.tar.gz rust-4a9364868949a5390d85d26af4d6562bc4a18fb3.zip | |
Support `use *;` and `use ::*;`.
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 463ec334cc5..cd62ecd4e97 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -6113,15 +6113,20 @@ impl<'a> Parser<'a> { /// MOD_SEP? LBRACE item_seq RBRACE fn parse_view_path(&mut self) -> PResult<'a, P<ViewPath>> { let lo = self.span.lo; - if self.check(&token::OpenDelim(token::Brace)) || self.is_import_coupler() { - // `{foo, bar}` or `::{foo, bar}` + if self.check(&token::OpenDelim(token::Brace)) || self.check(&token::BinOp(token::Star)) || + self.is_import_coupler() { + // `{foo, bar}`, `::{foo, bar}`, `*`, or `::*`. let prefix = ast::Path { global: self.eat(&token::ModSep), segments: Vec::new(), span: mk_sp(lo, self.span.hi), }; - let items = self.parse_path_list_items()?; - Ok(P(spanned(lo, self.span.hi, ViewPathList(prefix, items)))) + let view_path_kind = if self.eat(&token::BinOp(token::Star)) { + ViewPathGlob(prefix) + } else { + ViewPathList(prefix, self.parse_path_list_items()?) + }; + Ok(P(spanned(lo, self.span.hi, view_path_kind))) } else { let prefix = self.parse_path(PathStyle::Mod)?; if self.is_import_coupler() { |
