Skip to content

Commit 7ea034a

Browse files
committed
restrict access to span only when we emit diagnostic
1 parent 1c9ddd2 commit 7ea034a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/rustc_passes/src/weak_lang_items.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx>, items: &mut lang_items::LanguageItem
2424
let crate_items = tcx.hir_crate_items(());
2525
for id in crate_items.foreign_items() {
2626
let attrs = tcx.hir().attrs(id.hir_id());
27-
let span = tcx.hir().span(id.hir_id());
2827
if let Some((lang_item, _)) = lang_items::extract(attrs) {
2928
if let Some(&item) = WEAK_ITEMS_REFS.get(&lang_item) {
3029
if items.require(item).is_err() {
3130
items.missing.push(item);
3231
}
3332
} else {
33+
let span = tcx.def_span(id.def_id);
3434
struct_span_err!(
3535
tcx.sess,
3636
span,

0 commit comments

Comments
 (0)