Also note struct access, and fix macro expansion from foreign crates

This commit is contained in:
Michael Goulet 2025-02-24 21:37:01 +00:00
parent 06072468fe
commit 09e584671b
7 changed files with 72 additions and 18 deletions

View file

@ -431,8 +431,10 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
// 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");
if let Some(within_macro_span) =
base_error.span.within_macro(span, self.r.tcx.sess.source_map())
{
err.span_label(within_macro_span, "due to this macro variable");
}
self.detect_missing_binding_available_from_pattern(&mut err, path, following_seg);