Skip to content

ICE returning an unknown type with impl FnMut #54966

Closed
@SephVelut

Description

@SephVelut
fn generate_duration() -> Oper<impl FnMut()> {
        
}

I expected just a compiler error cannot find type Oper. Compiler panicked:

error[E0412]: cannot find type `Oper` in this scope
 --> src/lib.rs:1:27
  |
1 | fn generate_duration() -> Oper<impl FnMut()> {
  |                           ^^^^ not found in this scope

thread 'main' panicked at 'no entry found for key', libcore/option.rs:989:5
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
   1: std::sys_common::backtrace::print
   2: std::panicking::default_hook::{{closure}}
   3: std::panicking::default_hook
   4: rustc::util::common::panic_hook
   5: std::panicking::rust_panic_with_hook
   6: std::panicking::continue_panic_fmt
   7: rust_begin_unwind
   8: core::panicking::panic_fmt
   9: core::option::expect_failed
  10: rustc_typeck::collect::type_of
  11: rustc::ty::query::__query_compute::type_of
  12: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::type_of<'tcx>>::compute
  13: rustc::ty::context::tls::with_context
  14: rustc::dep_graph::graph::DepGraph::with_task_impl
  15: rustc::ty::context::tls::with_related_context
  16: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_with_job
  17: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
  18: rustc::ty::query::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::type_of
  19: rustc_typeck::check::check_item_type
  20: rustc::hir::Crate::visit_all_item_likes
  21: rustc_typeck::check::check_item_types
  22: rustc::util::common::time
  23: rustc_typeck::check_crate
  24: rustc::ty::context::tls::enter_context
  25: <std::thread::local::LocalKey<T>>::with
  26: rustc::ty::context::TyCtxt::create_and_enter
  27: rustc_driver::driver::compile_input
  28: rustc_driver::run_compiler_with_pool
  29: <scoped_tls::ScopedKey<T>>::set
  30: <scoped_tls::ScopedKey<T>>::set
  31: syntax::with_globals
  32: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  33: __rust_maybe_catch_panic
  34: rustc_driver::run
  35: rustc_driver::main
  36: std::rt::lang_start::{{closure}}
  37: std::panicking::try::do_call
  38: __rust_maybe_catch_panic
  39: std::rt::lang_start_internal
  40: main
query stack during panic:
#0 [type_of] processing `generate_duration::{{impl-Trait}}`
end of query stack
error: aborting due to previous error

For more information about this error, try `rustc --explain E0412`.

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.29.1 (b801ae664 2018-09-20) running on x86_64-apple-darwin

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

note: some of the compiler flags provided by cargo are hidden

error: Could not compile `syn`.

Meta

rustc 1.29.1 (b801ae664 2018-09-20)
binary: rustc
commit-hash: b801ae66425cf7c3c71052b19ef8f145b0d0513d
commit-date: 2018-09-20
host: x86_64-apple-darwin
release: 1.29.1
LLVM version: 7.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions