Skip to content

ICE with instrument #1472

@mibac138

Description

@mibac138

Bug Report

Version

tracing = "0.1"

Description

This code (playground):

pub struct Foo;
impl Foo {
    #[tracing::instrument(skip(_))]
    pub fn read_from(_: () {
   // missing close paren ^
    }
}

Causes an ICE that's not present without #[tracing::instrument].
Output:

error: expected one of `)` or `,`, found `{`
 --> src/lib.rs:5:28
  |
5 |     pub fn read_from(_: () {
  |                     -     -^
  |                     |     |
  |                     |     help: `)` may belong here
  |                     unclosed delimiter

error: non-item in item list
 --> src/lib.rs:7:1
  |
3 | impl Foo {
  |          - item list starts here
...
7 | }
  | ^
  | |
  | non-item starts here
  | item list ends here

thread 'rustc' panicked at 'Stack should be empty: final_buf=FrameData { open: src/lib.rs:5:21: 5:22 (#0), open_delim: Paren, inner: [(Token(Token { kind: Ident("_", false), span: src/lib.rs:5:22: 5:23 (#0) }), Joint), (Token(Token { kind: Colon, span: src/lib.rs:5:23: 5:24 (#0) }), Alone), (Delimited(DelimSpan { open: src/lib.rs:5:25: 5:26 (#0), close: src/lib.rs:5:26: 5:27 (#0) }, Paren, AttrAnnotatedTokenStream([])), Alone), (Delimited(DelimSpan { open: src/lib.rs:5:28: 5:29 (#0), close: src/lib.rs:6:5: 6:6 (#0) }, Brace, AttrAnnotatedTokenStream([])), Alone)] } stack=[FrameData { open: no-location (#0), open_delim: NoDelim, inner: [(Token(Token { kind: Ident("pub", false), span: src/lib.rs:5:5: 5:8 (#0) }), Alone), (Token(Token { kind: Ident("fn", false), span: src/lib.rs:5:9: 5:11 (#0) }), Alone), (Token(Token { kind: Ident("read_from", false), span: src/lib.rs:5:12: 5:21 (#0) }), Alone)] }]', 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.55.0-nightly (3e1c75c6e 2021-07-13) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2 --crate-type lib

note: some of the compiler flags provided by cargo are hidden

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions