Skip to content

assertion failed: current_depth > 1 when using generators and conservative impl trait with an impl lifetime #48969

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

Closed
LunaBorowska opened this issue Mar 12, 2018 · 2 comments
Labels
A-coroutines Area: Coroutines C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@LunaBorowska
Copy link
Contributor

LunaBorowska commented Mar 12, 2018

The following code causes an ICE.

Code

I'm pretty it can be simplified to not depend on futures crate, but that's the best I was able to get.

#![feature(generators)]

extern crate futures;

use futures::{future, Future, FutureExt};

fn main() {
    || {
        let _future = Struct::method();
        yield ();
    };
}

struct Struct;

impl<'a> Struct {
    fn method() -> impl Future<Item = (), Error = ()> + 'a {
        future::loop_fn(future::ok(()), |builder| {
            builder.map(|_| unimplemented!())
        })
    }
}

Meta

rustc 1.26.0-nightly (2789b067d 2018-03-06)
binary: rustc
commit-hash: 2789b067da2ac921b86199bde21dd231ace1da39
commit-date: 2018-03-06
host: x86_64-unknown-linux-gnu
release: 1.26.0-nightly
LLVM version: 6.0

Error message

thread 'rustc' panicked at 'assertion failed: current_depth > 1', librustc/infer/higher_ranked/mod.rs:735:21
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::_print
             at libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at libstd/sys_common/backtrace.rs:59
             at libstd/panicking.rs:207
   3: std::panicking::default_hook
             at libstd/panicking.rs:223
   4: core::ops::function::Fn::call
   5: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:403
   6: std::panicking::begin_panic
   7: rustc::infer::higher_ranked::<impl rustc::infer::InferCtxt<'a, 'gcx, 'tcx>>::plug_leaks::{{closure}}
   8: rustc::ty::subst::<impl rustc::ty::fold::TypeFoldable<'tcx> for &'tcx rustc::ty::Slice<rustc::ty::subst::Kind<'tcx>>>::super_fold_with
   9: rustc::ty::fold::TypeFoldable::fold_with
  10: rustc::ty::fold::TypeFoldable::fold_with
  11: rustc::traits::project::poly_project_and_unify_type::{{closure}}
  12: rustc::traits::project::poly_project_and_unify_type
  13: rustc::traits::select::SelectionContext::evaluate_predicate_recursively
  14: rustc::traits::select::SelectionContext::evaluate_candidate::{{closure}}
  15: rustc::traits::select::SelectionContext::evaluate_candidate
  16: rustc::traits::select::SelectionContext::evaluate_stack
  17: rustc::traits::select::SelectionContext::in_task
  18: rustc::traits::select::SelectionContext::evaluate_predicate_recursively
  19: rustc::traits::select::SelectionContext::evaluate_candidate::{{closure}}
  20: rustc::traits::select::SelectionContext::evaluate_candidate
  21: rustc::traits::select::SelectionContext::evaluate_stack
  22: rustc::traits::select::SelectionContext::in_task
  23: rustc::traits::select::SelectionContext::evaluate_predicate_recursively
  24: rustc::traits::select::SelectionContext::evaluate_candidate::{{closure}}
  25: rustc::traits::select::SelectionContext::evaluate_candidate
  26: rustc::traits::select::SelectionContext::evaluate_stack
  27: rustc::traits::select::SelectionContext::in_task
  28: rustc::traits::select::SelectionContext::evaluate_predicate_recursively
  29: rustc::traits::select::SelectionContext::evaluate_candidate::{{closure}}
  30: rustc::traits::select::SelectionContext::evaluate_candidate
  31: rustc::traits::select::SelectionContext::evaluate_stack
  32: rustc::traits::select::SelectionContext::in_task
  33: rustc::traits::select::SelectionContext::evaluate_predicate_recursively
  34: rustc::traits::select::SelectionContext::evaluate_candidate::{{closure}}
  35: rustc::traits::select::SelectionContext::evaluate_candidate
  36: rustc::traits::select::SelectionContext::evaluate_stack
  37: rustc::traits::select::SelectionContext::in_task
  38: rustc::traits::select::SelectionContext::evaluate_predicate_recursively
  39: rustc::traits::select::SelectionContext::evaluate_obligation_conservatively
  40: rustc::traits::type_known_to_meet_bound
  41: rustc::ty::util::is_freeze_raw
  42: rustc::ty::maps::<impl rustc::ty::maps::queries::is_freeze_raw<'tcx>>::compute_result
  43: rustc::dep_graph::graph::DepGraph::with_task_impl
  44: rustc::ty::maps::<impl rustc::ty::maps::queries::is_freeze_raw<'tcx>>::force
  45: rustc::ty::maps::<impl rustc::ty::maps::queries::is_freeze_raw<'tcx>>::try_get
  46: rustc::ty::maps::TyCtxtAt::is_freeze_raw
  47: rustc::ty::util::<impl rustc::ty::TyS<'tcx>>::is_freeze
  48: rustc_mir::transform::qualify_consts::Qualifier::new
  49: <rustc_mir::transform::qualify_consts::QualifyAndPromoteConstants as rustc_mir::transform::MirPass>::run_pass
  50: rustc_mir::transform::mir_validated::{{closure}}
  51: rustc_mir::transform::mir_validated
  52: rustc::ty::maps::<impl rustc::ty::maps::queries::mir_validated<'tcx>>::compute_result
  53: rustc::dep_graph::graph::DepGraph::with_task_impl
  54: rustc::ty::maps::<impl rustc::ty::maps::queries::mir_validated<'tcx>>::force
  55: rustc::ty::maps::<impl rustc::ty::maps::queries::mir_validated<'tcx>>::try_get
  56: rustc::ty::maps::TyCtxtAt::mir_validated
  57: rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::mir_validated
  58: rustc_borrowck::borrowck::borrowck
  59: rustc::dep_graph::graph::DepGraph::with_task_impl
  60: rustc::ty::maps::<impl rustc::ty::maps::queries::borrowck<'tcx>>::force
  61: rustc::ty::maps::<impl rustc::ty::maps::queries::borrowck<'tcx>>::try_get
  62: rustc::ty::maps::TyCtxtAt::borrowck
  63: rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::borrowck
  64: <rustc_borrowck::borrowck::unused::UsedMutFinder<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_nested_body
  65: rustc::hir::intravisit::walk_expr
  66: rustc_borrowck::borrowck::borrowck
  67: rustc::dep_graph::graph::DepGraph::with_task_impl
  68: rustc::ty::maps::<impl rustc::ty::maps::queries::borrowck<'tcx>>::force
  69: rustc::ty::maps::<impl rustc::ty::maps::queries::borrowck<'tcx>>::try_get
  70: rustc::ty::maps::TyCtxtAt::borrowck
  71: rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::borrowck
  72: rustc_borrowck::borrowck::check_crate
  73: rustc::ty::context::TyCtxt::create_and_enter
  74: rustc_driver::driver::compile_input
  75: rustc_driver::run_compiler

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: rustc 1.26.0-nightly (2789b067d 2018-03-06) running on x86_64-unknown-linux-gnu

note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin

note: some of the compiler flags provided by cargo are hidden
@LunaBorowska LunaBorowska changed the title assertion failed: current_depth > 1 assertion failed: current_depth > 1 when using generators and conservative impl trait with an impl lifetime Mar 12, 2018
@Centril Centril added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ A-coroutines Area: Coroutines labels Mar 16, 2018
@pietroalbini pietroalbini added the C-bug Category: This is a bug. label Apr 3, 2018
@eddyb
Copy link
Member

eddyb commented Sep 13, 2018

Shorter testcase at #51353 (comment).

@LunaBorowska
Copy link
Contributor Author

I think the issue fixed itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-coroutines Area: Coroutines C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

4 participants