Skip to content

rustc failure with unwrap_or(fail!()) #13202

Closed
@TeXitoi

Description

@TeXitoi
fn main() { Some("foo").unwrap_or(fail!("bad input")).to_str(); }

It gives

$ RUST_BACKTRACE=1 ~/hack/local/bin/rustc bug.rs
bug.rs:1:13: 1:54 error: internal compiler error: &mut ! was a subtype of &mut std::cell::RefMut<,<generic #8>> but now is not?
bug.rs:1 fn main() { Some("foo").unwrap_or(fail!("bad input")).to_str(); }
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://static.rust-lang.org/doc/master/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at '~Any', /home/sihem/hack/rust/src/libsyntax/diagnostic.rs:67
stack backtrace:
   1: 0xb4bf9030 - rt::backtrace::imp::write::h1d812b743a2a5dd5H2b::v0.10.pre
   2: 0xb4b610d0 - rt::unwind::begin_unwind_inner::h1599a24f6d522a09bDb::v0.10.pre
   3: 0xb4497670 - rt::unwind::begin_unwind::h4012619650b023eeeLZ::v0.10.pre
   4: 0xb4497590 - diagnostic::SpanHandler::span_bug::hc81b461721865930yQb::v0.10.pre
   5: 0xb52e5390 - driver::session::Session::span_bug::h223bf755d7ad251cKtg::v0.10.pre
   6: 0xb550ce60 - middle::typeck::check::method::LookupContext$LT$$x27a$GT$::bug::hd634aa88388202d6gm7::v0.10.pre
   7: 0xb550cf30 - middle::typeck::check::method::LookupContext$LT$$x27a$GT$::consider_candidates::hf79263880af01ab9DF6::v0.10.pre
   8: 0xb550ade0 - middle::typeck::check::method::LookupContext$LT$$x27a$GT$::search_for_method::hf5e3d94546b76b2bwA6::v0.10.pre
   9: 0xb550bfb0 - middle::typeck::check::method::LookupContext$LT$$x27a$GT$::search_for_some_kind_of_autorefd_method::h3d76c83a23852bb8Vt6::v0.10.pre
  10: 0xb5506b80 - middle::typeck::check::method::LookupContext$LT$$x27a$GT$::search_for_autoptrd_method::h0b953347da9b5eeewr6::v0.10.pre
  11: 0xb55054c0 - middle::typeck::check::method::LookupContext$LT$$x27a$GT$::search_step::h3f0d4f4959aad4f3zN5::v0.10.pre
  12: 0xb55031c0 - middle::typeck::check::method::LookupContext$LT$$x27a$GT$::search::h6d3609211c5b505b2L5::v0.10.pre
  13: 0xb5504120 - middle::typeck::check::method::lookup_in_trait::ha4c06cdd3f3ac4afkC5::v0.10.pre
  14: 0xb5504aa0 - middle::typeck::check::try_overloaded_deref::h2455f54e408cff7eoh9::v0.10.pre
  15: 0xb5506d20 - middle::typeck::check::autoderef::he1023aec635e8239sd9::v0.10.pre
  16: 0xb55027a0 - middle::typeck::check::method::lookup::h18885ebc199b2b7fov5::v0.10.pre
  17: 0xb553dac0 - middle::typeck::check::check_expr_with_unifier::hf29f194ca7d16d94BL9::v0.10.pre
  18: 0xb555ac90 - middle::typeck::check::check_stmt::ha9ed62bbe5e9a9d130b::v0.10.pre
  19: 0xb551cc40 - middle::typeck::check::check_block_with_expected::h71543058bb3824e9i5b::v0.10.pre
  20: 0xb55187e0 - middle::typeck::check::check_fn::h3ddfb987deb5a40eXJ7::v0.10.pre
  21: 0xb55185b0 - middle::typeck::check::check_bare_fn::h651db337410b36a90z7::v0.10.pre
  22: 0xb5513c00 - middle::typeck::check::check_item::h647675bcec43b722gU7::v0.10.pre
  23: 0xb55184c0 - middle::typeck::check::check_item_types::h9a22ebaf69801295Az7::v0.10.pre
  24: 0xb5648610 - middle::typeck::check_crate::closure.70961
  25: 0xb5647ed0 - util::common::time::h78bdecbabc046ef3oUg::v0.10.pre
  26: 0xb5646b20 - middle::typeck::check_crate::h5ce9ce6f613e63565ru::v0.10.pre
  27: 0xb5995a60 - driver::driver::phase_3_run_analysis_passes::h30b0cf4204c7734dYJe::v0.10.pre
  28: 0xb599c420 - driver::driver::compile_input::h5da1689b3251ee35V8e::v0.10.pre
  29: 0xb59bebd0 - run_compiler::h87588b5afbf8a370cLm::v0.10.pre
  30: 0xb59d3530 - main_args::closure.91411
  31: 0xb59d1cf0 - monitor::closure.91296
  32: 0xb59cddb0 - task::TaskBuilder::try::closure.91071
  33: 0xb773a070 - task::spawn_opts::closure.7784
  34: 0xb4bf4a00 - rt::task::Task::run::closure.41623
  35: 0xb4bf89e0 - rt::unwind::Unwinder::try::try_fn::hd39e7b0118753e02Vqb::v0.10.pre
  36: 0xb4bff6f0 - rust_try
  37: 0xb4bf48a0 - rt::task::Task::run::h734d290445a752c23t9::v0.10.pre
  38: 0xb7739e70 - task::spawn_opts::closure.7757
  39: 0xb4bf7d50 - rt::thread::thread_start::h4aca541ec265adcavaa::v0.10.pre
  40:        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