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

Compiler panic with generic_associated_types #53343

Closed
Vrixyz opened this issue Aug 14, 2018 · 1 comment
Closed

Compiler panic with generic_associated_types #53343

Vrixyz opened this issue Aug 14, 2018 · 1 comment
Labels
F-generic_associated_types `#![feature(generic_associated_types)]` a.k.a. GATs

Comments

@Vrixyz
Copy link

Vrixyz commented Aug 14, 2018

Hello, while attempting to use a lifetime bound to a generic associated type, the compiler ended up in panicking.

I tried this code (roughly 80 lines of Rust, but with specs and nphysics dependencies...)

Vrixyz/testbed-callback#2

I expected to see this happen: Not a compiler panic, I guess "You are not correctly using generic_associated_types"

Meta

All details are in my repository linked above, but for convenience, I'll paste my output :

cargo run --verbose

Compiling testbed_callback v0.1.0 (file:///Users/***/Documents/perso/testbed-callback)
     Running `rustc --crate-name testbed_callback src/main.rs --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=8c68544d0e3087a8 -C extra-filename=-8c68544d0e3087a8 --out-dir /Users/***/Documents/perso/testbed-callback/target/debug/deps -C incremental=/Users/***/Documents/perso/testbed-callback/target/debug/incremental -L dependency=/Users/***/Documents/perso/testbed-callback/target/debug/deps --extern nalgebra=/Users/***/Documents/perso/testbed-callback/target/debug/deps/libnalgebra-a27da1ab88af398c.rlib --extern ncollide2d=/Users/***/Documents/perso/testbed-callback/target/debug/deps/libncollide2d-c5db2bf8d498f1fe.rlib --extern nphysics2d=/Users/***/Documents/perso/testbed-callback/target/debug/deps/libnphysics2d-fab013328e575c2c.rlib --extern nphysics_testbed2d=/Users/***/Documents/perso/testbed-callback/target/debug/deps/libnphysics_testbed2d-fd50d71f04d30a0f.rlib --extern specs=/Users/***/Documents/perso/testbed-callback/target/debug/deps/libspecs-2561d670a586ca05.rlib`
error: internal compiler error: librustc/ty/subst.rs:425: Region parameter out of range when substituting in region 'b (root type=Some((specs::Write<'a, PhysicsWorld<'b>>,))) (index=2)

thread 'main' panicked at 'Box<Any>', librustc_errors/lib.rs:517:9
note: Run with `RUST_BACKTRACE=1` for a backtrace.
error: aborting due to previous error


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.30.0-nightly (d5a448b3f 2018-08-13) running on x86_64-apple-darwin

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

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

error: Could not compile `testbed_callback`.

Caused by:
  process didn't exit successfully: `rustc --crate-name testbed_callback src/main.rs --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=8c68544d0e3087a8 -C extra-filename=-8c68544d0e3087a8 --out-dir /Users/***/Documents/perso/testbed-callback/target/debug/deps -C incremental=/Users/***/Documents/perso/testbed-callback/target/debug/incremental -L dependency=/Users/***/Documents/perso/testbed-callback/target/debug/deps --extern nalgebra=/Users/***/Documents/perso/testbed-callback/target/debug/deps/libnalgebra-a27da1ab88af398c.rlib --extern ncollide2d=/Users/***/Documents/perso/testbed-callback/target/debug/deps/libncollide2d-c5db2bf8d498f1fe.rlib --extern nphysics2d=/Users/***/Documents/perso/testbed-callback/target/debug/deps/libnphysics2d-fab013328e575c2c.rlib --extern nphysics_testbed2d=/Users/***/Documents/perso/testbed-callback/target/debug/deps/libnphysics_testbed2d-fd50d71f04d30a0f.rlib --extern specs=/Users/***/Documents/perso/testbed-callback/target/debug/deps/libspecs-2561d670a586ca05.rlib` (exit code: 101)

Backtrace

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::begin_panic
   7: rustc_errors::Handler::span_bug
   8: rustc::util::bug::opt_span_bug_fmt::{{closure}}
   9: rustc::ty::context::tls::with_opt::{{closure}}
  10: rustc::ty::context::tls::with_context_opt
  11: rustc::ty::context::tls::with_opt
  12: rustc::util::bug::opt_span_bug_fmt
  13: rustc::util::bug::span_bug_fmt
  14: <rustc::ty::subst::SubstFolder<'a, 'gcx, 'tcx> as rustc::ty::fold::TypeFolder<'gcx, 'tcx>>::fold_region
  15: rustc::ty::fold::TypeFoldable::fold_with
  16: rustc::ty::structural_impls::<impl rustc::ty::fold::TypeFoldable<'tcx> for &'tcx rustc::ty::TyS<'tcx>>::super_fold_with
  17: <rustc::ty::subst::SubstFolder<'a, 'gcx, 'tcx> as rustc::ty::fold::TypeFolder<'gcx, 'tcx>>::fold_ty
  18: rustc::ty::fold::TypeFoldable::fold_with
  19: rustc::ty::structural_impls::<impl rustc::ty::fold::TypeFoldable<'tcx> for &'tcx rustc::ty::TyS<'tcx>>::super_fold_with
  20: <rustc::ty::subst::SubstFolder<'a, 'gcx, 'tcx> as rustc::ty::fold::TypeFolder<'gcx, 'tcx>>::fold_ty
  21: rustc::ty::fold::TypeFoldable::fold_with
  22: rustc::ty::structural_impls::<impl rustc::ty::fold::TypeFoldable<'tcx> for &'tcx rustc::ty::TyS<'tcx>>::super_fold_with
  23: <rustc::ty::subst::SubstFolder<'a, 'gcx, 'tcx> as rustc::ty::fold::TypeFolder<'gcx, 'tcx>>::fold_ty
  24: rustc::traits::project::opt_normalize_projection_type
  25: rustc::traits::project::normalize_projection_type
  26: <rustc::traits::project::AssociatedTypeNormalizer<'a, 'b, 'gcx, 'tcx> as rustc::ty::fold::TypeFolder<'gcx, 'tcx>>::fold_ty
  27: rustc::ty::fold::TypeFoldable::fold_with
  28: rustc::ty::fold::TypeFoldable::fold_with
  29: rustc::traits::project::normalize
  30: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &'a mut F>::call_once
  31: <core::iter::FlatMap<I, U, F> as core::iter::iterator::Iterator>::next
  32: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
  33: rustc::ty::wf::WfPredicates::normalize
  34: rustc::ty::wf::trait_obligations
  35: rustc::ty::context::tls::with_related_context
  36: rustc::infer::InferCtxtBuilder::enter
  37: rustc_typeck::check::wfcheck::check_item_well_formed
  38: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::check_item_well_formed<'tcx>>::compute
  39: rustc::ty::context::tls::with_context
  40: rustc::dep_graph::graph::DepGraph::with_task_impl
  41: <rustc::ty::query::plumbing::JobOwner<'a, 'tcx, Q>>::start
  42: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_with_job
  43: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
  44: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::ensure_query
  45: rustc::hir::Crate::visit_all_item_likes
  46: rustc::session::Session::track_errors
  47: rustc_typeck::check_crate
  48: rustc::ty::context::tls::enter_context
  49: <std::thread::local::LocalKey<T>>::with
  50: rustc::ty::context::TyCtxt::create_and_enter
  51: rustc_driver::driver::compile_input
  52: rustc_driver::run_compiler_with_pool
  53: syntax::with_globals
  54: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  55: __rust_maybe_catch_panic
  56: rustc_driver::run
  57: rustc_driver::main
  58: std::rt::lang_start::{{closure}}
  59: std::panicking::try::do_call
  60: __rust_maybe_catch_panic
  61: std::rt::lang_start_internal
  62: main
query stack during panic:
#0 [check_item_well_formed] processing `<DummySystem as specs::System<'a>>`
end of query stack
error: aborting due to previous error
@varkor
Copy link
Member

varkor commented Aug 14, 2018

Generic associated types haven't been implemented yet, despite there being a feature flag for them, so this error is actually expected. Closing this as a duplicate of #49362.

@varkor varkor closed this as completed Aug 14, 2018
@Centril Centril added the F-generic_associated_types `#![feature(generic_associated_types)]` a.k.a. GATs label Aug 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-generic_associated_types `#![feature(generic_associated_types)]` a.k.a. GATs
Projects
None yet
Development

No branches or pull requests

3 participants