File tree Expand file tree Collapse file tree 1 file changed +16
-9
lines changed Expand file tree Collapse file tree 1 file changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -192,15 +192,22 @@ where
192192 return ;
193193 }
194194
195- assert ! (
196- enclosing_item_span. contains( call_span) ,
197- "Attempted to scrape call at [{call_span:?}] whose enclosing item [{enclosing_item_span:?}] doesn't contain the span of the call." ,
198- ) ;
199-
200- assert ! (
201- call_span. contains( ident_span) ,
202- "Attempted to scrape call at [{call_span:?}] whose identifier [{ident_span:?}] was not contained in the span of the call."
203- ) ;
195+ // If the enclosing item doesn't actually enclose the call, this means we probably have a weird
196+ // macro issue even though the spans aren't tagged as being from an expansion.
197+ if !enclosing_item_span. contains ( call_span) {
198+ warn ! (
199+ "Attempted to scrape call at [{call_span:?}] whose enclosing item [{enclosing_item_span:?}] doesn't contain the span of the call."
200+ ) ;
201+ return ;
202+ }
203+
204+ // Similarly for the call w/ the function ident.
205+ if !call_span. contains ( ident_span) {
206+ warn ! (
207+ "Attempted to scrape call at [{call_span:?}] whose identifier [{ident_span:?}] was not contained in the span of the call."
208+ ) ;
209+ return ;
210+ }
204211
205212 // Save call site if the function resolves to a concrete definition
206213 if let ty:: FnDef ( def_id, _) = ty. kind ( ) {
You can’t perform that action at this time.
0 commit comments