use rustc_metadata::cstore::CStore;
use rustc_target::spec::TargetTriple;
-use syntax::ast::NodeId;
+use syntax::ast::{Name, NodeId};
use syntax::codemap;
use syntax::edition::Edition;
use syntax::feature_gate::UnstableFeatures;
pub fake_def_ids: RefCell<FxHashMap<CrateNum, DefId>>,
pub all_fake_def_ids: RefCell<FxHashSet<DefId>>,
/// Maps (type_id, trait_id) -> auto trait impl
- pub generated_synthetics: RefCell<FxHashSet<(DefId, DefId)>>
+ pub generated_synthetics: RefCell<FxHashSet<(DefId, DefId)>>,
+ pub current_item_name: RefCell<Option<Name>>,
}
impl<'a, 'tcx, 'rcx> DocContext<'a, 'tcx, 'rcx> {
errors::HandlerFlags {
can_emit_warnings: true,
treat_err_as_bug: false,
+ report_delayed_bugs: false,
external_macro_backtrace: false,
..Default::default()
},
let intra_link_resolution_failure_name = lint::builtin::INTRA_DOC_LINK_RESOLUTION_FAILURE.name;
let warnings_lint_name = lint::builtin::WARNINGS.name;
+ let missing_docs = rustc_lint::builtin::MISSING_DOCS.name;
+
+ // In addition to those specific lints, we also need to whitelist those given through
+ // command line, otherwise they'll get ignored and we don't want that.
+ let mut whitelisted_lints = vec![warnings_lint_name.to_owned(),
+ intra_link_resolution_failure_name.to_owned(),
+ missing_docs.to_owned()];
+
+ for (lint, _) in &cmd_lints {
+ whitelisted_lints.push(lint.clone());
+ }
+
let lints = lint::builtin::HardwiredLints.get_lints()
.into_iter()
.chain(rustc_lint::SoftLints.get_lints().into_iter())
let mut sess = session::build_session_(
sessopts, cpath, diagnostic_handler, codemap,
);
+
+ lint::builtin::HardwiredLints.get_lints()
+ .into_iter()
+ .chain(rustc_lint::SoftLints.get_lints().into_iter())
+ .filter_map(|lint| {
+ // We don't want to whitelist *all* lints so let's
+ // ignore those ones.
+ if whitelisted_lints.iter().any(|l| &lint.name == l) {
+ None
+ } else {
+ Some(lint)
+ }
+ })
+ .for_each(|l| {
+ sess.driver_lint_caps.insert(lint::LintId::of(l),
+ lint::Allow);
+ });
+
let codegen_backend = rustc_driver::get_codegen_backend(&sess);
let cstore = Rc::new(CStore::new(codegen_backend.metadata_loader()));
rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess));
&sess);
let resolver = RefCell::new(resolver);
-
abort_on_err(driver::phase_3_run_analysis_passes(&*codegen_backend,
control,
&sess,
fake_def_ids: RefCell::new(FxHashMap()),
all_fake_def_ids: RefCell::new(FxHashSet()),
generated_synthetics: RefCell::new(FxHashSet()),
+ current_item_name: RefCell::new(None),
};
debug!("crate: {:?}", tcx.hir.krate());