Change:
<!-- [31mICE[0m: Rustc '' 'error: internal compiler error: the following error was constructed but not emitted', 'error: internal compiler error: the following error was constructed but not emitted' File: --snippet: Version information but still crashes with ` Command: <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongProgram output</strong</summary<p</p</details<!-- query stack: --
Reduced further: searched nightlies: from nightly-2023-11-17 to nightly-2023-12-02 regressed nightly: nightly-2023-11-21 searched commit range: regressed commit: <details<summarybisected with <a href=''cargo-bisect-rustc</av0.6.7</summaryHost triple: x86_64-pc-windows-msvc Reproduce with: </detailsLooks like
This might be a duplicate of , now that I've taken another look at it
When I checked, was already fixed but this one wasn't
You're right-- doesn't reproduce with the latest nightly, but this one does, which I find strange since I thought they have the same root cause, which should address. (Hence also why I closed --it almost exactly duplicated the work in .)
Can be further reduced to

Discussion:
&& let [segment] = &attr_kind.item.path.segments[..] && segment.ident.name == sym::cfg && let Some(args_span) = attr_kind.item.args.span() <del> && let Ok(next_attr) = snapshot.parse_attribute(InnerAttrPolicy::Forbidden(None)) </del> <ins> && let next_attr = match snapshot.parse_attribute(InnerAttrPolicy::Forbidden(None)) { Ok(next_attr) => next_attr, Err(inner_err) => { err.cancel(); inner_err.cancel(); return; } } </ins> && let ast::AttrKind::Normal(next_attr_kind) = next_attr.kind && let Some(next_attr_args_span) = next_attr_kind.item.args.span() && let [next_segment] = &next_attr_kind.item.path.segments[..] && segment.ident.name == sym::cfg <del> && let Ok(next_expr) = snapshot.parse_expr() </del> { <ins> let next_expr = match snapshot.parse_expr() { Ok(next_expr) => next_expr, Err(inner_err) => { err.cancel(); inner_err.cancel(); return; } }; </ins> // We have for sure // #[cfg(..)] // expr

<ins> // Issue #118164: recovery path leaving unemitted error behind fn bar() -> String { #[cfg(feature = )] [1, 2, 3].iter().map().collect::<String>() //~ ERROR expected `;`, found `#` #[attr] //~ ERROR expected statement after outer attribute } fn main() { let _ = bar(); } </ins>

<ins> error: expected `;`, found `#` --> $DIR/properly-recover-from-trailing-outer-attribute-in-body.rs:4:47 | LL |     #[cfg(feature = )] |     ------------------ only `;` terminated statements or tail expressions are allowed after this attribute LL |     [1, 2, 3].iter().map().collect::<String>() |                                               ^ expected `;` here LL |     #[attr] |     - unexpected token | help: add `;` here | LL |     [1, 2, 3].iter().map().collect::<String>(); |                                               + help: alternatively, consider surrounding the expression with a block | LL |     { [1, 2, 3].iter().map().collect::<String>() } |     +                                            + error: expected statement after outer attribute --> $DIR/properly-recover-from-trailing-outer-attribute-in-body.rs:5:5 | LL |     #[attr] |     ^^^^^^^ error: aborting due to 2 previous errors </ins>