Fix dbg_macro ICE when used iterated by for loop#16011
Fix dbg_macro ICE when used iterated by for loop#16011profetia wants to merge 1 commit intorust-lang:masterfrom
dbg_macro ICE when used iterated by for loop#16011Conversation
|
r? @Alexendoo rustbot has assigned @Alexendoo. Use |
| fn first_dbg_macro_in_expansion(cx: &LateContext<'_>, span: Span) -> Option<MacroCall> { | ||
| macro_backtrace(span).find(|mc| cx.tcx.is_diagnostic_item(sym::dbg_macro, mc.def_id)) | ||
| } |
There was a problem hiding this comment.
Since it looks like the issue is that it's picking up the desugared into_iter call, we could change this to something like expn_backtrace(span).take_while(|(_, data)| !matches!(data.kind, ExpnKind::Desugaring(_))).find(...)
| macro_call | ||
| .span | ||
| .source_callsite() | ||
| .with_lo(macro_call.span.lo() + BytePos(5)) // after `dbg!(` |
There was a problem hiding this comment.
what if the expression is poorly formatted, something like dbg ! { 0}?
|
Opened a PR on the rust side to fix the spans there (rust-lang/rust#148465). I'll hold off on any changes here until that's dealt with. |
|
The ICE has been fixed upstream. The |
|
Closed as fixed by upstream |
Closes #16008
changelog: [
dbg_macro] fix ICE when used iterated by for loop