Skip to content

Commit 2b816b0

Browse files
committed
[breaking-change] don't glob export ast::PathListItem_ variants
1 parent 8b3856b commit 2b816b0

File tree

7 files changed

+43
-39
lines changed

7 files changed

+43
-39
lines changed

src/librustc_front/lowering.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -211,31 +211,31 @@ pub fn lower_view_path(lctx: &LoweringContext, view_path: &ViewPath) -> P<hir::V
211211
ViewPathList(ref path, ref path_list_idents) => {
212212
hir::ViewPathList(lower_path(lctx, path),
213213
path_list_idents.iter()
214-
.map(|path_list_ident| {
215-
Spanned {
216-
node: match path_list_ident.node {
217-
PathListIdent { id, name, rename } =>
218-
hir::PathListIdent {
219-
id: id,
220-
name: name.name,
221-
rename: rename.map(|x| x.name),
222-
},
223-
PathListMod { id, rename } =>
224-
hir::PathListMod {
225-
id: id,
226-
rename: rename.map(|x| x.name),
227-
},
228-
},
229-
span: path_list_ident.span,
230-
}
231-
})
214+
.map(lower_path_list_item)
232215
.collect())
233216
}
234217
},
235218
span: view_path.span,
236219
})
237220
}
238221

222+
fn lower_path_list_item(path_list_ident: &PathListItem) -> hir::PathListItem {
223+
Spanned {
224+
node: match path_list_ident.node {
225+
PathListItemKind::Ident { id, name, rename } => hir::PathListIdent {
226+
id: id,
227+
name: name.name,
228+
rename: rename.map(|x| x.name),
229+
},
230+
PathListItemKind::Mod { id, rename } => hir::PathListMod {
231+
id: id,
232+
rename: rename.map(|x| x.name),
233+
},
234+
},
235+
span: path_list_ident.span,
236+
}
237+
}
238+
239239
pub fn lower_arm(lctx: &LoweringContext, arm: &Arm) -> hir::Arm {
240240
hir::Arm {
241241
attrs: lower_attrs(lctx, &arm.attrs),

src/librustc_trans/save/dump_csv.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> {
928928
ast::ViewPathList(ref path, ref list) => {
929929
for plid in list {
930930
match plid.node {
931-
ast::PathListIdent { id, .. } => {
931+
ast::PathListItemKind::Ident { id, .. } => {
932932
match self.lookup_type_ref(id) {
933933
Some(def_id) => match self.lookup_def_kind(id, plid.span) {
934934
Some(kind) => {
@@ -943,7 +943,7 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> {
943943
None => (),
944944
}
945945
}
946-
ast::PathListMod { .. } => (),
946+
ast::PathListItemKind::Mod { .. } => (),
947947
}
948948
}
949949

src/libsyntax/ast.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
// The Rust abstract syntax tree.
1212

1313
pub use self::Pat_::*;
14-
pub use self::PathListItem_::*;
1514
pub use self::StructFieldKind::*;
1615
pub use self::TyParamBound::*;
1716
pub use self::UnsafeSource::*;
@@ -1737,42 +1736,42 @@ pub struct Variant_ {
17371736
pub type Variant = Spanned<Variant_>;
17381737

17391738
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
1740-
pub enum PathListItem_ {
1741-
PathListIdent {
1739+
pub enum PathListItemKind {
1740+
Ident {
17421741
name: Ident,
17431742
/// renamed in list, eg `use foo::{bar as baz};`
17441743
rename: Option<Ident>,
17451744
id: NodeId
17461745
},
1747-
PathListMod {
1746+
Mod {
17481747
/// renamed in list, eg `use foo::{self as baz};`
17491748
rename: Option<Ident>,
17501749
id: NodeId
17511750
}
17521751
}
17531752

1754-
impl PathListItem_ {
1753+
impl PathListItemKind {
17551754
pub fn id(&self) -> NodeId {
17561755
match *self {
1757-
PathListIdent { id, .. } | PathListMod { id, .. } => id
1756+
PathListItemKind::Ident { id, .. } | PathListItemKind::Mod { id, .. } => id
17581757
}
17591758
}
17601759

17611760
pub fn name(&self) -> Option<Ident> {
17621761
match *self {
1763-
PathListIdent { name, .. } => Some(name),
1764-
PathListMod { .. } => None,
1762+
PathListItemKind::Ident { name, .. } => Some(name),
1763+
PathListItemKind::Mod { .. } => None,
17651764
}
17661765
}
17671766

17681767
pub fn rename(&self) -> Option<Ident> {
17691768
match *self {
1770-
PathListIdent { rename, .. } | PathListMod { rename, .. } => rename
1769+
PathListItemKind::Ident { rename, .. } | PathListItemKind::Mod { rename, .. } => rename
17711770
}
17721771
}
17731772
}
17741773

1775-
pub type PathListItem = Spanned<PathListItem_>;
1774+
pub type PathListItem = Spanned<PathListItemKind>;
17761775

17771776
pub type ViewPath = Spanned<ViewPath_>;
17781777

src/libsyntax/ext/build.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1150,7 +1150,12 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
11501150
fn item_use_list(&self, sp: Span, vis: ast::Visibility,
11511151
path: Vec<ast::Ident>, imports: &[ast::Ident]) -> P<ast::Item> {
11521152
let imports = imports.iter().map(|id| {
1153-
respan(sp, ast::PathListIdent { name: *id, rename: None, id: ast::DUMMY_NODE_ID })
1153+
let item = ast::PathListItemKind::Ident {
1154+
name: *id,
1155+
rename: None,
1156+
id: ast::DUMMY_NODE_ID,
1157+
};
1158+
respan(sp, item)
11541159
}).collect();
11551160

11561161
self.item_use(sp, vis,

src/libsyntax/fold.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,14 +316,14 @@ pub fn noop_fold_view_path<T: Folder>(view_path: P<ViewPath>, fld: &mut T) -> P<
316316
path_list_idents.move_map(|path_list_ident| {
317317
Spanned {
318318
node: match path_list_ident.node {
319-
PathListIdent { id, name, rename } =>
320-
PathListIdent {
319+
PathListItemKind::Ident { id, name, rename } =>
320+
PathListItemKind::Ident {
321321
id: fld.new_id(id),
322322
rename: rename,
323323
name: name
324324
},
325-
PathListMod { id, rename } =>
326-
PathListMod {
325+
PathListItemKind::Mod { id, rename } =>
326+
PathListItemKind::Mod {
327327
id: fld.new_id(id),
328328
rename: rename
329329
}

src/libsyntax/parse/parser.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -574,11 +574,11 @@ impl<'a> Parser<'a> {
574574
let lo = self.span.lo;
575575
let node = if self.eat_keyword(keywords::SelfValue) {
576576
let rename = try!(self.parse_rename());
577-
ast::PathListMod { id: ast::DUMMY_NODE_ID, rename: rename }
577+
ast::PathListItemKind::Mod { id: ast::DUMMY_NODE_ID, rename: rename }
578578
} else {
579579
let ident = try!(self.parse_ident());
580580
let rename = try!(self.parse_rename());
581-
ast::PathListIdent { name: ident, rename: rename, id: ast::DUMMY_NODE_ID }
581+
ast::PathListItemKind::Ident { name: ident, rename: rename, id: ast::DUMMY_NODE_ID }
582582
};
583583
let hi = self.last_span.hi;
584584
Ok(spanned(lo, hi, node))

src/libsyntax/print/pprust.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2918,7 +2918,7 @@ impl<'a> State<'a> {
29182918
}
29192919
try!(self.commasep(Inconsistent, &idents[..], |s, w| {
29202920
match w.node {
2921-
ast::PathListIdent { name, rename, .. } => {
2921+
ast::PathListItemKind::Ident { name, rename, .. } => {
29222922
try!(s.print_ident(name));
29232923
if let Some(ident) = rename {
29242924
try!(space(&mut s.s));
@@ -2927,7 +2927,7 @@ impl<'a> State<'a> {
29272927
}
29282928
Ok(())
29292929
},
2930-
ast::PathListMod { rename, .. } => {
2930+
ast::PathListItemKind::Mod { rename, .. } => {
29312931
try!(word(&mut s.s, "self"));
29322932
if let Some(ident) = rename {
29332933
try!(space(&mut s.s));

0 commit comments

Comments
 (0)