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

"internal compiler error: escaping regions in predicate Obligation" with impl Trait #42981

Closed
niklasf opened this issue Jun 30, 2017 · 1 comment

Comments

@niklasf
Copy link
Contributor

niklasf commented Jun 30, 2017

Condensed code example (playground):

#![feature(conservative_impl_trait)]

struct Move { }
struct Pos { }

impl Pos {
    fn legals(&self) -> impl Iterator<Item=&Move> {
    }
}

fn main() { }

I expected to see this happen: Compiler error due to missing method body.

Instead, this happened: Internal compiler error.

Meta

rustc --version --verbose:

rustc 1.20.0-nightly (3bfc18a96 2017-06-29)
binary: rustc
commit-hash: 3bfc18a9619a5151ff4f11618db9cd882996ba6f
commit-date: 2017-06-29
host: x86_64-unknown-linux-gnu
release: 1.20.0-nightly
LLVM version: 4.0

Backtrace:

error: internal compiler error: /checkout/src/librustc_typeck/check/mod.rs:617: escaping regions in predicate Obligation(predicate=Binder(ProjectionPredicate(ProjectionTy { trait_ref: <_ as std::iter::Iterator>, item_def_id: DefId { krate: CrateNum(2), node: DefIndex(1612) => core/3f7a343::iter[0]::iterator[0]::Iterator[0]::Item[0] } }, &Move)),depth=0)
 --> err.rs:7:29
  |
7 |         fn legals(&self) -> impl Iterator<Item=&Move> {
  |                             ^^^^^^^^^^^^^^^^^^^^^^^^^

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.20.0-nightly (3bfc18a96 2017-06-29) running on x86_64-unknown-linux-gnu

note: run with `RUST_BACKTRACE=1` for a backtrace

thread 'rustc' panicked at 'Box<Any>', /checkout/src/librustc_errors/lib.rs:426
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
             at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::_print
             at /checkout/src/libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at /checkout/src/libstd/sys_common/backtrace.rs:60
             at /checkout/src/libstd/panicking.rs:355
   3: std::panicking::default_hook
             at /checkout/src/libstd/panicking.rs:365
   4: std::panicking::rust_panic_with_hook
             at /checkout/src/libstd/panicking.rs:549
   5: std::panicking::begin_panic
   6: rustc_errors::Handler::span_bug
   7: rustc::session::opt_span_bug_fmt::{{closure}}
   8: rustc::session::span_bug_fmt
   9: rustc_typeck::check::Inherited::register_predicate
  10: <rustc::ty::fold::BottomUpFolder<'a, 'gcx, 'tcx, F> as rustc::ty::fold::TypeFolder<'gcx, 'tcx>>::fold_ty
  11: rustc_typeck::check::check_fn
  12: rustc_typeck::check::typeck_tables_of::{{closure}}
  13: rustc_typeck::check::typeck_tables_of
  14: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables_of<'tcx>>::try_get
  15: rustc::ty::maps::TyCtxtAt::typeck_tables_of
  16: rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::typeck_tables_of
  17: rustc_typeck::check::typeck_item_bodies
  18: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_item_bodies<'tcx>>::try_get
  19: rustc::ty::maps::TyCtxtAt::typeck_item_bodies
  20: rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::typeck_item_bodies
  21: rustc_typeck::check_crate
  22: rustc_driver::driver::phase_3_run_analysis_passes::{{closure}}
  23: rustc_driver::driver::phase_3_run_analysis_passes
  24: rustc_driver::driver::compile_input
  25: rustc_driver::run_compiler
@niklasf
Copy link
Contributor Author

niklasf commented Jun 30, 2017

Seems to be a duplicate of #42479.

@niklasf niklasf closed this as completed Jun 30, 2017
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

No branches or pull requests

1 participant