Closed
Description
Minimal example here: https://is.gd/yWRQML
It appears that lifetime inference fails in a way that causes an ICE. Filling in the lifetimes manually solves the ICE, but seems unnecessary based on existing lifetime inference rules (fn foo(&self) -> &Bar
infers correctly, so intuitively this should too).
Running the example locally, I get:
$ RUST_BACKTRACE=1 cargo +nightly build --verbose
Compiling ice_test v0.1.0 (file:///home/zrneely/src/ice_test)
Running `rustc --crate-name ice_test src/main.rs --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=e6671092544cc031 -C extra-filename=-e6671092544cc031 --out-dir /home/zrneely/src/ice_test/target/debug/deps -L dependency=/home/zrneely/src/ice_test/target/debug/deps`
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 'assertion failed: match *region { ty::ReLateBound(..) => false, _ => true, }', /checkout/src/librustc/infer/higher_ranked/mod.rs:492
stack backtrace:
1: 0x7ff3279b5009 - std::sys::imp::backtrace::tracing::imp::write::hbb14611794d3841b
at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:42
2: 0x7ff3279c369e - std::panicking::default_hook::{{closure}}::h6ed906c7818ac88c
at /checkout/src/libstd/panicking.rs:351
3: 0x7ff3279c3244 - std::panicking::default_hook::h23eeafbf7c1c05c3
at /checkout/src/libstd/panicking.rs:361
4: 0x7ff3279c3afb - std::panicking::rust_panic_with_hook::hd0067971b6d1240e
at /checkout/src/libstd/panicking.rs:545
5: 0x7ff3248a1aaf - std::panicking::begin_panic::hde7d51dcf3662e2a
6: 0x7ff3249ac7d7 - rustc::infer::higher_ranked::fold_regions_in::{{closure}}::hea1fcfa314a22ba6
7: 0x7ff324a9ffad - rustc::ty::fold::TypeFolder::fold_ty::h68a470792183a4e9
8: 0x7ff3249d7014 - rustc::infer::InferCtxt::match_poly_projection_predicate::h8b51b6b4fe807f7f
9: 0x7ff324a7c7cd - rustc::traits::project::confirm_param_env_candidate::h1405ee0677619818
10: 0x7ff324a790e1 - rustc::traits::project::opt_normalize_projection_type::h9a1f08a6d84c365a
11: 0x7ff324a76915 - rustc::traits::project::normalize_projection_type::ha781dda3bc20ae6d
12: 0x7ff324a76588 - <rustc::traits::project::AssociatedTypeNormalizer<'a, 'b, 'gcx, 'tcx> as rustc::ty::fold::TypeFolder<'gcx, 'tcx>>::fold_ty::ha853479c5d2915be
13: 0x7ff324a77e51 - rustc::traits::project::opt_normalize_projection_type::h9a1f08a6d84c365a
14: 0x7ff324a742ac - rustc::traits::project::project_and_unify_type::h1c6f37e3966299ea
15: 0x7ff3249cec13 - rustc::infer::InferCtxt::commit_if_ok::heaaf11ccdfb3a3f0
16: 0x7ff324a72160 - <rustc::traits::fulfill::FulfillProcessor<'a, 'b, 'gcx, 'tcx> as rustc_data_structures::obligation_forest::ObligationProcessor>::process_obligation::h50e2a0588496d86c
17: 0x7ff324912da5 - <rustc_data_structures::obligation_forest::ObligationForest<O>>::process_obligations::h82abd7913980107a
18: 0x7ff324a70e5f - rustc::traits::fulfill::FulfillmentContext::select_where_possible::hab5c0eddfc9ae35d
19: 0x7ff32511d1e9 - rustc_typeck::check::FnCtxt::select_obligations_where_possible::ha28e350318dde14e
20: 0x7ff32511e4b0 - rustc_typeck::check::FnCtxt::check_argument_types::h957aa994cd289f96
21: 0x7ff3250f8266 - rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx>>::confirm_builtin_call::h40e1bd1893b4a8fb
22: 0x7ff3250f711d - rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx>>::check_call::h602eecfba51f9212
23: 0x7ff32512a327 - rustc_typeck::check::FnCtxt::check_expr_kind::h47d7b8c44bdda6f2
24: 0x7ff32512957d - rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_lvalue_pref::hce4fb530b89e15be
25: 0x7ff3250af495 - rustc_typeck::check::_match::<impl rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx>>::check_match::h4f0a07bc613bc073
26: 0x7ff32512a96d - rustc_typeck::check::FnCtxt::check_expr_kind::h47d7b8c44bdda6f2
27: 0x7ff32512957d - rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_lvalue_pref::hce4fb530b89e15be
28: 0x7ff32513af4d - rustc_typeck::check::FnCtxt::check_decl_initializer::hd76bb07692b005c9
29: 0x7ff32513b054 - rustc_typeck::check::FnCtxt::check_decl_local::hd0c479e258ff3ce6
30: 0x7ff32513b387 - rustc_typeck::check::FnCtxt::check_stmt::hf238c8ab59a67467
31: 0x7ff32513b6de - rustc_typeck::check::FnCtxt::check_block_with_expected::h976a451c1aea835a
32: 0x7ff32512a347 - rustc_typeck::check::FnCtxt::check_expr_kind::h47d7b8c44bdda6f2
33: 0x7ff32512957d - rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_lvalue_pref::hce4fb530b89e15be
34: 0x7ff32513b721 - rustc_typeck::check::FnCtxt::check_block_with_expected::h976a451c1aea835a
35: 0x7ff32512a347 - rustc_typeck::check::FnCtxt::check_expr_kind::h47d7b8c44bdda6f2
36: 0x7ff32512957d - rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_lvalue_pref::hce4fb530b89e15be
37: 0x7ff32510fc31 - rustc_typeck::check::check_fn::h6b753ec84c013b4a
38: 0x7ff32510ec15 - rustc_typeck::check::check_bare_fn::hb24e70a67e127683
39: 0x7ff32510bfa5 - rustc_typeck::check::check_item_bodies::h0cab204d56268561
40: 0x7ff325178547 - rustc_typeck::check_crate::h441df7c8151905be
41: 0x7ff327d61534 - rustc_driver::driver::phase_3_run_analysis_passes::{{closure}}::h7d2a6da150c7eba7
42: 0x7ff327ccfa14 - rustc::ty::context::TyCtxt::create_and_enter::h825fbad7d24d1480
43: 0x7ff327d44e63 - rustc_driver::driver::compile_input::hf3e3aa4173908b86
44: 0x7ff327d8c42d - rustc_driver::run_compiler::h8f8d47f1d258a8a6
45: 0x7ff327c967cb - std::panicking::try::do_call::h206b9daee04f4ea2
46: 0x7ff3279cc9aa - __rust_maybe_catch_panic
at /checkout/src/libpanic_unwind/lib.rs:98
47: 0x7ff327cbeb92 - <F as alloc::boxed::FnBox<A>>::call_box::h5d196fbb3229f499
48: 0x7ff3279c24e4 - std::sys::imp::thread::Thread::new::thread_start::h2c901daa88f3cb32
at /checkout/src/liballoc/boxed.rs:648
at /checkout/src/libstd/sys_common/thread.rs:21
at /checkout/src/libstd/sys/unix/thread.rs:84
49: 0x7ff31f698183 - start_thread
50: 0x7ff32766a37c - clone
51: 0x0 - <unknown>
error: Could not compile `ice_test`.
Caused by:
process didn't exit successfully: `rustc --crate-name ice_test src/main.rs --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=e6671092544cc031 -C extra-filename=-e6671092544cc031 --out-dir /home/zrneely/src/ice_test/target/debug/deps -L dependency=/home/zrneely/src/ice_test/target/debug/deps` (exit code: 101)