Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
12 changes: 9 additions & 3 deletions src/test/run-pass/import-glob-crate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.


#![allow(dead_assignment)]

use std::mem::*;

pub fn main() {
Expand All @@ -20,3 +17,12 @@ pub fn main() {
assert_eq!(x, 2);
assert_eq!(y, 1);
}

#[allow(unused)]
fn f() {
mod foo { pub use *; }
mod bar { pub use ::*; }

foo::main();
bar::main();
}