ty: HirIdify some lints

This commit is contained in:
ljedrz 2019-02-26 11:48:34 +01:00
parent e72584c3a1
commit c2e517e0c4
14 changed files with 62 additions and 89 deletions

View file

@ -473,9 +473,9 @@ fn resolution_failure(
) {
let sp = span_of_attrs(attrs);
let mut diag = cx.tcx.struct_span_lint_node(
let mut diag = cx.tcx.struct_span_lint_hir(
lint::builtin::INTRA_DOC_LINK_RESOLUTION_FAILURE,
NodeId::from_u32(0),
hir::CRATE_HIR_ID,
sp,
&format!("`[{}]` cannot be resolved, ignoring it...", path_str),
);

View file

@ -1,12 +1,12 @@
//! Contains information about "passes", used to modify crate information during the documentation
//! process.
use rustc::hir;
use rustc::hir::def_id::DefId;
use rustc::lint as lint;
use rustc::middle::privacy::AccessLevels;
use rustc::util::nodemap::DefIdSet;
use std::mem;
use syntax::ast::NodeId;
use syntax_pos::{DUMMY_SP, Span};
use std::ops::Range;
@ -312,18 +312,18 @@ pub fn look_for_tests<'a, 'tcx: 'a, 'rcx: 'a>(
if find_testable_code(&dox, &mut tests, ErrorCodes::No).is_ok() {
if check_missing_code == true && tests.found_tests == 0 {
let mut diag = cx.tcx.struct_span_lint_node(
let mut diag = cx.tcx.struct_span_lint_hir(
lint::builtin::MISSING_DOC_CODE_EXAMPLES,
NodeId::from_u32(0),
hir::CRATE_HIR_ID,
span_of_attrs(&item.attrs),
"Missing code example in this documentation");
diag.emit();
} else if check_missing_code == false &&
tests.found_tests > 0 &&
!cx.renderinfo.borrow().access_levels.is_doc_reachable(item.def_id) {
let mut diag = cx.tcx.struct_span_lint_node(
let mut diag = cx.tcx.struct_span_lint_hir(
lint::builtin::PRIVATE_DOC_TESTS,
NodeId::from_u32(0),
hir::CRATE_HIR_ID,
span_of_attrs(&item.attrs),
"Documentation test in private item");
diag.emit();