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

@ -522,7 +522,8 @@ impl<T> Trait<T> for X {
}
}
TypeError::TargetFeatureCast(def_id) => {
let target_spans = tcx.get_attrs(def_id, sym::target_feature).map(|attr| attr.span);
let target_spans =
tcx.get_attrs(def_id, sym::target_feature).map(|attr| attr.span());
diag.note(
"functions with `#[target_feature]` can only be coerced to `unsafe` function pointers"
);

View file

@ -622,7 +622,14 @@ impl<'tcx> OnUnimplementedDirective {
item_def_id: DefId,
) -> Result<Option<Self>, ErrorGuaranteed> {
let result = if let Some(items) = attr.meta_item_list() {
Self::parse(tcx, item_def_id, &items, attr.span, true, is_diagnostic_namespace_variant)
Self::parse(
tcx,
item_def_id,
&items,
attr.span(),
true,
is_diagnostic_namespace_variant,
)
} else if let Some(value) = attr.value_str() {
if !is_diagnostic_namespace_variant {
Ok(Some(OnUnimplementedDirective {
@ -633,7 +640,7 @@ impl<'tcx> OnUnimplementedDirective {
tcx,
item_def_id,
value,
attr.span,
attr.span(),
is_diagnostic_namespace_variant,
)?),
notes: Vec::new(),
@ -665,8 +672,8 @@ impl<'tcx> OnUnimplementedDirective {
tcx.emit_node_span_lint(
UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES,
tcx.local_def_id_to_hir_id(item_def_id),
attr.span,
MalformedOnUnimplementedAttrLint::new(attr.span),
attr.span(),
MalformedOnUnimplementedAttrLint::new(attr.span()),
);
}
}
@ -675,7 +682,7 @@ impl<'tcx> OnUnimplementedDirective {
tcx.emit_node_span_lint(
UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES,
tcx.local_def_id_to_hir_id(item_def_id),
attr.span,
attr.span(),
MissingOptionsForOnUnimplementedAttr,
)
}