//! The Rust AST Visitor. Extracts useful information and massages it into a form
//! usable for `clean`.
-use rustc::hir::def::{DefKind, Res};
-use rustc::hir::def_id::{DefId, LOCAL_CRATE};
-use rustc::hir::{self, Node};
use rustc::middle::privacy::AccessLevel;
use rustc::ty::TyCtxt;
-use rustc::util::nodemap::{FxHashMap, FxHashSet};
+use rustc_data_structures::fx::{FxHashMap, FxHashSet};
+use rustc_hir as hir;
+use rustc_hir::def::{DefKind, Res};
+use rustc_hir::def_id::{DefId, LOCAL_CRATE};
+use rustc_hir::Node;
+use rustc_span::hygiene::MacroKind;
+use rustc_span::source_map::Spanned;
+use rustc_span::symbol::{kw, sym};
+use rustc_span::{self, Span};
use syntax::ast;
-use syntax::source_map::Spanned;
-use syntax::symbol::sym;
-use syntax_pos::hygiene::MacroKind;
-use syntax_pos::{self, Span};
use std::mem;
let mut module = self.visit_mod_contents(
krate.span,
krate.attrs,
- &Spanned { span: syntax_pos::DUMMY_SP, node: hir::VisibilityKind::Public },
+ &Spanned { span: rustc_span::DUMMY_SP, node: hir::VisibilityKind::Public },
hir::CRATE_HIR_ID,
&krate.module,
None,
om.statics.push(s);
}
hir::ItemKind::Const(type_, expr) => {
- let s = Constant {
- type_,
- expr,
- id: item.hir_id,
- name: ident.name,
- attrs: &item.attrs,
- whence: item.span,
- vis: &item.vis,
- };
- om.constants.push(s);
+ // Underscore constants do not correspond to a nameable item and
+ // so are never useful in documentation.
+ if ident.name != kw::Underscore {
+ let s = Constant {
+ type_,
+ expr,
+ id: item.hir_id,
+ name: ident.name,
+ attrs: &item.attrs,
+ whence: item.span,
+ vis: &item.vis,
+ };
+ om.constants.push(s);
+ }
}
hir::ItemKind::Trait(is_auto, unsafety, ref generics, ref bounds, ref item_ids) => {
let items = item_ids.iter().map(|ti| self.cx.tcx.hir().trait_item(ti.id)).collect();