Skip to content

rustc ICE attempting to call nonexistent method on break keyword #15207

Closed
@kwantam

Description

@kwantam

Had a Vec<> named breaks, mistyped it as break and called push() on it. Compiler fuzzing through awful variable name choices!

Version:
[kwantam@tachyon ~/git/coreutils/fmt]$ rustc --version
rustc 0.11.0-pre-nightly (05ca9f7 2014-06-24 22:06:48 +0000)
host: x86_64-unknown-linux-gnu

Error:

linebreak.rs:273:21: 273:27 error: multiple applicable methods in scope
linebreak.rs:273                     break.push(next_break.unwrap());
                                     ^~~~~~
linebreak.rs:273:21: 273:27 note: candidate #1 is `rustrt::local_ptr::Borrowed<T>.DerefMut<T>::deref_mut`
linebreak.rs:273                     break.push(next_break.unwrap());
                                     ^~~~~~
linebreak.rs:273:21: 273:27 note: candidate #2 is `rustrt::exclusive::ExclusiveGuard<'a, T>.DerefMut<T>::deref_mut`
linebreak.rs:273                     break.push(next_break.unwrap());
                                     ^~~~~~
linebreak.rs:273:21: 273:27 note: candidate #3 is `sync::lock::MutexGuard<'a, T>.DerefMut<T>::deref_mut`
linebreak.rs:273                     break.push(next_break.unwrap());
                                     ^~~~~~
linebreak.rs:273:21: 273:27 note: candidate #4 is `sync::lock::RWLockWriteGuard<'a, T>.DerefMut<T>::deref_mut`
linebreak.rs:273                     break.push(next_break.unwrap());
                                     ^~~~~~
linebreak.rs:273:21: 273:27 note: candidate #5 is `core::cell::RefMut<'b, T>.DerefMut<T>::deref_mut`
linebreak.rs:273                     break.push(next_break.unwrap());
                                     ^~~~~~
linebreak.rs:273:21: 273:27 error: internal compiler error: &mut ! was a subtype of &mut rustrt::local_ptr::Borrowed<<generic #1993>> but now is not?
linebreak.rs:273                     break.push(next_break.unwrap());
                                     ^~~~~~
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/libsyntax/diagnostic.rs:106

stack backtrace:
   1:     0x7fa7889cf450 - rt::backtrace::imp::write::h011579a9f09769adKGp::v0.11.0.pre
   2:     0x7fa7889d5fc0 - failure::on_fail::hb791e1afafa6649bZ1p::v0.11.0.pre
   3:     0x7fa78835be60 - unwind::begin_unwind_inner::h0f31a00d80cf6a55QRd::v0.11.0.pre
   4:     0x7fa78731a110 - unwind::begin_unwind::h887623332829230614::v0.11.0.pre
   5:     0x7fa78731a040 - diagnostic::SpanHandler::span_bug::ha1b7a4e0b2f46ebe76b::v0.11.0.pre
   6:     0x7fa78914fbf0 - driver::session::Session::span_bug::hcf2dd6cb4b46a49aMZq::v0.11.0.pre
   7:     0x7fa7893fb2e0 - middle::typeck::check::method::LookupContext<'a>::bug::h2f752da7c4896798cvc::v0.11.0.pre
   8:     0x7fa7893fb370 - middle::typeck::check::method::LookupContext<'a>::consider_candidates::hd033c5c6a335faa73Ib::v0.11.0.pre
   9:     0x7fa7893f8880 - middle::typeck::check::method::LookupContext<'a>::search_for_method::hf618cbadbec2264atDb::v0.11.0.pre
  10:     0x7fa7893fa2c0 - middle::typeck::check::method::LookupContext<'a>::search_for_some_kind_of_autorefd_method::h9789c164db11e8a5Swb::v0.11.0.pre
  11:     0x7fa7893f34c0 - middle::typeck::check::method::LookupContext<'a>::search_for_autoptrd_method::h895fcc871baec1ebxub::v0.11.0.pre
  12:     0x7fa7893f21d0 - middle::typeck::check::method::LookupContext<'a>::search_step::h82f64f603bb470cdZIa::v0.11.0.pre
  13:     0x7fa7893ef450 - middle::typeck::check::method::LookupContext<'a>::search::h608f3afd326be406sHa::v0.11.0.pre
  14:     0x7fa7893f0450 - middle::typeck::check::method::lookup_in_trait::hfe66062f40293b416wa::v0.11.0.pre
  15:     0x7fa7893f1550 - middle::typeck::check::try_overloaded_deref::ha31e46305bcaaa54twe::v0.11.0.pre
  16:     0x7fa7893f36f0 - middle::typeck::check::autoderef::h10285953623300650911::v0.11.0.pre
  17:     0x7fa7893ee450 - middle::typeck::check::method::lookup::hab1b8030d36355a9Epa::v0.11.0.pre
  18:     0x7fa78943e6b0 - middle::typeck::check::check_expr_with_unifier::check_method_call::h7e78a70ef3b0413dNef::v0.11.0.pre
  19:     0x7fa789437210 - middle::typeck::check::check_expr_with_unifier::h9b60515d0e421a98F9e::v0.11.0.pre
  20:     0x7fa789452ee0 - middle::typeck::check::check_stmt::h8aacaa29e7699cd2Ich::v0.11.0.pre
  21:     0x7fa78940d830 - middle::typeck::check::check_block_with_expected::hd7bb15092373894bTgh::v0.11.0.pre
  22:     0x7fa78943f200 - middle::typeck::check::check_block_no_value::h8dedeaf274d39b40Pfh::v0.11.0.pre
  23:     0x7fa789437210 - middle::typeck::check::check_expr_with_unifier::h9b60515d0e421a98F9e::v0.11.0.pre
  24:     0x7fa789452ee0 - middle::typeck::check::check_stmt::h8aacaa29e7699cd2Ich::v0.11.0.pre
  25:     0x7fa78940d830 - middle::typeck::check::check_block_with_expected::hd7bb15092373894bTgh::v0.11.0.pre
  26:     0x7fa78943f200 - middle::typeck::check::check_block_no_value::h8dedeaf274d39b40Pfh::v0.11.0.pre
  27:     0x7fa789437210 - middle::typeck::check::check_expr_with_unifier::h9b60515d0e421a98F9e::v0.11.0.pre
  28:     0x7fa789452ee0 - middle::typeck::check::check_stmt::h8aacaa29e7699cd2Ich::v0.11.0.pre
  29:     0x7fa78940d830 - middle::typeck::check::check_block_with_expected::hd7bb15092373894bTgh::v0.11.0.pre
  30:     0x7fa789437210 - middle::typeck::check::check_expr_with_unifier::h9b60515d0e421a98F9e::v0.11.0.pre
  31:     0x7fa78940d830 - middle::typeck::check::check_block_with_expected::hd7bb15092373894bTgh::v0.11.0.pre
  32:     0x7fa789437210 - middle::typeck::check::check_expr_with_unifier::h9b60515d0e421a98F9e::v0.11.0.pre
  33:     0x7fa789379160 - middle::typeck::check::_match::check_match::hbe6fa0664e36b24cem4::v0.11.0.pre
  34:     0x7fa789437210 - middle::typeck::check::check_expr_with_unifier::h9b60515d0e421a98F9e::v0.11.0.pre
  35:     0x7fa78940d830 - middle::typeck::check::check_block_with_expected::hd7bb15092373894bTgh::v0.11.0.pre
  36:     0x7fa78943f200 - middle::typeck::check::check_block_no_value::h8dedeaf274d39b40Pfh::v0.11.0.pre
  37:     0x7fa789437210 - middle::typeck::check::check_expr_with_unifier::h9b60515d0e421a98F9e::v0.11.0.pre
  38:     0x7fa789379160 - middle::typeck::check::_match::check_match::hbe6fa0664e36b24cem4::v0.11.0.pre
  39:     0x7fa789437210 - middle::typeck::check::check_expr_with_unifier::h9b60515d0e421a98F9e::v0.11.0.pre
  40:     0x7fa789452ee0 - middle::typeck::check::check_stmt::h8aacaa29e7699cd2Ich::v0.11.0.pre
  41:     0x7fa78940d830 - middle::typeck::check::check_block_with_expected::hd7bb15092373894bTgh::v0.11.0.pre
  42:     0x7fa78943f200 - middle::typeck::check::check_block_no_value::h8dedeaf274d39b40Pfh::v0.11.0.pre
  43:     0x7fa789437210 - middle::typeck::check::check_expr_with_unifier::h9b60515d0e421a98F9e::v0.11.0.pre
  44:     0x7fa789452ee0 - middle::typeck::check::check_stmt::h8aacaa29e7699cd2Ich::v0.11.0.pre
  45:     0x7fa78940d830 - middle::typeck::check::check_block_with_expected::hd7bb15092373894bTgh::v0.11.0.pre
  46:     0x7fa789408f50 - middle::typeck::check::check_fn::h0769a54f211be0c6eUc::v0.11.0.pre
  47:     0x7fa789408d10 - middle::typeck::check::check_bare_fn::hf15bd1fe20699a25MJc::v0.11.0.pre
  48:     0x7fa789402760 - middle::typeck::check::check_item::h239b1b2e70cbeaac0gd::v0.11.0.pre
  49:     0x7fa789403d10 - visit::walk_item::h10063284111373757119::v0.11.0.pre
  50:     0x7fa789408b10 - middle::typeck::check::check_item_types::h111734e6067b3f4a4Ic::v0.11.0.pre
  51:     0x7fa789586820 - middle::typeck::check_crate::h8cdc93bb8bd94d17hEC::v0.11.0.pre
  52:     0x7fa789a007b0 - driver::driver::phase_3_run_analysis_passes::h4c2cc76a24aacec8tZp::v0.11.0.pre
  53:     0x7fa7899fbd60 - driver::driver::compile_input::h754ffcbff4ed5adcrMp::v0.11.0.pre
  54:     0x7fa789ac91b0 - driver::run_compiler::h63ff3173cc95079aKws::v0.11.0.pre
  55:     0x7fa789ac90c0 - driver::main_args::closure.100054
  56:     0x7fa789ade0e0 - task::TaskBuilder<S>::try_future::closure.101205
  57:     0x7fa789addd00 - task::TaskBuilder<S>::spawn_internal::closure.101182
  58:     0x7fa78bbd8ca0 - task::spawn_opts::closure.7223
  59:     0x7fa788358b50 - task::Task::run::closure.5245
  60:     0x7fa7883b3c40 - rust_try
  61:     0x7fa78835b500 - unwind::try::he8a5ff7eea471e0bfGd::v0.11.0.pre
  62:     0x7fa7883589d0 - task::Task::run::h138ab89ccedbaa8dVVc::v0.11.0.pre
  63:     0x7fa78bbd8a30 - task::spawn_opts::closure.7188
  64:     0x7fa78835ab00 - thread::thread_start::h98549ea2d2baf267kdd::v0.11.0.pre
  65:       0x3d9c606a80 - start_thread
  66:                0x0 - <unknown>

Metadata

Metadata

Assignees

No one assigned

    Labels

    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) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions