Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE in typeck: assertion failed in librustc/middle/typeck/check/method/confirm.rs #19583

Closed
msiemens opened this issue Dec 6, 2014 · 2 comments · Fixed by #19813
Closed

ICE in typeck: assertion failed in librustc/middle/typeck/check/method/confirm.rs #19583

msiemens opened this issue Dec 6, 2014 · 2 comments · Fixed by #19813

Comments

@msiemens
Copy link
Contributor

msiemens commented Dec 6, 2014

Compiling some code (on Linux) resulted in this ICE:

task 'rustc' panicked at 'assertion failed: `(left == right) && (right == left)` (left: `None`, right: `Some(())`)', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/librustc/middle/typeck/check/method/confirm.rs:152

stack backtrace:
   1:     0x7f256c323b70 - rt::backtrace::imp::write::h990abaacfa2176b6qfy
   2:     0x7f256c326c40 - failure::on_fail::h38b0b794e233abc2QHy
   3:     0x7f256bf79cc0 - unwind::begin_unwind_inner::h2efca3c0591abcbd6Qc
   4:     0x7f256bf798f0 - unwind::begin_unwind_fmt::h1966842b632a71b7hOc
   5:     0x7f256aeba460 - middle::typeck::check::method::confirm::ConfirmContext<'a, 'tcx>::confirm::hcb2ce4cad29797fafyg
   6:     0x7f256aed8610 - middle::typeck::check::method::lookup::hb053a4169f2c1619Dzj
   7:     0x7f256af970b0 - middle::typeck::check::check_expr_with_unifier::check_method_call::h68dfdcfe3a4751a1iop
   8:     0x7f256af8ae90 - middle::typeck::check::check_expr_with_unifier::hb92b2ad3850873267ip
   9:     0x7f256ae6b0f0 - middle::typeck::check::_match::check_match::h5c411f1aa2f77dacezb
  10:     0x7f256af8ae90 - middle::typeck::check::check_expr_with_unifier::hb92b2ad3850873267ip
  11:     0x7f256af3f720 - middle::typeck::check::check_block_with_expected::h3956d795c9aeeb87Kir
  12:     0x7f256af8ae90 - middle::typeck::check::check_expr_with_unifier::hb92b2ad3850873267ip
  13:     0x7f256ae6b0f0 - middle::typeck::check::_match::check_match::h5c411f1aa2f77dacezb
  14:     0x7f256af8ae90 - middle::typeck::check::check_expr_with_unifier::hb92b2ad3850873267ip
  15:     0x7f256af3f720 - middle::typeck::check::check_block_with_expected::h3956d795c9aeeb87Kir
  16:     0x7f256af16690 - middle::typeck::check::check_fn::h1a71f1287e45c3b7xJl
  17:     0x7f256af3cd50 - middle::typeck::check::check_bare_fn::h918284b622e60d7cByl
  18:     0x7f256af435f0 - middle::typeck::check::check_method_body::hd5c696a286263db7D3l
  19:     0x7f256af38bc0 - middle::typeck::check::check_item::h8d5984f625a43c66MSl
  20:     0x7f256af3c680 - visit::walk_mod::h17216003542078371067
  21:     0x7f256af3c9e0 - middle::typeck::check::check_item_types::h4e49e4094b67da4bLxl
  22:     0x7f256b2fbcb0 - util::common::time::h12622327612847767970
  23:     0x7f256b2faef0 - middle::typeck::check_crate::hc4bb4e5d8eba9f8a2hP
  24:     0x7f256c93f500 - driver::driver::phase_3_run_analysis_passes::h3d64e023ddfcea4fLzS
  25:     0x7f256c9345a0 - driver::driver::compile_input::h34658a73b26c5cbfLgS
  26:     0x7f256c9b7740 - driver::run_compiler::hf08ea8f291fae6b9WeU
  27:     0x7f256c9b7630 - driver::run::closure.60675
  28:     0x7f256c7c1080 - task::TaskBuilder::try_future::closure.39831
  29:     0x7f256c2f47d0 - task::TaskBuilder::spawn_internal::closure.30969
  30:     0x7f256bf77a90 - task::Task::spawn::closure.5760
  31:     0x7f256bfd3bd0 - rust_try_inner
  32:     0x7f256bfd3bc0 - rust_try
  33:     0x7f256bf77b70 - unwind::try::haea8bc421c68cd5epFc
  34:     0x7f256bf77930 - task::Task::run::h24525a73fb4c9bb3fOb
  35:     0x7f256bf77520 - task::Task::spawn::closure.5736
  36:     0x7f256bf78f70 - thread::thread_start::ha943fdda31374bc3i6b
  37:     0x7f2566cc7e20 - start_thread
  38:     0x7f256bc3fb59 - clone
  39:                0x0 - <unknown>

$ rustc --version
rustc 0.13.0-nightly (d9c7c00b9 2014-12-04 21:33:07 +0000)

The same code ICE's with a different stack backtrace when compiling on Windows:

task 'rustc' panicked at 'assertion failed: `(left == right) && (right == left)` (left: `None`, right: `Some(())`)', F:\Dokumente\Coding\rust\rust-lang\src\librustc_typeck\check\method\confirm.rs:153


stack backtrace:
   1: 0x62f30e11 - ZN2rt4init20hfe895a7bc70b7991F2yE
   2:   0x5a5cdc - ZN6unwind18begin_unwind_inner20h76c4802219079ceddocE
   3:   0x5a5a28 - ZN6unwind16begin_unwind_fmt20hb81c38ca2ace2af7olcE
   4:  0x127e312 - ZN5check8regionck51Rcx$LT$$x27a$C$$x20$x27tcx$GT$.Visitor$LT$$x27v$GT$11visit_local20h55dad3e8b86a7683igdE
   5:  0x134628f - ZN5check38TupleArgumentsFlag...std..clone..Clone5clone20he6155115885858c9sgoE
   6:  0x133c709 - ZN5check33LvaluePreference...std..fmt..Show3fmt20h73780114875bfc9eh9mE
   7:  0x123b877
   8:  0x133ce8d - ZN5check33LvaluePreference...std..fmt..Show3fmt20h73780114875bfc9eh9mE
   9:  0x12ff7c3 - ZN5check67GatherLocalsVisitor$LT$$x27a$C$$x20$x27tcx$GT$.Visitor$LT$$x27v$GT$10visit_item20h2343e58ad8be94ecoIkE
  10:  0x133d016 - ZN5check33LvaluePreference...std..fmt..Show3fmt20h73780114875bfc9eh9mE
  11:  0x123b877
  12:  0x133ce8d - ZN5check33LvaluePreference...std..fmt..Show3fmt20h73780114875bfc9eh9mE
  13:  0x12ff750 - ZN5check67GatherLocalsVisitor$LT$$x27a$C$$x20$x27tcx$GT$.Visitor$LT$$x27v$GT$10visit_item20h2343e58ad8be94ecoIkE
  14:  0x12d8c48 - ZN6rscope28UnelidableRscope.RegionScope20default_region_bound20hc1e1f94f25defbdcqxsE
  15:  0x12fcd94 - ZN5check69CheckItemTypesVisitor$LT$$x27a$C$$x20$x27tcx$GT$.Visitor$LT$$x27v$GT$8visit_ty20h6313bfb8cd3ffc01awkE
  16:  0x12fff67 - ZN5check67GatherLocalsVisitor$LT$$x27a$C$$x20$x27tcx$GT$.Visitor$LT$$x27v$GT$10visit_item20h2343e58ad8be94ecoIkE
  17:  0x12f88f1 - ZN5check69CheckItemTypesVisitor$LT$$x27a$C$$x20$x27tcx$GT$.Visitor$LT$$x27v$GT$10visit_item20h720a968a26401682NvkE
  18:  0x12fc92f - ZN5check69CheckItemTypesVisitor$LT$$x27a$C$$x20$x27tcx$GT$.Visitor$LT$$x27v$GT$8visit_ty20h6313bfb8cd3ffc01awkE
  19: 0x615f7461


$ rustc --version
rustc 0.13.0-dev (6f4c11be3 2014-12-05 20:23:10 +0000)

I wasn't able to quickly get a minimal example, but will do so tomorrow.

@msiemens
Copy link
Contributor Author

msiemens commented Dec 6, 2014

Minimal example:

struct Container<'a> {
    s: Struct<'a>
}

struct Struct<'a> {
    parent: &'a Struct<'a>
}

impl<'a> Struct<'a> {
    pub fn new() -> Struct<'a> {
        Struct {
            parent: None
        }
    }

    pub fn get(&self, key: &str) -> Container<'a> {
        match self.parent {
            Some(ref p) => p.get(key),
            None => {/* ... */}
        }
    }
}


fn main() {
    //
}

It still produces different backtraces on Linux and Windows.

@msiemens
Copy link
Contributor Author

msiemens commented Dec 6, 2014

The code doesn't ICE when wrapping Struct::parent in an Option (as used in the impl)

barosl added a commit to barosl/rust that referenced this issue Dec 19, 2014
check::autoderef() returns a ty_err when it fails to infer the type.
probe::probe() should respect this failure and fail together to prevent
further corruption.

Call stack: check::check_method_call() -> method::lookup() ->
            probe::probe() + confirm::confirm()

Fixes rust-lang#19692.
Fixes rust-lang#19583.
Fixes rust-lang#19297.
bors added a commit that referenced this issue Dec 24, 2014
…kfelix

`check::autoderef()` returns a `ty_err` when it fails to infer the type. `probe::probe()` should respect this failure and fail together to prevent further corruption.

Fixes #19692.
Fixes #19583.
Fixes #19297.
bors added a commit that referenced this issue Dec 24, 2014
…kfelix

`check::autoderef()` returns a `ty_err` when it fails to infer the type. `probe::probe()` should respect this failure and fail together to prevent further corruption.

Fixes #19692.
Fixes #19583.
Fixes #19297.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant