auto merge of #19044 : murarth/rust/libsyntax-view-item, r=alexcrichton
Allows parsing view items (`use` and `extern crate`) individually. Does not change behavior of any existing functions. Closes #19024
This commit is contained in:
@@ -5620,6 +5620,14 @@ impl<'a> Parser<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Parse a ViewItem, e.g. `use foo::bar` or `extern crate foo`
|
||||
pub fn parse_view_item(&mut self, attrs: Vec<Attribute>) -> ViewItem {
|
||||
match self.parse_item_or_view_item(attrs, false) {
|
||||
IoviViewItem(vi) => vi,
|
||||
_ => self.fatal("expected `use` or `extern crate`"),
|
||||
}
|
||||
}
|
||||
|
||||
/// Parse, e.g., "use a::b::{z,y}"
|
||||
fn parse_use(&mut self) -> ViewItem_ {
|
||||
return ViewItemUse(self.parse_view_path());
|
||||
|
||||
Reference in New Issue
Block a user