@@ -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} ;
@@ -887,21 +887,22 @@ pub fn in_external_macro(sess: &Session, span: Span) -> bool {
887
887
} ;
888
888
889
889
match info. format {
890
- ExpnFormat :: MacroAttribute ( ..) => return true , // definitely a plugin
891
- ExpnFormat :: CompilerDesugaring ( _) => return true , // well, it's "external"
892
- ExpnFormat :: MacroBang ( ..) => { } // check below
893
- }
894
-
895
- let def_site = match info. def_site {
896
- Some ( span) => span,
897
- // no span for the def_site means it's an external macro
898
- None => return true ,
899
- } ;
890
+ ExpnFormat :: MacroAttribute ( ..) => true , // definitely a plugin
891
+ ExpnFormat :: CompilerDesugaring ( CompilerDesugaringKind :: ForLoop ) => false ,
892
+ ExpnFormat :: CompilerDesugaring ( _) => true , // well, it's "external"
893
+ ExpnFormat :: MacroBang ( ..) => {
894
+ let def_site = match info. def_site {
895
+ Some ( span) => span,
896
+ // no span for the def_site means it's an external macro
897
+ None => return true ,
898
+ } ;
900
899
901
- match sess. source_map ( ) . span_to_snippet ( def_site) {
902
- Ok ( code) => !code. starts_with ( "macro_rules" ) ,
903
- // no snippet = external macro or compiler-builtin expansion
904
- Err ( _) => true ,
900
+ match sess. source_map ( ) . span_to_snippet ( def_site) {
901
+ Ok ( code) => !code. starts_with ( "macro_rules" ) ,
902
+ // no snippet = external macro or compiler-builtin expansion
903
+ Err ( _) => true ,
904
+ }
905
+ }
905
906
}
906
907
}
907
908
0 commit comments