File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -614,9 +614,25 @@ fn macro_expand(db: &dyn ExpandDatabase, id: MacroCallId) -> ExpandResult<Arc<tt
614
614
err = error. clone ( ) . or ( err) ;
615
615
}
616
616
617
- // Set a hard limit for the expanded tt
618
- if let Err ( value) = check_tt_count ( & tt) {
619
- return value;
617
+ // Skip checking token tree limit for include! macro call
618
+ let skip_check_tt_count = match loc. kind {
619
+ MacroCallKind :: FnLike { ast_id, expand_to : _ } => {
620
+ if let Some ( name_ref) =
621
+ ast_id. to_node ( db) . path ( ) . and_then ( |p| p. segment ( ) ) . and_then ( |s| s. name_ref ( ) )
622
+ {
623
+ name_ref. text ( ) == "include"
624
+ } else {
625
+ false
626
+ }
627
+ }
628
+ _ => false ,
629
+ } ;
630
+
631
+ if !skip_check_tt_count {
632
+ // Set a hard limit for the expanded tt
633
+ if let Err ( value) = check_tt_count ( & tt) {
634
+ return value;
635
+ }
620
636
}
621
637
622
638
ExpandResult { value : Arc :: new ( tt) , err }
You can’t perform that action at this time.
0 commit comments