Skip to content

Commit 746792f

Browse files
authored
Merge pull request #520 from ehuss/fix-in-this-macro
Fix "in this macro invocation" for desugarings.
2 parents 91a2f80 + 2a3b842 commit 746792f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

rust/messages.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1065,9 +1065,13 @@ def find_span_r(span, expansion=None):
10651065

10661066
# Add a message for macro invocation site if available in the local
10671067
# crate.
1068+
#
1069+
# `macro_decl_name` can be a variety of things, like fn-like macro,
1070+
# attribute, derive, "desugaring of", etc. We can generally only
1071+
# handle macro_rules macros.
10681072
if span['expansion'] and \
10691073
not _is_external(window, span['file_name']) and \
1070-
not span['expansion']['macro_decl_name'].startswith('#['):
1074+
span['expansion']['macro_decl_name'].endswith('!'):
10711075
invoke_span, expansion = find_span_r(span)
10721076
# TODO: rustc now emits this in its text output in some cases.
10731077
# Consider trying to avoid the duplicate note.

0 commit comments

Comments
 (0)