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

thread 'rustc' panicked at 'Failed to get parent for DefId(0:5 ~ playground[5c45]::{{impl}}[1])', src/librustc/traits/specialize/specialization_graph.rs:390:52 #67856

Closed
steffahn opened this issue Jan 4, 2020 · 0 comments · Fixed by #67867
Assignees
Labels
C-bug Category: This is a bug. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` F-unboxed_closures `#![feature(unboxed_closures)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@steffahn
Copy link
Member

steffahn commented Jan 4, 2020

Didn’t find a way (yet?) to do this for traits that are not FnOnce, also didn’t find a way to trigger the panic without having a conflicting trait implementation.

Where it currently says &F, you can also use F, &mut F, && F, ect, ..., or Box<F>. Seems like, possibly, everything that already implements FnOnce triggers the panic.

This also panicks on stable(1.40.0), also with features commented out (though it’ll complain about unstable/missing features before the panic).

#![feature(unboxed_closures)]
#![feature(type_alias_impl_trait)]
#![feature(fn_traits)]

trait MyTrait {}
impl MyTrait for () {}

impl<F> FnOnce<()> for &F {
    type Output = impl MyTrait ;
    fn call_once(self, _:() ) -> Self::Output { }
}

(Playground)

Errors:

   Compiling playground v0.0.1 (/playground)
error[E0119]: conflicting implementations of trait `std::ops::FnOnce<()>` for type `&_`:
 --> src/lib.rs:8:1
  |
8 | impl<F> FnOnce<()> for &F {
  | ^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: conflicting implementation in crate `core`:
          - impl<A, F> std::ops::FnOnce<A> for &F
            where F: std::ops::Fn<A>, F: ?Sized;

thread 'rustc' panicked at 'Failed to get parent for DefId(0:5 ~ playground[5c45]::{{impl}}[1])', src/librustc/traits/specialize/specialization_graph.rs:390:52
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:77
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1057
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1426
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:195
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:215
  10: rustc_driver::report_ice
  11: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:476
  12: rust_begin_unwind
             at src/libstd/panicking.rs:376
  13: std::panicking::begin_panic_fmt
             at src/libstd/panicking.rs:327
  14: rustc::traits::specialize::specialization_graph::Graph::parent::{{closure}}
  15: rustc::traits::specialize::specialization_graph::Graph::parent
  16: rustc::traits::specialize::specialization_graph::Ancestors::leaf_def
  17: rustc::traits::project::assoc_ty_def
  18: rustc::infer::InferCtxt::commit_if_ok
  19: rustc::traits::project::opt_normalize_projection_type
  20: rustc::traits::project::normalize_projection_type
  21: <rustc::traits::project::AssocTypeNormalizer as rustc::ty::fold::TypeFolder>::fold_ty
  22: <smallvec::SmallVec<A> as core::iter::traits::collect::FromIterator<<A as smallvec::Array>::Item>>::from_iter
  23: rustc::ty::fold::TypeFoldable::fold_with
  24: rustc::traits::project::normalize
  25: rustc_typeck::check::Inherited::normalize_associated_types_in
  26: rustc::ty::context::tls::with_context::{{closure}}
  27: rustc_typeck::check::typeck_tables_of
  28: rustc::ty::query::__query_compute::typeck_tables_of
  29: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::typeck_tables_of>::compute
  30: rustc::dep_graph::graph::DepGraph::with_task_impl
  31: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  32: rustc_typeck::collect::find_opaque_ty_constraints::ConstraintLocator::check
  33: rustc::hir::intravisit::Visitor::visit_nested_impl_item
  34: rustc::hir::intravisit::walk_item
  35: rustc_typeck::collect::find_opaque_ty_constraints
  36: rustc_typeck::collect::type_of
  37: rustc::ty::query::__query_compute::type_of
  38: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::type_of>::compute
  39: rustc::dep_graph::graph::DepGraph::with_task_impl
  40: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  41: <rustc_typeck::collect::CollectItemTypesVisitor as rustc::hir::intravisit::Visitor>::visit_impl_item
  42: rustc::hir::map::Map::visit_item_likes_in_module
  43: rustc_typeck::collect::collect_mod_item_types
  44: rustc::ty::query::__query_compute::collect_mod_item_types
  45: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::collect_mod_item_types>::compute
  46: rustc::dep_graph::graph::DepGraph::with_task_impl
  47: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  48: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::ensure_query
  49: rustc_typeck::check_crate::{{closure}}::{{closure}}
  50: rustc::util::common::time
  51: rustc_typeck::check_crate
  52: rustc_interface::passes::analysis
  53: rustc::ty::query::__query_compute::analysis
  54: rustc::dep_graph::graph::DepGraph::with_task_impl
  55: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  56: rustc::ty::context::tls::enter_global
  57: rustc_interface::interface::run_compiler_in_existing_thread_pool
  58: scoped_tls::ScopedKey<T>::set
  59: syntax::with_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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.42.0-nightly (da3629b05 2019-12-29) running on x86_64-unknown-linux-gnu

note: compiler flags: -C codegen-units=1 -C debuginfo=2 --crate-type lib

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

query stack during panic:
#0 [typeck_tables_of] processing `<impl std::ops::FnOnce<()> for &F>::call_once`
#1 [type_of] processing `<impl std::ops::FnOnce<()> for &F>::Output`
#2 [collect_mod_item_types] collecting item types in top-level module
#3 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error

For more information about this error, try `rustc --explain E0119`.
error: could not compile `playground`.

To learn more, run the command again with --verbose.

@JohnTitor JohnTitor added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` F-unboxed_closures `#![feature(unboxed_closures)]` labels Jan 4, 2020
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Jan 5, 2020
@matthewjasper matthewjasper self-assigned this Jan 11, 2020
@bors bors closed this as completed in 1d9c69f Jan 12, 2020
@oli-obk oli-obk moved this from Todo to Done in type alias impl trait stabilization Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` F-unboxed_closures `#![feature(unboxed_closures)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Development

Successfully merging a pull request may close this issue.

4 participants