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

compiler panic using nightly on rustc_typeck::check::compare_method::compare_impl_method::_{{closure}}::h08bef90d287aed42 #35869

Closed
seppo0010 opened this issue Aug 21, 2016 · 5 comments
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-nightly Performance or correctness regression from stable to nightly.

Comments

@seppo0010
Copy link
Contributor

I'm not quite sure if what I'm doing is correct, but since I got a compiler panic I thought I should report it. You can download the full project from here https://github.com/seppo0010/limitd-rs/tree/rustc-crash ; I created a tag to point to the commit that reproduces the crash.

The relevant code is probably within this function definition

    fn put(&self, key: &[u8], value: &[u8]) -> Box<Future<Item=(), Error=Error>> {
        let mut opts = Options::new();
        opts.create_if_missing = true;
        let db = match LDatabase::open(Path::new(&*self.path), opts) {
            Ok(db) => Box::new(db),
            Err(e) => { panic!("failed to open database: {:?}", e) }
        };
        let write_opts = WriteOptions::new();
        match db.put(write_opts, key, value) {
            Ok(_) => { return finished(()).boxed() },
            Err(e) => { return failed(Error::LevelDBError(e)).boxed() }
        }
    }

This is my rustc version

rustc --version --verbose
rustc 1.13.0-nightly (f883b0bba 2016-08-19)
binary: rustc
commit-hash: f883b0bbab6c433eb7b7042b605b4339022c563a
commit-date: 2016-08-19
host: x86_64-unknown-linux-gnu
release: 1.13.0-nightly

and the build command with the backtrace

RUST_BACKTRACE=1 cargo build --verbose
       Fresh slab v0.2.0 (https://github.com/carllerche/slab?rev=5476efcafb#5476efca)
       Fresh void v1.0.2
       Fresh semver v0.1.20
       Fresh winapi-build v0.1.1
       Fresh slab v0.2.0
       Fresh libc v0.2.15
       Fresh scoped-tls v0.1.0
       Fresh db-key v0.0.5
       Fresh winapi v0.2.8
       Fresh utf8-ranges v0.1.3
       Fresh getopts v0.2.14
       Fresh bitflags v0.4.0
       Fresh memchr v0.1.11
       Fresh protobuf v1.0.23
       Fresh db-key v0.1.0
       Fresh cfg-if v0.1.0
       Fresh regex-syntax v0.3.4
       Fresh aho-corasick v0.5.2
       Fresh log v0.3.6
       Fresh leveldb-sys v2.0.0
       Fresh net2 v0.2.26
       Fresh kernel32-sys v0.2.2
       Fresh futures v0.1.0 (https://github.com/alexcrichton/futures-rs?rev=71801dc#71801dcd)
       Fresh leveldb v0.8.3
       Fresh rustc_version v0.1.7
       Fresh time v0.1.35
       Fresh futures-io v0.1.0 (https://github.com/alexcrichton/futures-rs?rev=71801dc#71801dcd)
       Fresh thread-id v2.0.0
       Fresh thread_local v0.2.6
       Fresh regex v0.1.73
       Fresh env_logger v0.3.4
       Fresh nix v0.6.0
       Fresh mio v0.6.0-dev (https://github.com/carllerche/mio#00e19dd6)
       Fresh futures-mio v0.1.0 (https://github.com/alexcrichton/futures-rs?rev=71801dc#71801dcd)
   Compiling limitd-rs v0.1.0 (file:///home/seppo/Projects/limitd-rs)
     Running `rustc src/main.rs --crate-name limitd_rs --crate-type bin -g -C metadata=137628deb0353257 --out-dir /home/seppo/Projects/limitd-rs/target/debug --emit=dep-info,link -L dependency=/home/seppo/Projects/limitd-rs/target/debug/deps --extern futures_mio=/home/seppo/Projects/limitd-rs/target/debug/deps/libfutures_mio-3c1106ba38a0682a.rlib --extern leveldb=/home/seppo/Projects/limitd-rs/target/debug/deps/libleveldb-497869f359049725.rlib --extern net2=/home/seppo/Projects/limitd-rs/target/debug/deps/libnet2-755d3e4f87237d0e.rlib --extern time=/home/seppo/Projects/limitd-rs/target/debug/deps/libtime-750bfdd52feafcb7.rlib --extern log=/home/seppo/Projects/limitd-rs/target/debug/deps/liblog-bf16bb9a4912b11d.rlib --extern env_logger=/home/seppo/Projects/limitd-rs/target/debug/deps/libenv_logger-2296687296dd1e8e.rlib --extern futures_io=/home/seppo/Projects/limitd-rs/target/debug/deps/libfutures_io-20978b51499790d1.rlib --extern getopts=/home/seppo/Projects/limitd-rs/target/debug/deps/libgetopts-33691dbdf8852281.rlib --extern futures=/home/seppo/Projects/limitd-rs/target/debug/deps/libfutures-0ff68d58cf5da702.rlib --extern protobuf=/home/seppo/Projects/limitd-rs/target/debug/deps/libprotobuf-6820fc0a7d02519c.rlib --extern db_key=/home/seppo/Projects/limitd-rs/target/debug/deps/libdb_key-3e97f27935b69eb3.rlib -L native=/home/seppo/Projects/limitd-rs/target/debug/build/leveldb-sys-c084cdddf63c7867/out`
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: run with `RUST_BACKTRACE=1` for a backtrace

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', ../src/libcore/option.rs:326
stack backtrace:
   1:     0x7f8d0fea7de9 - std::sys::backtrace::tracing::imp::write::h482d45d91246faa2
   2:     0x7f8d0feb84dc - std::panicking::default_hook::_{{closure}}::h89158f66286b674e
   3:     0x7f8d0feb67e7 - std::panicking::default_hook::h9e30d428ee3b0c43
   4:     0x7f8d0feb6ff8 - std::panicking::rust_panic_with_hook::h2224f33fb7bf2f4c
   5:     0x7f8d0feb6e92 - std::panicking::begin_panic::hcb11a4dc6d779ae5
   6:     0x7f8d0feb6dc0 - std::panicking::begin_panic_fmt::h310416c62f3935b3
   7:     0x7f8d0feb6d41 - rust_begin_unwind
   8:     0x7f8d0ff2240f - core::panicking::panic_fmt::hc5789f4e80194729
   9:     0x7f8d0ff2233b - core::panicking::panic::h1953378f4b37b561
  10:     0x7f8d0e59bf3c - rustc_typeck::check::compare_method::compare_impl_method::_{{closure}}::h08bef90d287aed42
  11:     0x7f8d0e4f8099 - rustc_typeck::check::compare_method::compare_impl_method::he3538453c2efe177
  12:     0x7f8d0e50cde2 - rustc_typeck::check::check_impl_items_against_trait::hb105ca8bb42a0b3d
  13:     0x7f8d0e50a5a2 - rustc_typeck::check::check_item_type::hba3733559d49be1e
  14:     0x7f8d0e502deb - _<rustc_typeck..check..CheckItemTypesVisitor<'a, 'tcx> as rustc..hir..intravisit..Visitor<'tcx>>::visit_item::h369cacffbaa18923
  15:     0x7f8d0e504ceb - rustc_typeck::check::check_item_types::h81e44a5d40f450fd
  16:     0x7f8d0e57c323 - rustc_typeck::check_crate::h8ec8b2f490f5dc28
  17:     0x7f8d10297b03 - rustc_driver::driver::phase_3_run_analysis_passes::_{{closure}}::h45e03cee16dcf298
  18:     0x7f8d10264546 - rustc_driver::driver::phase_3_run_analysis_passes::hc0de40cea97d81a1
  19:     0x7f8d10250f02 - rustc_driver::driver::compile_input::hd9ecc57abd3cba85
  20:     0x7f8d10283756 - rustc_driver::run_compiler::h184264500271cc39
  21:     0x7f8d101c98c2 - std::panicking::try::do_call::h17a7a17ad7240c5c
  22:     0x7f8d0fec6846 - __rust_maybe_catch_panic
  23:     0x7f8d101e326a - _<F as alloc..boxed..FnBox<A>>::call_box::h93f9128277b2964a
  24:     0x7f8d0feb4bb2 - std::sys::thread::Thread::new::thread_start::he0bf102845911132
  25:     0x7f8d081cd181 - start_thread
  26:     0x7f8d0faef47c - __clone
  27:                0x0 - <unknown>

error: Could not compile `limitd-rs`.

Caused by:
  Process didn't exit successfully: `rustc src/main.rs --crate-name limitd_rs --crate-type bin -g -C metadata=137628deb0353257 --out-dir /home/seppo/Projects/limitd-rs/target/debug --emit=dep-info,link -L dependency=/home/seppo/Projects/limitd-rs/target/debug/deps --extern futures_mio=/home/seppo/Projects/limitd-rs/target/debug/deps/libfutures_mio-3c1106ba38a0682a.rlib --extern leveldb=/home/seppo/Projects/limitd-rs/target/debug/deps/libleveldb-497869f359049725.rlib --extern net2=/home/seppo/Projects/limitd-rs/target/debug/deps/libnet2-755d3e4f87237d0e.rlib --extern time=/home/seppo/Projects/limitd-rs/target/debug/deps/libtime-750bfdd52feafcb7.rlib --extern log=/home/seppo/Projects/limitd-rs/target/debug/deps/liblog-bf16bb9a4912b11d.rlib --extern env_logger=/home/seppo/Projects/limitd-rs/target/debug/deps/libenv_logger-2296687296dd1e8e.rlib --extern futures_io=/home/seppo/Projects/limitd-rs/target/debug/deps/libfutures_io-20978b51499790d1.rlib --extern getopts=/home/seppo/Projects/limitd-rs/target/debug/deps/libgetopts-33691dbdf8852281.rlib --extern futures=/home/seppo/Projects/limitd-rs/target/debug/deps/libfutures-0ff68d58cf5da702.rlib --extern protobuf=/home/seppo/Projects/limitd-rs/target/debug/deps/libprotobuf-6820fc0a7d02519c.rlib --extern db_key=/home/seppo/Projects/limitd-rs/target/debug/deps/libdb_key-3e97f27935b69eb3.rlib -L native=/home/seppo/Projects/limitd-rs/target/debug/build/leveldb-sys-c084cdddf63c7867/out` (exit code: 101)

Thanks!

@TimNN
Copy link
Contributor

TimNN commented Aug 21, 2016

Minimized:

trait Foo {
    fn foo(&self, &str);
}

struct Bar;

impl Foo for Bar {
    fn foo(&self, _: &[u8]) {}
}

fn main() {}

Actual Error:

error[E0053]: method `foo` has an incompatible type for trait
 --> <anon>:8:5
  |
8 |     fn foo(&self, _: &[u8]) {}
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected str, found slice
  |
  = note: expected type `fn(&Bar, &str)`
  = note:    found type `fn(&Bar, &[u8])`

Regression from beta / stable to nightly.

@TimNN
Copy link
Contributor

TimNN commented Aug 21, 2016

Nightly nightly-2016-08-18 is still fine, nightly-2016-08-19 first shows the ICE.

@TimNN
Copy link
Contributor

TimNN commented Aug 21, 2016

I assume this was introduced by #35765.

@TimNN
Copy link
Contributor

TimNN commented Aug 21, 2016

A bit more simplified (no need for slices, any reference will do):

trait Foo {
    fn foo(&self, &u8);
}

struct Bar;

impl Foo for Bar {
    fn foo(&self, _: &u16) {}
}

fn main() {}

@frewsxcv
Copy link
Member

Addressed by #35877

@jdm jdm added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. labels Aug 25, 2016
Manishearth added a commit to Manishearth/rust that referenced this issue Aug 27, 2016
Fix ICE when arg types can't be found in impl/trait methods while comparing

Fixes rust-lang#35869.
bors added a commit that referenced this issue Aug 27, 2016
Fix ICE when arg types can't be found in impl/trait methods while comparing

Fixes #35869.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-nightly Performance or correctness regression from stable to nightly.
Projects
None yet
Development

No branches or pull requests

4 participants