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

[regression] rustc panic on nightly (0667ae9 2016-05-17): Encountered errors `[FulfillmentError(Obligation(predicate=Binder(TraitPredicate #33723

Closed
zetok opened this issue May 18, 2016 · 15 comments
Assignees
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@zetok
Copy link

zetok commented May 18, 2016

https://travis-ci.org/zetok/tox/jobs/131140755#L843 ← fails on 1.10.0-nightly (0667ae9 2016-05-17)
https://travis-ci.org/zetok/tox/jobs/131120373 ← worked on the previous build(s) – 1.10.0-nightly (cd6a400 2016-05-16)

Newest nightly fails to compile something that compiled just fine for ~weeks across all Rust channels.

Fails also on osx builds.

@sanxiyn sanxiyn added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label May 20, 2016
@xen0n
Copy link
Contributor

xen0n commented May 21, 2016

Maybe it's due to #33491? Only this had something to do with obligations between 0667ae9 and cd6a400.

@arielb1
Copy link
Contributor

arielb1 commented May 22, 2016

@xen0n
Error:

error: internal compiler error: ../src/librustc/infer/mod.rs:642: Encountered errors `[FulfillmentError(Obligation(predicate=Binder(TraitPredicate(<toxcore::dht::PackedNode as std::cmp::PartialOrd>)),depth=1),Unimplemented)]` resolving bounds after type-checking

That's odd. PackedNode does not seem to implement PartialOrd at all. This seems like a later pass randomly resolving an obligation.

Could you post a backtrace (RUST_BACKTRACE=1)?

@xen0n
Copy link
Contributor

xen0n commented May 22, 2016

@arielb1 It's like this on latest nightly (179539f), zetok/tox@8c63279:

error: internal compiler error: ../src/librustc/infer/mod.rs:642: Encountered errors `[FulfillmentError(Obligation(predicate=Binder(TraitPredicate(<toxcore::dht::PackedNode as std::cmp::PartialOrd>)),depth=1),Unimplemented)]` resolving bounds after type-checking
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 'Box<Any>', ../src/libsyntax/errors/mod.rs:545
stack backtrace:
   1:     0x7ffabbe72410 - std::sys::backtrace::tracing::imp::write::h9fb600083204ae7f
   2:     0x7ffabbe8004b - std::panicking::default_hook::_$u7b$$u7b$closure$u7d$$u7d$::hca543c34f11229ac
   3:     0x7ffabbe7fbec - std::panicking::default_hook::hc2c969e7453d080c
   4:     0x7ffabbe455c8 - std::panicking::rust_panic_with_hook::hfe203e3083c2b544
   5:     0x7ffab98cb838 - std::panicking::begin_panic::hf2bac3a63b4cf82e
   6:     0x7ffab98cb6a5 - rustc::session::opt_span_bug_fmt::_$u7b$$u7b$closure$u7d$$u7d$::hf0fb5697f8f25f40
   7:     0x7ffab98cb46f - rustc::session::span_bug_fmt::h4591bcbadfc38558
   8:     0x7ffab996f30b - rustc::infer::InferCtxtBuilder::enter::_$u7b$$u7b$closure$u7d$$u7d$::ha6773c5e88930d4c
   9:     0x7ffab98e05cc - rustc_trans::common::fulfill_obligation::hb21eb8f16f9a76d1
  10:     0x7ffab9964791 - _<collector..MirNeighborCollector<'a, 'tcx> as rustc..mir..visit..Visitor<'tcx>>::visit_operand::hf0dd641ff1984693
  11:     0x7ffab9962269 - _<collector..MirNeighborCollector<'a, 'tcx> as rustc..mir..visit..Visitor<'tcx>>::visit_terminator_kind::h4eb0d7a8b3f87e9e
  12:     0x7ffab9960d64 - rustc::mir::visit::Visitor::visit_mir::h4b213039904e9146
  13:     0x7ffab995a1ea - rustc_trans::collector::collect_items_rec::h124468d64eb75cad
  14:     0x7ffab995af26 - rustc_trans::collector::collect_items_rec::h124468d64eb75cad
  15:     0x7ffab995af26 - rustc_trans::collector::collect_items_rec::h124468d64eb75cad
  16:     0x7ffab995af26 - rustc_trans::collector::collect_items_rec::h124468d64eb75cad
  17:     0x7ffab995af26 - rustc_trans::collector::collect_items_rec::h124468d64eb75cad
  18:     0x7ffab995af26 - rustc_trans::collector::collect_items_rec::h124468d64eb75cad
  19:     0x7ffab995af26 - rustc_trans::collector::collect_items_rec::h124468d64eb75cad
  20:     0x7ffab995af26 - rustc_trans::collector::collect_items_rec::h124468d64eb75cad
  21:     0x7ffab995af26 - rustc_trans::collector::collect_items_rec::h124468d64eb75cad
  22:     0x7ffab995af26 - rustc_trans::collector::collect_items_rec::h124468d64eb75cad
  23:     0x7ffab995af26 - rustc_trans::collector::collect_items_rec::h124468d64eb75cad
  24:     0x7ffab995af26 - rustc_trans::collector::collect_items_rec::h124468d64eb75cad
  25:     0x7ffab995af26 - rustc_trans::collector::collect_items_rec::h124468d64eb75cad
  26:     0x7ffab99216f3 - rustc_trans::base::collect_and_partition_translation_items::_$u7b$$u7b$closure$u7d$$u7d$::hb8ab0749c2e05a74
  27:     0x7ffab990b626 - rustc_trans::base::trans_crate::hbae75fb922e3217a
  28:     0x7ffabc3d8a63 - rustc_driver::driver::phase_4_translate_to_llvm::hf78914edeae2f0e8
  29:     0x7ffabc3d68d8 - rustc_driver::driver::compile_input::_$u7b$$u7b$closure$u7d$$u7d$::h9a2ae2a8248766a3
  30:     0x7ffabc3d30ed - rustc_driver::driver::phase_3_run_analysis_passes::_$u7b$$u7b$closure$u7d$$u7d$::he8e0792bce031dff
  31:     0x7ffabc3cc80b - rustc::ty::context::TyCtxt::create_and_enter::h9e0841510a9ae184
  32:     0x7ffabc39447c - rustc_driver::driver::compile_input::h0629572e6f316b31
  33:     0x7ffabc37f694 - rustc_driver::run_compiler::h8902aebf8b1849a8
  34:     0x7ffabc37c76e - std::panicking::try::call::hb9e578062982aefa
  35:     0x7ffabbe8e92b - __rust_try
  36:     0x7ffabbe8e8ce - __rust_maybe_catch_panic
  37:     0x7ffabc37d254 - _<F as std..boxed..FnBox<A>>::call_box::h27f542a39f1d61ef
  38:     0x7ffabbe7e154 - std::sys::thread::Thread::new::thread_start::h6f266e069bf4ec2b
  39:     0x7ffab3b45433 - start_thread
  40:     0x7ffabbadc28c - clone
  41:                0x0 - <unknown>

@xen0n
Copy link
Contributor

xen0n commented May 22, 2016

The same backtrace with my debug build:

error: internal compiler error: src/librustc/infer/mod.rs:642: Encountered errors `[FulfillmentError(Obligation(predicate=Binder(TraitPredicate(<toxcore::dht::PackedNode as std::cmp::PartialOrd>)),depth=1),Unimplemented)]` resolving bounds after type-checking
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 'Box<Any>', src/libsyntax/errors/mod.rs:545
stack backtrace:
   1:     0x7f3cbb5d17f4 - std::sys::backtrace::tracing::imp::write::h82353b94d9957b5a
                        at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:41
   2:     0x7f3cbb607fd5 - std::panicking::default_hook::_$u7b$$u7b$closure$u7d$$u7d$::hd08c9fd28a21a931
                        at src/libstd/panicking.rs:210
   3:     0x7f3cbb607583 - std::panicking::default_hook::h9f5ce461fe95b992
                        at src/libstd/panicking.rs:219
   4:     0x7f3cbb54b914 - std::panicking::rust_panic_with_hook::hfb9137c9fa89bbb0
                        at src/libstd/panicking.rs:369
   5:     0x7f3cb7ed03b6 - std::panicking::begin_panic::hfa2b023a2705aff0
                        at src/libstd/panicking.rs:327
   6:     0x7f3cb7ed0340 - syntax::errors::Handler::span_bug::hd5565a44979bfb51
                        at /run/media/xenon/arkiv0/kodez/rust/<std macros>:3
   7:     0x7f3cb7ed01f4 - rustc::session::opt_span_bug_fmt::_$u7b$$u7b$closure$u7d$$u7d$::hdce47981d13cfedb
   8:     0x7f3cb7ecfcba - rustc::ty::context::tls::with_opt::_$u7b$$u7b$closure$u7d$$u7d$::h7689487aa4411aa9
   9:     0x7f3cb7ecfb99 - rustc::ty::context::tls::with::_$u7b$$u7b$closure$u7d$$u7d$::h2673b13fde52bc54
  10:     0x7f3cb7ecfaa3 - _<std..thread..LocalKey<T>>::with::hb12eaca4e42bb0cf
                        at src/libstd/thread/local.rs:211
  11:     0x7f3cb7ecf965 - rustc::ty::context::tls::with::h54a0ff11b76451e9
                        at src/librustc/ty/context.rs:918
  12:     0x7f3cb7ecf34d - rustc::ty::context::tls::with_opt::h41d702407e5f0624
                        at src/librustc/ty/context.rs:933
  13:     0x7f3cb7ecf27f - rustc::session::opt_span_bug_fmt::h50c3c22cda036de1
                        at src/librustc/session/mod.rs:634
  14:     0x7f3cb7ecf1b8 - rustc::session::span_bug_fmt::h802dfa3bf4574d12
                        at src/librustc/session/mod.rs:627
  15:     0x7f3cb80d1fca - rustc::infer::InferCtxt::drain_fulfillment_cx_or_panic::hd9729be1aa461bc4
                        at src/librustc/macros.rs:59
  16:     0x7f3cb80cb9c8 - rustc_trans::common::fulfill_obligation::_$u7b$$u7b$closure$u7d$$u7d$::_$u7b$$u7b$closure$u7d$$u7d$::h38f536cd68233fd5
                        at src/librustc_trans/common.rs:1106
  17:     0x7f3cb80cb025 - rustc::infer::InferCtxtBuilder::enter::_$u7b$$u7b$closure$u7d$$u7d$::h89e7632291ca064a
  18:     0x7f3cb80caba4 - rustc::ty::context::tls::enter::_$u7b$$u7b$closure$u7d$$u7d$::h7b0ebd8b4f199416
  19:     0x7f3cb80ca9bf - _<std..thread..LocalKey<T>>::with::h1b4c6ce8dfe9b82b
                        at src/libstd/thread/local.rs:211
  20:     0x7f3cb80ca77d - rustc::ty::context::tls::enter::h4b21adc0faef8b81
                        at src/librustc/ty/context.rs:903
  21:     0x7f3cb80ca5ac - rustc::ty::context::GlobalCtxt::enter_local::hc12392e9d457337f
                        at src/librustc/ty/context.rs:747
  22:     0x7f3cb80ca28f - rustc::infer::InferCtxtBuilder::enter::h71d9437808bdb1e4
                        at src/librustc/infer/mod.rs:504
  23:     0x7f3cb80c544c - rustc_trans::common::fulfill_obligation::_$u7b$$u7b$closure$u7d$$u7d$::h8e7825cc08816d91
                        at src/librustc_trans/common.rs:1069
  24:     0x7f3cb80c1b79 - rustc::dep_graph::dep_tracking_map::_<impl rustc..util..common..MemoizationMap for std..cell..RefCell<rustc..dep_graph..DepTrackingMap<M>>>::memoize::hf7814e6c99519092
                        at src/librustc/dep_graph/dep_tracking_map.rs:124
  25:     0x7f3cb7efb484 - rustc_trans::common::fulfill_obligation::ha2cfa626ef3e06cf
                        at src/librustc_trans/common.rs:1063
  26:     0x7f3cb808e96a - rustc_trans::collector::do_static_trait_method_dispatch::hf8c3b0cd9cb60938
                        at src/librustc_trans/collector.rs:862
  27:     0x7f3cb808b862 - rustc_trans::collector::do_static_dispatch::hebd0040db731af8f
                        at src/librustc_trans/collector.rs:816
  28:     0x7f3cb8089f86 - _<collector..MirNeighborCollector<'a, 'tcx> as rustc..mir..visit..Visitor<'tcx>>::visit_operand::hea412d96a6bc35e8
                        at src/librustc_trans/collector.rs:555
  29:     0x7f3cb808c87d - rustc::mir::visit::Visitor::super_terminator_kind::h433fe2dbf56da278
                        at src/librustc/mir/visit.rs:409
  30:     0x7f3cb807c481 - _<collector..MirNeighborCollector<'a, 'tcx> as rustc..mir..visit..Visitor<'tcx>>::visit_terminator_kind::hffa9cf2349bca7cb
                        at src/librustc_trans/collector.rs:638
  31:     0x7f3cb807c119 - rustc::mir::visit::Visitor::super_terminator::h991cf31a745841e9
                        at src/librustc/mir/visit.rs:351
  32:     0x7f3cb807c0b8 - rustc::mir::visit::Visitor::visit_terminator::h7a99b1523723a10a
                        at src/librustc/mir/visit.rs:121
  33:     0x7f3cb807af16 - rustc::mir::visit::Visitor::super_basic_block_data::hf4c044472f884c03
                        at src/librustc/mir/visit.rs:296
  34:     0x7f3cb807add8 - rustc::mir::visit::Visitor::visit_basic_block_data::hd4841841ec751044
                        at src/librustc/mir/visit.rs:97
  35:     0x7f3cb807a525 - rustc::mir::visit::Visitor::super_mir::hdc0b160692fdc967
                        at src/librustc/mir/visit.rs:258
  36:     0x7f3cb807a2fc - rustc::mir::visit::Visitor::visit_mir::h369013c3c0aae0b6
                        at src/librustc/mir/visit.rs:91
  37:     0x7f3cb8076ae5 - rustc_trans::collector::collect_items_rec::h71c8aaf61ac7337a
                        at src/librustc_trans/collector.rs:382
  38:     0x7f3cb8076de7 - rustc_trans::collector::collect_items_rec::h71c8aaf61ac7337a
                        at src/librustc_trans/collector.rs:392
  39:     0x7f3cb8076de7 - rustc_trans::collector::collect_items_rec::h71c8aaf61ac7337a
                        at src/librustc_trans/collector.rs:392
  40:     0x7f3cb8076de7 - rustc_trans::collector::collect_items_rec::h71c8aaf61ac7337a
                        at src/librustc_trans/collector.rs:392
  41:     0x7f3cb8076de7 - rustc_trans::collector::collect_items_rec::h71c8aaf61ac7337a
                        at src/librustc_trans/collector.rs:392
  42:     0x7f3cb8076de7 - rustc_trans::collector::collect_items_rec::h71c8aaf61ac7337a
                        at src/librustc_trans/collector.rs:392
  43:     0x7f3cb8076de7 - rustc_trans::collector::collect_items_rec::h71c8aaf61ac7337a
                        at src/librustc_trans/collector.rs:392
  44:     0x7f3cb8076de7 - rustc_trans::collector::collect_items_rec::h71c8aaf61ac7337a
                        at src/librustc_trans/collector.rs:392
  45:     0x7f3cb8076de7 - rustc_trans::collector::collect_items_rec::h71c8aaf61ac7337a
                        at src/librustc_trans/collector.rs:392
  46:     0x7f3cb8076de7 - rustc_trans::collector::collect_items_rec::h71c8aaf61ac7337a
                        at src/librustc_trans/collector.rs:392
  47:     0x7f3cb8076de7 - rustc_trans::collector::collect_items_rec::h71c8aaf61ac7337a
                        at src/librustc_trans/collector.rs:392
  48:     0x7f3cb8076de7 - rustc_trans::collector::collect_items_rec::h71c8aaf61ac7337a
                        at src/librustc_trans/collector.rs:392
  49:     0x7f3cb8076de7 - rustc_trans::collector::collect_items_rec::h71c8aaf61ac7337a
                        at src/librustc_trans/collector.rs:392
  50:     0x7f3cb8074cce - rustc_trans::collector::collect_crate_translation_items::_$u7b$$u7b$closure$u7d$$u7d$::hcb88d08a1e091e91
                        at src/librustc_trans/collector.rs:285
  51:     0x7f3cb80747c2 - rustc::dep_graph::graph::DepGraph::with_ignore::he0f3197641caf72c
                        at src/librustc/dep_graph/graph.rs:54
  52:     0x7f3cb7fcf095 - rustc_trans::collector::collect_crate_translation_items::h07afceaa75719f40
                        at src/librustc_trans/collector.rs:276
  53:     0x7f3cb7fcd737 - rustc_trans::base::collect_and_partition_translation_items::_$u7b$$u7b$closure$u7d$$u7d$::h1b40dc07c5c84201
                        at src/librustc_trans/base.rs:2958
  54:     0x7f3cb7fccfb5 - rustc::util::common::time::h0b94b110eb16932e
                        at src/librustc/util/common.rs:38
  55:     0x7f3cb7f9021b - rustc_trans::base::collect_and_partition_translation_items::h682f54dfd52ee7ad
                        at src/librustc_trans/base.rs:2957
  56:     0x7f3cb7f8a662 - rustc_trans::base::trans_crate::h0d2f52cf9150d332
                        at src/librustc_trans/base.rs:2736
  57:     0x7f3cbbeaa95c - rustc_driver::driver::phase_4_translate_to_llvm::_$u7b$$u7b$closure$u7d$$u7d$::h8418984c0bc44f78
                        at src/librustc_driver/driver.rs:1045
  58:     0x7f3cbbeaa0bd - rustc::util::common::time::h156771d47d5299d9
                        at src/librustc/util/common.rs:38
  59:     0x7f3cbbc999bb - rustc_driver::driver::phase_4_translate_to_llvm::h5a4797181b85c786
                        at src/librustc_driver/driver.rs:1043
  60:     0x7f3cbbc89541 - rustc_driver::driver::compile_input::_$u7b$$u7b$closure$u7d$$u7d$::hd93daa5abe26f190
                        at src/librustc_driver/driver.rs:251
  61:     0x7f3cbbc5f532 - rustc_driver::driver::phase_3_run_analysis_passes::_$u7b$$u7b$closure$u7d$$u7d$::h2cec98064a41824e
                        at src/librustc_driver/driver.rs:1016
  62:     0x7f3cbbc5e1c5 - rustc::ty::context::tls::enter::_$u7b$$u7b$closure$u7d$$u7d$::h6fce914bb21dee1e
  63:     0x7f3cbbc5dfcf - _<std..thread..LocalKey<T>>::with::hdc9917441d7db9f6
                        at src/libstd/thread/local.rs:211
  64:     0x7f3cbbc5dd80 - rustc::ty::context::tls::enter::h93b004407fbb986a
                        at src/librustc/ty/context.rs:903
  65:     0x7f3cbbc5d973 - rustc::ty::context::tls::enter_global::_$u7b$$u7b$closure$u7d$$u7d$::hb42c74a37f4ac28c
  66:     0x7f3cbbc5d7d5 - _<std..thread..LocalKey<T>>::with::h8a262921ee70aec1
                        at src/libstd/thread/local.rs:211
  67:     0x7f3cbbc5d57b - rustc::ty::context::tls::enter_global::he4f96cc154feef14
                        at src/librustc/ty/context.rs:887
  68:     0x7f3cbbc56bd2 - rustc::ty::context::TyCtxt::create_and_enter::h093266a1f6aebc90
                        at src/librustc/ty/context.rs:685
  69:     0x7f3cbbc4e09a - rustc_driver::driver::phase_3_run_analysis_passes::h6a2fb4c38a1b9849
                        at src/librustc_driver/driver.rs:900
  70:     0x7f3cbbbdd699 - rustc_driver::driver::compile_input::hcb4c0b80738a045b
                        at src/librustc_driver/driver.rs:217
  71:     0x7f3cbbbd15c8 - rustc_driver::run_compiler_with_file_loader::hfc6bc9f2d223895f
                        at src/librustc_driver/lib.rs:217
  72:     0x7f3cbbbb3738 - rustc_driver::run_compiler::ha9dd39a77b6f9883
                        at src/librustc_driver/lib.rs:154
  73:     0x7f3cbbbae918 - rustc_driver::run::_$u7b$$u7b$closure$u7d$$u7d$::h19ce45a29dafca86
                        at src/librustc_driver/lib.rs:132
  74:     0x7f3cbbbac712 - rustc_driver::monitor::_$u7b$$u7b$closure$u7d$$u7d$::h82ece5bf391bc5fd
                        at src/librustc_driver/lib.rs:1044
  75:     0x7f3cbbbac5e9 - _<std..panic..AssertUnwindSafe<F> as std..ops..FnOnce<()>>::call_once::h1c0c98080f4fb76f
                        at src/libstd/panic.rs:284
  76:     0x7f3cbbbac585 - std::panicking::try::_$u7b$$u7b$closure$u7d$$u7d$::_$u7b$$u7b$closure$u7d$$u7d$::hecc2784e4826f882
  77:     0x7f3cbbbacb04 - std::panicking::try::call::hee2e41b19f6057ba
                        at src/libstd/panicking.rs:271
  78:     0x7f3cbb646997 - __rust_try
  79:     0x7f3cbb646924 - __rust_maybe_catch_panic
                        at src/libpanic_unwind/lib.rs:91
  80:     0x7f3cbbbac21d - std::panicking::try::_$u7b$$u7b$closure$u7d$$u7d$::hc325053e2cf446d3
  81:     0x7f3cbbbac0ef - _<std..thread..LocalKey<T>>::with::h228035e732e3cc97
                        at src/libstd/thread/local.rs:211
  82:     0x7f3cbbbabf67 - std::panicking::try::h701b93ee68739e1e
                        at src/libstd/panicking.rs:234
  83:     0x7f3cbbbabea0 - std::panic::catch_unwind::h84c941df2d3b2678
                        at src/libstd/panic.rs:387
  84:     0x7f3cbbbabd53 - std::thread::Builder::spawn::_$u7b$$u7b$closure$u7d$$u7d$::h2ff690d78f0e2740
  85:     0x7f3cbbbace4c - _<F as std..boxed..FnBox<A>>::call_box::h2a211d0ec3984fcf
                        at src/liballoc/boxed.rs:543
  86:     0x7f3cbb5b8c1b - _<Box<alloc..boxed..FnBox<A, Output$u3d$R$GT$$u20$$u2b$$u20$$u27$a$GT$$u20$as$u20$core..ops..FnOnce$LT$A$GT$$GT$::call_once::hcf14a84f5e7594ee
                        at src/liballoc/boxed.rs:553
  87:     0x7f3cbb5c60de - std::sys_common::thread::start_thread::h18419c8184cd096f
                        at src/libstd/sys/common/thread.rs:23
  88:     0x7f3cbb603384 - std::sys::thread::Thread::new::thread_start::h99197ac7442ad7fa
                        at src/libstd/sys/unix/thread.rs:74
  89:     0x7f3cb13e5433 - start_thread
  90:     0x7f3cbb1be28c - clone
  91:                0x0 - <unknown>

@zetok
Copy link
Author

zetok commented May 26, 2016

Now this crap also breaks beta builds and is getting stabilized? WTF?
https://travis-ci.org/zetok/tox/jobs/133076074#L843

@steveklabnik steveklabnik added the regression-from-stable-to-beta Performance or correctness regression from stable to beta. label Jun 13, 2016
@steveklabnik
Copy link
Member

Triage: it appears this is a stable-to-beta regression, so tagging.

@brson brson added I-nominated T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 23, 2016
@brson
Copy link
Contributor

brson commented Jun 23, 2016

cc @michaelwoerister related to the item collector?

@rust-lang/compiler This is a pretty ugly regression that is going to hit stable very soon. Can you consider it?

@michaelwoerister
Copy link
Member

If we don't manage fix the bug in time, we can turn off item collection for the next stable release. The results of the collector are only used for auto-tests so far.

@pnkfelix
Copy link
Member

assigning to self to reduce to test case (and maybe fix)

@pnkfelix pnkfelix self-assigned this Jun 23, 2016
@pnkfelix pnkfelix added P-high High priority and removed I-nominated labels Jun 23, 2016
@pnkfelix
Copy link
Member

Okay, I reduced the problem down to this relatively simple regression "standalone" test against the quickcheck crate. (I've left the relevant names the way that I found them within the tox unit tests, so that others can work their way backwards to the test that I narrowed this down to.)

extern crate quickcheck;
#[test]
fn send_nodes_to_bytes_test() {
    use self::quickcheck::{Arbitrary, Gen, quickcheck};

    #[derive(Copy, Clone, Debug, PartialEq, Eq)]
    struct PackedNode;

    /// Valid, random PackedNode.
    impl Arbitrary for PackedNode {
        fn arbitrary<G: Gen>(_: &mut G) -> Self { unimplemented!() }
    }

    fn with_nodes(_: PackedNode, _: Option<PackedNode>) { unimplemented!() }
    quickcheck(with_nodes as fn(PackedNode, Option<PackedNode>));
}

A semi-interesting details is that I seem to have to use a fn with two parameters, and it doesn't suffice for both the parameters to be PackedNode. (I didn't try further variations yet.)

I'm going to shift now to the quickcheck crate to see if I can extract a minimal set of traits and functions to reproduce this without requiring an external crate.

@pnkfelix
Copy link
Member

Here is a standalone file that causes the ICE on a nightly rustc:

// Heavily reduced version of `quickcheck` with an `fn main`that ICE's the compiler.
//
// This is for issue #33723.

pub trait Arbitrary : Clone + 'static {
    fn arbitrary<G>() -> Self { unimplemented! () }
    fn shrink(&self) -> Box<Iterator<Item=Self>> { unimplemented!() }
}

impl<A: Arbitrary> Arbitrary for Option<A> { }

impl<A: Arbitrary> Arbitrary for (A,)
{
    fn shrink(&self) -> Box<Iterator<Item=(A,)>> {
        let (ref a, ) = *self;
        let srest = a
            .shrink()
            .scan((), |_, _| unimplemented!());
        Box::new(srest)
    }
}

impl<A: Arbitrary, B: Arbitrary> Arbitrary for (A, B,)
{
    fn shrink(&self) -> Box<Iterator<Item=(A, B)>> {
        let (ref a, ref b) = *self;
        let srest = (b.clone(),)
            .shrink()
            .scan(a.clone(), |_, _| unimplemented!());
        Box::new(srest)
    }
}

pub fn quickcheck<A: Testable>(f: A) {
    f.result::<A>();
}

pub trait Testable : Send + 'static {
    fn result<G>(&self) { unimplemented!() }
}

impl Testable for () { }

impl<T: Testable, A: Arbitrary, B: Arbitrary> Testable for fn(A, B) -> T
{
    fn result<G_>(&self) {
        let a: (A, B) = Arbitrary::arbitrary::<G_>();
        a.shrink();
    }
}

#[derive(Clone, Debug)]
struct PackedNode;
impl Arbitrary for PackedNode { }

fn main() {
    fn with_nodes(_: PackedNode, _: Option<PackedNode>) { unimplemented!() }
    quickcheck(with_nodes as fn(PackedNode, Option<PackedNode>));
}

I'm going to open a fresh issue with this specific test case, so that we can focus on the discussion of how to resolve this without having to scroll through the stack-traces in the thread here.

@pnkfelix
Copy link
Member

pnkfelix commented Jun 27, 2016

While writing up #34503 and looking more carefully at the actual reported error, it seems like the problem here is that the compiler is erroneously requiring that the struct in question implement the PartialEq and PartialOrd traits.

  • Update: Of course, @arielb1 pointed this out up above; I overlooked that when I wrote this comment originally.

To be clear: There is no proper reason for the compiler to be requiring both of those traits in the case in question.

But, I tried adding the following (completely fake) impl of PartialOrd on the toxcore::dht::PackedNode struct, and that got the tests to compile:

impl ::std::cmp::PartialOrd for PackedNode {
    fn partial_cmp(&self, _: &Self) -> Option<::std::cmp::Ordering> {
        unimplemented!()
    }
}

@zetok I am hoping we will fix the compiler bug in the meantime (and I will make sure #34503 stays open until it is fixed), but you may want to put a work-around like the above into your code in the meantime.

@zetok
Copy link
Author

zetok commented Jun 29, 2016

@pnkfelix

I am hoping we will fix the compiler bug in the meantime (and I will make sure #34503 stays open until it is fixed), but you may want to put a work-around like the above into your code in the meantime.

I would prefer to not work around compiler bugs. As @michaelwoerister stated above, if it can't be fixed in time for release, it can be turned off.

@brson
Copy link
Contributor

brson commented Jun 29, 2016

cc @pnkfelix @rust-lang/compiler There's a release next week. Is there any hope of fixing this?

@pnkfelix
Copy link
Member

pnkfelix commented Jul 1, 2016

It turns out that PR #34419 will (indirectly) sidestep the compiler bug here and thus fix this particular issue.

I have thus beta-nominated #34419 for backport to beta; hopefully we will reach consensus on whether to do that soon.

arielb1 added a commit to arielb1/rust that referenced this issue Jul 1, 2016
Fix a bug where an obligation that depend on an erroring obligation would
be regarded as successful, leading to global cache pollution and random
lossage.

Fixes rust-lang#33723.
Fixes rust-lang#34503.
bors added a commit that referenced this issue Jul 2, 2016
fail obligations that depend on erroring obligations

Fix a bug where an obligation that depend on an erroring obligation would
be regarded as successful, leading to global cache pollution and random
lossage.

Fixes #33723.
Fixes #34503.

r? @eddyb since @nikomatsakis is on vacation

beta-nominating because of the massive lossage potential (e.g. with `Copy` this could lead to random memory leaks), plus this is a regression.
alexcrichton pushed a commit to alexcrichton/rust that referenced this issue Jul 3, 2016
Fix a bug where an obligation that depend on an erroring obligation would
be regarded as successful, leading to global cache pollution and random
lossage.

Fixes rust-lang#33723.
Fixes rust-lang#34503.
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) ❄️ P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

8 participants