Skip to content

ICE with wrong method receiver as second parameter #62660

Description

@jfrimmel

The following code (on compiler explorer) leads to an ICE:

struct Foo;
impl Foo {
    // mind the missing `>` of the receiver
    pub fn foo(_: i32, self: Box<Self) {}
}

Broken since 1.32.0 up to the current nightly, earlier versions are not affected.

Backtrace of the nightly build
error: internal compiler error: Error constructed but not emitted

thread 'rustc' panicked at 'explicit panic', src/librustc_errors/diagnostic_builder.rs:387:13
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.29/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.29/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:47
   3: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:36
   4: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:200
   5: std::panicking::default_hook
             at src/libstd/panicking.rs:214
   6: rustc::util::common::panic_hook
   7: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:481
   8: std::panicking::begin_panic
   9: <rustc_errors::diagnostic_builder::DiagnosticBuilder as core::ops::drop::Drop>::drop
  10: syntax::parse::parser::Parser::parse_arg_general
  11: syntax::parse::parser::Parser::parse_seq_to_before_tokens
  12: syntax::parse::parser::Parser::parse_impl_method
  13: syntax::parse::parser::Parser::parse_impl_item
  14: syntax::parse::parser::Parser::parse_item_implementation
  15: syntax::parse::parser::Parser::parse_item_
  16: syntax::parse::parser::Parser::parse_item
  17: syntax::parse::parser::Parser::parse_mod_items
  18: syntax::parse::parser::Parser::parse_crate_mod
  19: syntax::parse::parse_crate_from_file
  20: rustc_interface::passes::parse::{{closure}}
  21: rustc::util::common::time
  22: rustc_interface::passes::parse
  23: rustc_interface::queries::Query<T>::compute
  24: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::parse
  25: rustc_interface::interface::run_compiler_in_existing_thread_pool
  26: std::thread::local::LocalKey<T>::with
  27: scoped_tls::ScopedKey<T>::set
  28: 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 previous error


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 (71f9384e3 2019-07-12) running on x86_64-unknown-linux-gnu

note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an ASTI-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.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions