[breaking-change] don't glob export ast::PathListItem_ variants
This commit is contained in:
parent
8b3856b1bc
commit
2b816b0d6a
@ -211,24 +211,7 @@ pub fn lower_view_path(lctx: &LoweringContext, view_path: &ViewPath) -> P<hir::V
|
|||||||
ViewPathList(ref path, ref path_list_idents) => {
|
ViewPathList(ref path, ref path_list_idents) => {
|
||||||
hir::ViewPathList(lower_path(lctx, path),
|
hir::ViewPathList(lower_path(lctx, path),
|
||||||
path_list_idents.iter()
|
path_list_idents.iter()
|
||||||
.map(|path_list_ident| {
|
.map(lower_path_list_item)
|
||||||
Spanned {
|
|
||||||
node: match path_list_ident.node {
|
|
||||||
PathListIdent { id, name, rename } =>
|
|
||||||
hir::PathListIdent {
|
|
||||||
id: id,
|
|
||||||
name: name.name,
|
|
||||||
rename: rename.map(|x| x.name),
|
|
||||||
},
|
|
||||||
PathListMod { id, rename } =>
|
|
||||||
hir::PathListMod {
|
|
||||||
id: id,
|
|
||||||
rename: rename.map(|x| x.name),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
span: path_list_ident.span,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.collect())
|
.collect())
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -236,6 +219,23 @@ pub fn lower_view_path(lctx: &LoweringContext, view_path: &ViewPath) -> P<hir::V
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn lower_path_list_item(path_list_ident: &PathListItem) -> hir::PathListItem {
|
||||||
|
Spanned {
|
||||||
|
node: match path_list_ident.node {
|
||||||
|
PathListItemKind::Ident { id, name, rename } => hir::PathListIdent {
|
||||||
|
id: id,
|
||||||
|
name: name.name,
|
||||||
|
rename: rename.map(|x| x.name),
|
||||||
|
},
|
||||||
|
PathListItemKind::Mod { id, rename } => hir::PathListMod {
|
||||||
|
id: id,
|
||||||
|
rename: rename.map(|x| x.name),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
span: path_list_ident.span,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn lower_arm(lctx: &LoweringContext, arm: &Arm) -> hir::Arm {
|
pub fn lower_arm(lctx: &LoweringContext, arm: &Arm) -> hir::Arm {
|
||||||
hir::Arm {
|
hir::Arm {
|
||||||
attrs: lower_attrs(lctx, &arm.attrs),
|
attrs: lower_attrs(lctx, &arm.attrs),
|
||||||
|
@ -928,7 +928,7 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> {
|
|||||||
ast::ViewPathList(ref path, ref list) => {
|
ast::ViewPathList(ref path, ref list) => {
|
||||||
for plid in list {
|
for plid in list {
|
||||||
match plid.node {
|
match plid.node {
|
||||||
ast::PathListIdent { id, .. } => {
|
ast::PathListItemKind::Ident { id, .. } => {
|
||||||
match self.lookup_type_ref(id) {
|
match self.lookup_type_ref(id) {
|
||||||
Some(def_id) => match self.lookup_def_kind(id, plid.span) {
|
Some(def_id) => match self.lookup_def_kind(id, plid.span) {
|
||||||
Some(kind) => {
|
Some(kind) => {
|
||||||
@ -943,7 +943,7 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> {
|
|||||||
None => (),
|
None => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ast::PathListMod { .. } => (),
|
ast::PathListItemKind::Mod { .. } => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
// The Rust abstract syntax tree.
|
// The Rust abstract syntax tree.
|
||||||
|
|
||||||
pub use self::Pat_::*;
|
pub use self::Pat_::*;
|
||||||
pub use self::PathListItem_::*;
|
|
||||||
pub use self::StructFieldKind::*;
|
pub use self::StructFieldKind::*;
|
||||||
pub use self::TyParamBound::*;
|
pub use self::TyParamBound::*;
|
||||||
pub use self::UnsafeSource::*;
|
pub use self::UnsafeSource::*;
|
||||||
@ -1737,42 +1736,42 @@ pub struct Variant_ {
|
|||||||
pub type Variant = Spanned<Variant_>;
|
pub type Variant = Spanned<Variant_>;
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
|
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
|
||||||
pub enum PathListItem_ {
|
pub enum PathListItemKind {
|
||||||
PathListIdent {
|
Ident {
|
||||||
name: Ident,
|
name: Ident,
|
||||||
/// renamed in list, eg `use foo::{bar as baz};`
|
/// renamed in list, eg `use foo::{bar as baz};`
|
||||||
rename: Option<Ident>,
|
rename: Option<Ident>,
|
||||||
id: NodeId
|
id: NodeId
|
||||||
},
|
},
|
||||||
PathListMod {
|
Mod {
|
||||||
/// renamed in list, eg `use foo::{self as baz};`
|
/// renamed in list, eg `use foo::{self as baz};`
|
||||||
rename: Option<Ident>,
|
rename: Option<Ident>,
|
||||||
id: NodeId
|
id: NodeId
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PathListItem_ {
|
impl PathListItemKind {
|
||||||
pub fn id(&self) -> NodeId {
|
pub fn id(&self) -> NodeId {
|
||||||
match *self {
|
match *self {
|
||||||
PathListIdent { id, .. } | PathListMod { id, .. } => id
|
PathListItemKind::Ident { id, .. } | PathListItemKind::Mod { id, .. } => id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name(&self) -> Option<Ident> {
|
pub fn name(&self) -> Option<Ident> {
|
||||||
match *self {
|
match *self {
|
||||||
PathListIdent { name, .. } => Some(name),
|
PathListItemKind::Ident { name, .. } => Some(name),
|
||||||
PathListMod { .. } => None,
|
PathListItemKind::Mod { .. } => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn rename(&self) -> Option<Ident> {
|
pub fn rename(&self) -> Option<Ident> {
|
||||||
match *self {
|
match *self {
|
||||||
PathListIdent { rename, .. } | PathListMod { rename, .. } => rename
|
PathListItemKind::Ident { rename, .. } | PathListItemKind::Mod { rename, .. } => rename
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type PathListItem = Spanned<PathListItem_>;
|
pub type PathListItem = Spanned<PathListItemKind>;
|
||||||
|
|
||||||
pub type ViewPath = Spanned<ViewPath_>;
|
pub type ViewPath = Spanned<ViewPath_>;
|
||||||
|
|
||||||
|
@ -1150,7 +1150,12 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
|
|||||||
fn item_use_list(&self, sp: Span, vis: ast::Visibility,
|
fn item_use_list(&self, sp: Span, vis: ast::Visibility,
|
||||||
path: Vec<ast::Ident>, imports: &[ast::Ident]) -> P<ast::Item> {
|
path: Vec<ast::Ident>, imports: &[ast::Ident]) -> P<ast::Item> {
|
||||||
let imports = imports.iter().map(|id| {
|
let imports = imports.iter().map(|id| {
|
||||||
respan(sp, ast::PathListIdent { name: *id, rename: None, id: ast::DUMMY_NODE_ID })
|
let item = ast::PathListItemKind::Ident {
|
||||||
|
name: *id,
|
||||||
|
rename: None,
|
||||||
|
id: ast::DUMMY_NODE_ID,
|
||||||
|
};
|
||||||
|
respan(sp, item)
|
||||||
}).collect();
|
}).collect();
|
||||||
|
|
||||||
self.item_use(sp, vis,
|
self.item_use(sp, vis,
|
||||||
|
@ -316,14 +316,14 @@ pub fn noop_fold_view_path<T: Folder>(view_path: P<ViewPath>, fld: &mut T) -> P<
|
|||||||
path_list_idents.move_map(|path_list_ident| {
|
path_list_idents.move_map(|path_list_ident| {
|
||||||
Spanned {
|
Spanned {
|
||||||
node: match path_list_ident.node {
|
node: match path_list_ident.node {
|
||||||
PathListIdent { id, name, rename } =>
|
PathListItemKind::Ident { id, name, rename } =>
|
||||||
PathListIdent {
|
PathListItemKind::Ident {
|
||||||
id: fld.new_id(id),
|
id: fld.new_id(id),
|
||||||
rename: rename,
|
rename: rename,
|
||||||
name: name
|
name: name
|
||||||
},
|
},
|
||||||
PathListMod { id, rename } =>
|
PathListItemKind::Mod { id, rename } =>
|
||||||
PathListMod {
|
PathListItemKind::Mod {
|
||||||
id: fld.new_id(id),
|
id: fld.new_id(id),
|
||||||
rename: rename
|
rename: rename
|
||||||
}
|
}
|
||||||
|
@ -574,11 +574,11 @@ impl<'a> Parser<'a> {
|
|||||||
let lo = self.span.lo;
|
let lo = self.span.lo;
|
||||||
let node = if self.eat_keyword(keywords::SelfValue) {
|
let node = if self.eat_keyword(keywords::SelfValue) {
|
||||||
let rename = try!(self.parse_rename());
|
let rename = try!(self.parse_rename());
|
||||||
ast::PathListMod { id: ast::DUMMY_NODE_ID, rename: rename }
|
ast::PathListItemKind::Mod { id: ast::DUMMY_NODE_ID, rename: rename }
|
||||||
} else {
|
} else {
|
||||||
let ident = try!(self.parse_ident());
|
let ident = try!(self.parse_ident());
|
||||||
let rename = try!(self.parse_rename());
|
let rename = try!(self.parse_rename());
|
||||||
ast::PathListIdent { name: ident, rename: rename, id: ast::DUMMY_NODE_ID }
|
ast::PathListItemKind::Ident { name: ident, rename: rename, id: ast::DUMMY_NODE_ID }
|
||||||
};
|
};
|
||||||
let hi = self.last_span.hi;
|
let hi = self.last_span.hi;
|
||||||
Ok(spanned(lo, hi, node))
|
Ok(spanned(lo, hi, node))
|
||||||
|
@ -2918,7 +2918,7 @@ impl<'a> State<'a> {
|
|||||||
}
|
}
|
||||||
try!(self.commasep(Inconsistent, &idents[..], |s, w| {
|
try!(self.commasep(Inconsistent, &idents[..], |s, w| {
|
||||||
match w.node {
|
match w.node {
|
||||||
ast::PathListIdent { name, rename, .. } => {
|
ast::PathListItemKind::Ident { name, rename, .. } => {
|
||||||
try!(s.print_ident(name));
|
try!(s.print_ident(name));
|
||||||
if let Some(ident) = rename {
|
if let Some(ident) = rename {
|
||||||
try!(space(&mut s.s));
|
try!(space(&mut s.s));
|
||||||
@ -2927,7 +2927,7 @@ impl<'a> State<'a> {
|
|||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
},
|
},
|
||||||
ast::PathListMod { rename, .. } => {
|
ast::PathListItemKind::Mod { rename, .. } => {
|
||||||
try!(word(&mut s.s, "self"));
|
try!(word(&mut s.s, "self"));
|
||||||
if let Some(ident) = rename {
|
if let Some(ident) = rename {
|
||||||
try!(space(&mut s.s));
|
try!(space(&mut s.s));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user