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

ICE with lifetime'd associated type on stable #61064

Closed
TheDan64 opened this issue May 23, 2019 · 5 comments
Closed

ICE with lifetime'd associated type on stable #61064

TheDan64 opened this issue May 23, 2019 · 5 comments
Assignees
Labels
A-associated-items Area: Associated items such as associated types and consts. A-lifetimes Area: lifetime related I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@TheDan64
Copy link
Contributor

TheDan64 commented May 23, 2019

Playground: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=8f737364785513fd20d1ef32c1c03bd6

Tested on 1.33, 1.34.2

@estebank estebank added A-associated-items Area: Associated items such as associated types and consts. A-lifetimes Area: lifetime related I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ I-nominated T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 23, 2019
@hellow554
Copy link
Contributor

Backtrace

error: internal compiler error: src/librustc/ty/subst.rs:426: Region parameter out of range when substituting in region 'a (root type=Some(&'a Bar)) (index=0)

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:558:9
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
   1: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:70
   2: std::panicking::default_hook::{{closure}}
             at src/libstd/sys_common/backtrace.rs:58
             at src/libstd/panicking.rs:200
   3: std::panicking::default_hook
             at src/libstd/panicking.rs:215
   4: rustc::util::common::panic_hook
   5: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:482
   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::structural_impls::<impl rustc::ty::fold::TypeFoldable<'tcx> for &'tcx rustc::ty::TyS<'tcx>>::super_fold_with
  16: <rustc::ty::subst::SubstFolder<'a, 'gcx, 'tcx> as rustc::ty::fold::TypeFolder<'gcx, 'tcx>>::fold_ty
  17: rustc::traits::project::opt_normalize_projection_type
  18: rustc::traits::project::normalize_projection_type
  19: <rustc::traits::project::AssociatedTypeNormalizer<'a, 'b, 'gcx, 'tcx> as rustc::ty::fold::TypeFolder<'gcx, 'tcx>>::fold_ty
  20: <smallvec::SmallVec<A> as core::iter::traits::collect::FromIterator<<A as smallvec::Array>::Item>>::from_iter
  21: rustc::ty::fold::TypeFoldable::fold_with
  22: rustc::ty::fold::TypeFoldable::fold_with
  23: rustc::ty::fold::TypeFoldable::fold_with
  24: rustc::traits::project::normalize
  25: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once
  26: <core::iter::adapters::flatten::FlatMap<I, U, F> as core::iter::traits::iterator::Iterator>::next
  27: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
  28: rustc::ty::wf::trait_obligations
  29: rustc::ty::context::GlobalCtxt::enter_local
  30: rustc_typeck::check::wfcheck::check_item_well_formed
  31: rustc::ty::query::__query_compute::check_item_well_formed
  32: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::check_item_well_formed<'tcx>>::compute
  33: rustc::dep_graph::graph::DepGraph::with_task_impl
  34: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
  35: rustc::hir::Crate::visit_all_item_likes
  36: rustc::util::common::time
  37: rustc_typeck::check_crate
  38: <std::thread::local::LocalKey<T>>::with
  39: rustc::ty::context::TyCtxt::create_and_enter
  40: rustc_driver::driver::compile_input
  41: rustc_driver::run_compiler_with_pool
  42: <scoped_tls::ScopedKey<T>>::set
  43: rustc_driver::run_compiler
  44: syntax::with_globals
  45: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:87
  46: <F as alloc::boxed::FnBox<A>>::call_box
  47: std::sys::unix::thread::Thread::new::thread_start
             at /rustc/6c2484dc3c532c052f159264e970278d8b77cdc9/src/liballoc/boxed.rs:759
             at src/libstd/sys_common/thread.rs:14
             at src/libstd/sys/unix/thread.rs:81
  48: start_thread
  49: __clone
query stack during panic:
#0 [check_item_well_formed] processing `<Foo as FooBar>`
end of query stack
error: aborting due to 3 previous errors

Some errors occurred: E0412, E0658.
For more information about an error, try `rustc --explain E0412`.

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.34.2 (6c2484dc3 2019-05-13) running on x86_64-unknown-linux-gnu

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

There has been a few issues lately with const generics, because the ICE happen altough the feature gate is missing.

Possible dup of #60814, #60813, #60724, #60619

@TheDan64
Copy link
Contributor Author

I would think this isn't a const generics issue, but rather an issue with associated types? Since lifetimes aren't currently allowed on the type definition.

@pnkfelix
Copy link
Member

yes, this is a dupe of #60654

@pnkfelix
Copy link
Member

triage: P-medium. Removing nomination since I do not think this needs discussion. Closing as dupe of #60654.

But since this (#61064) and #60654 are clearly biting people (who are then rightfully filing bugs, the compiler is asking them to do so, I'm going to assign both bugs to myself, and hopefully fix (by issuing the error diagnostic but not the ICE).

@pnkfelix pnkfelix added P-medium Medium priority and removed I-nominated labels May 23, 2019
@pnkfelix pnkfelix self-assigned this May 23, 2019
@hellow554
Copy link
Contributor

but rather an issue with associated types

Yes, you're right. Haven't payed enough attention. Sorry for that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-associated-items Area: Associated items such as associated types and consts. A-lifetimes Area: lifetime related I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants