1
Fork 0

Change span field accesses to method calls

This commit is contained in:
Jana Dönszelmann 2025-02-09 22:49:28 +01:00
parent f43e549b88
commit 115b3b03b0
No known key found for this signature in database
27 changed files with 264 additions and 202 deletions

View file

@ -1114,7 +1114,7 @@ fn check_impl_items_against_trait<'tcx>(
if let Some(missing_items) = must_implement_one_of {
let attr_span = tcx
.get_attr(trait_ref.def_id, sym::rustc_must_implement_one_of)
.map(|attr| attr.span);
.map(|attr| attr.span());
missing_items_must_implement_one_of_err(
tcx,
@ -1422,7 +1422,7 @@ fn check_enum(tcx: TyCtxt<'_>, def_id: LocalDefId) {
if let Some(attr) = tcx.get_attrs(def_id, sym::repr).next() {
struct_span_code_err!(
tcx.dcx(),
attr.span,
attr.span(),
E0084,
"unsupported representation for zero-variant enum"
)

View file

@ -99,7 +99,7 @@ fn check_main_fn_ty(tcx: TyCtxt<'_>, main_def_id: DefId) {
}
for attr in tcx.get_attrs(main_def_id, sym::track_caller) {
tcx.dcx().emit_err(errors::TrackCallerOnMain { span: attr.span, annotated: main_span });
tcx.dcx().emit_err(errors::TrackCallerOnMain { span: attr.span(), annotated: main_span });
error = true;
}

View file

@ -1202,7 +1202,7 @@ fn trait_def(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::TraitDef {
// and that they are all identifiers
.and_then(|attr| match attr.meta_item_list() {
Some(items) if items.len() < 2 => {
tcx.dcx().emit_err(errors::MustImplementOneOfAttribute { span: attr.span });
tcx.dcx().emit_err(errors::MustImplementOneOfAttribute { span: attr.span() });
None
}
@ -1214,7 +1214,7 @@ fn trait_def(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::TraitDef {
tcx.dcx().emit_err(errors::MustBeNameOfAssociatedFunction { span });
})
.ok()
.zip(Some(attr.span)),
.zip(Some(attr.span())),
// Error is reported by `rustc_attr!`
None => None,
})