Skip to content

Commit ae661dd

Browse files
committed
Don't emit missing_docs lint with dummy spans
1 parent f6d2cfc commit ae661dd

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

compiler/rustc_lint/src/builtin.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -438,11 +438,10 @@ impl MissingDoc {
438438
let attrs = cx.tcx.hir().attrs(cx.tcx.local_def_id_to_hir_id(def_id));
439439
let has_doc = attrs.iter().any(has_doc);
440440
if !has_doc {
441-
cx.emit_span_lint(
442-
MISSING_DOCS,
443-
cx.tcx.def_span(def_id),
444-
BuiltinMissingDoc { article, desc },
445-
);
441+
let sp = cx.tcx.def_span(def_id);
442+
if !sp.is_dummy() {
443+
cx.emit_span_lint(MISSING_DOCS, sp, BuiltinMissingDoc { article, desc });
444+
}
446445
}
447446
}
448447
}

0 commit comments

Comments
 (0)