Skip to content

ICE on "Error constructed but not emitted" #63135

Closed
@dwrensha

Description

@dwrensha

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

fn i(n{...,f #
error: this file contains an un-closed delimiter
 --> main.rs:2:2
  |
1 | fn i(n{...,f #
  |     - - un-closed delimiter
  |     |
  |     un-closed delimiter
2 | 
  |  ^

error: expected field pattern, found `...`
 --> main.rs:1:8
  |
1 | fn i(n{...,f #
  |        ^^^ help: to omit remaining fields, use one fewer `.`: `..`

error: internal compiler error: the following error was constructed but not emitted

error: expected `}`, found `,`
 --> main.rs:1:11
  |
1 | fn i(n{...,f #
  |        ---^
  |        |  |
  |        |  expected `}`
  |        `..` must be at the end and cannot have a trailing comma

thread 'rustc' panicked at 'explicit panic', src/librustc_errors/diagnostic_builder.rs:390:13
stack backtrace:
   0: std::panicking::default_hook::{{closure}}
   1: std::panicking::default_hook
   2: rustc::util::common::panic_hook
   3: std::panicking::rust_panic_with_hook
   4: std::panicking::begin_panic
   5: <rustc_errors::diagnostic_builder::DiagnosticBuilder as core::ops::drop::Drop>::drop
   6: syntax::parse::parser::Parser::parse_pat_fields
   7: syntax::parse::parser::Parser::parse_pat_with_range_pat
   8: syntax::parse::parser::Parser::parse_fn_args::{{closure}}
   9: syntax::parse::parser::Parser::parse_seq_to_before_tokens
  10: syntax::parse::parser::Parser::parse_fn_args
  11: syntax::parse::parser::Parser::parse_fn_decl
  12: syntax::parse::parser::Parser::parse_item_fn
  13: syntax::parse::parser::Parser::parse_item_implementation
  14: syntax::parse::parser::Parser::parse_item_
  15: syntax::parse::parser::Parser::parse_item
  16: syntax::parse::parser::Parser::parse_mod_items
  17: syntax::parse::parser::Parser::parse_crate_mod
  18: syntax::parse::parse_crate_from_file
  19: rustc_interface::passes::parse::{{closure}}
  20: rustc::util::common::time
  21: rustc_interface::passes::parse
  22: rustc_interface::queries::Query<T>::compute
  23: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::parse
  24: rustc_interface::interface::run_compiler_in_existing_thread_pool
  25: std::thread::local::LocalKey<T>::with
  26: syntax::with_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
query stack during panic:
end of query stack
error: aborting due to 4 previous errors


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/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.38.0-nightly (04b88a9eb 2019-07-29) running on x86_64-apple-darwin

The error happens on stable, beta, and nightly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-parserArea: The lexing & parsing of Rust source code to an ASTC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions