@@ -35,7 +35,7 @@ use crate::util::nodemap::NodeMap;
35
35
use errors:: { DiagnosticBuilder , DiagnosticId } ;
36
36
use std:: { hash, ptr} ;
37
37
use syntax:: ast;
38
- use syntax:: source_map:: { MultiSpan , ExpnFormat } ;
38
+ use syntax:: source_map:: { MultiSpan , ExpnFormat , CompilerDesugaringKind } ;
39
39
use syntax:: early_buffered_lints:: BufferedEarlyLintId ;
40
40
use syntax:: edition:: Edition ;
41
41
use syntax:: symbol:: { Symbol , sym} ;
@@ -881,21 +881,22 @@ pub fn in_external_macro(sess: &Session, span: Span) -> bool {
881
881
} ;
882
882
883
883
match info. format {
884
- ExpnFormat :: MacroAttribute ( ..) => return true , // definitely a plugin
885
- ExpnFormat :: CompilerDesugaring ( _) => return true , // well, it's "external"
886
- ExpnFormat :: MacroBang ( ..) => { } // check below
887
- }
888
-
889
- let def_site = match info. def_site {
890
- Some ( span) => span,
891
- // no span for the def_site means it's an external macro
892
- None => return true ,
893
- } ;
884
+ ExpnFormat :: MacroAttribute ( ..) => true , // definitely a plugin
885
+ ExpnFormat :: CompilerDesugaring ( CompilerDesugaringKind :: ForLoop ) => false ,
886
+ ExpnFormat :: CompilerDesugaring ( _) => true , // well, it's "external"
887
+ ExpnFormat :: MacroBang ( ..) => {
888
+ let def_site = match info. def_site {
889
+ Some ( span) => span,
890
+ // no span for the def_site means it's an external macro
891
+ None => return true ,
892
+ } ;
894
893
895
- match sess. source_map ( ) . span_to_snippet ( def_site) {
896
- Ok ( code) => !code. starts_with ( "macro_rules" ) ,
897
- // no snippet = external macro or compiler-builtin expansion
898
- Err ( _) => true ,
894
+ match sess. source_map ( ) . span_to_snippet ( def_site) {
895
+ Ok ( code) => !code. starts_with ( "macro_rules" ) ,
896
+ // no snippet = external macro or compiler-builtin expansion
897
+ Err ( _) => true ,
898
+ }
899
+ }
899
900
}
900
901
}
901
902
0 commit comments