1
Fork 0

Point out macro expansion ident in resolver errors too

This commit is contained in:
Michael Goulet 2025-02-24 20:20:54 +00:00
parent ab31129956
commit e4dfca8ac2
6 changed files with 26 additions and 1 deletions

View file

@ -429,6 +429,12 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
let mut err = self.r.dcx().struct_span_err(base_error.span, base_error.msg.clone());
err.code(code);
// Try to get the span of the identifier within the path's syntax context
// (if that's different).
if let Some(within_macro_span) = base_error.span.within_macro(span) {
err.span_label(within_macro_span, "within this macro");
}
self.detect_missing_binding_available_from_pattern(&mut err, path, following_seg);
self.suggest_at_operator_in_slice_pat_with_range(&mut err, path);
self.suggest_swapping_misplaced_self_ty_and_trait(&mut err, source, res, base_error.span);