diff options
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_typeck/src/check/check.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/compiler/rustc_typeck/src/check/check.rs b/compiler/rustc_typeck/src/check/check.rs index dfcd35d2178..d4c7f3f8fa2 100644 --- a/compiler/rustc_typeck/src/check/check.rs +++ b/compiler/rustc_typeck/src/check/check.rs @@ -781,12 +781,13 @@ fn check_item_type<'tcx>(tcx: TyCtxt<'tcx>, id: hir::ItemId) { id.def_id, tcx.def_path_str(id.def_id.to_def_id()) ); + let item_span = tcx.def_span(id.def_id); let _indenter = indenter(); match tcx.def_kind(id.def_id) { DefKind::Static(..) => { tcx.ensure().typeck(id.def_id); - maybe_check_static_with_link_section(tcx, id.def_id, tcx.def_span(id.def_id)); - check_static_inhabited(tcx, id.def_id, tcx.def_span(id.def_id)); + maybe_check_static_with_link_section(tcx, id.def_id, item_span); + check_static_inhabited(tcx, id.def_id, item_span); } DefKind::Const => { tcx.ensure().typeck(id.def_id); @@ -796,7 +797,7 @@ fn check_item_type<'tcx>(tcx: TyCtxt<'tcx>, id: hir::ItemId) { let hir::ItemKind::Enum(ref enum_definition, _) = item.kind else { return; }; - check_enum(tcx, item.span, &enum_definition.variants, item.def_id); + check_enum(tcx, item_span, &enum_definition.variants, item.def_id); } DefKind::Fn => {} // entirely within check_item_body DefKind::Impl => { @@ -847,10 +848,10 @@ fn check_item_type<'tcx>(tcx: TyCtxt<'tcx>, id: hir::ItemId) { } } DefKind::Struct => { - check_struct(tcx, id.def_id, tcx.def_span(id.def_id)); + check_struct(tcx, id.def_id, item_span); } DefKind::Union => { - check_union(tcx, id.def_id, tcx.def_span(id.def_id)); + check_union(tcx, id.def_id, item_span); } DefKind::OpaqueTy => { let item = tcx.hir().item(id); @@ -863,7 +864,7 @@ fn check_item_type<'tcx>(tcx: TyCtxt<'tcx>, id: hir::ItemId) { // See https://github.com/rust-lang/rust/issues/75100 if !tcx.sess.opts.actually_rustdoc { let substs = InternalSubsts::identity_for_item(tcx, item.def_id.to_def_id()); - check_opaque(tcx, item.def_id, substs, item.span, &origin); + check_opaque(tcx, item.def_id, substs, item_span, &origin); } } DefKind::TyAlias => { @@ -1328,7 +1329,6 @@ pub(super) fn check_transparent<'tcx>(tcx: TyCtxt<'tcx>, sp: Span, adt: ty::AdtD if !adt.repr().transparent() { return; } - let sp = tcx.sess.source_map().guess_head_span(sp); if adt.is_union() && !tcx.features().transparent_unions { feature_err( |
