Skip to content

thread 'rustc' panicked at 'Stack should be empty: final_buf=FrameData ...' #87793

Closed
@dwrensha

Description

@dwrensha

On nightly, I'm seeing an internal compiler error on the following input (found by fuzz-rustc):

fn m(){#[c=[r
e
e
rustc output
$ rustc bug.rs
error: this file contains an unclosed delimiter
 --> bug.rs:3:2
  |
1 | fn m(){#[c=[r
  |       - -  - unclosed delimiter
  |       | |
  |       | unclosed delimiter
  |       unclosed delimiter
2 | e
3 | e
  |  ^

error: expected `;`, found `e`
 --> bug.rs:1:14
  |
1 | fn m(){#[c=[r
  |              ^ help: add `;` here
2 | e
  | - unexpected token

error: expected `;`, found `e`
 --> bug.rs:2:2
  |
2 | e
  |  ^ help: add `;` here
3 | e
  | - unexpected token

error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `]`
 --> bug.rs:3:2
  |
1 | fn m(){#[c=[r
  |       - unclosed delimiter
2 | e
3 | e
  |  ^
  |  |
  |  expected one of 8 possible tokens
  |  help: `}` may belong here

error[E0658]: attributes on expressions are experimental
 --> bug.rs:1:8
  |
1 | fn m(){#[c=[r
  |        ^^^^^^
  |
  = note: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> for more information
  = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable

error: unexpected token: `[r]`
 --> bug.rs:1:12
  |
1 | fn m(){#[c=[r
  |            ^^

error: cannot find attribute `c` in this scope
 --> bug.rs:1:10
  |
1 | fn m(){#[c=[r
  |          ^

error[E0425]: cannot find value `e` in this scope
 --> bug.rs:2:1
  |
2 | e
  | ^ not found in this scope

error[E0425]: cannot find value `r` in this scope
 --> bug.rs:1:13
  |
1 | fn m(){#[c=[r
  |             ^ not found in this scope

thread 'rustc' panicked at 'Stack should be empty: final_buf=FrameData { open: bug.rs:1:12: 1:13 (#0), open_delim: Bracket, inner: [(Token(Token { kind: Ident("r", false), span: bug.rs:1:13: 1:14 (#0) }), Alone)] } stack=[FrameData { open: no-location (#0), open_delim: NoDelim, inner: [] }]', compiler/rustc_parse/src/parser/attr_wrapper.rs:501:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.56.0-nightly (25b764849 2021-08-04) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack
error: aborting due to 9 previous errors

Some errors have detailed explanations: E0425, E0658.
For more information about an error, try `rustc --explain E0425`.

Metadata

Metadata

Assignees

Labels

A-attributesArea: Attributes (`#[…]`, `#![…]`)A-parserArea: The lexing & parsing of Rust source code to an ASTC-bugCategory: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-lowLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions