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

GAT ICE, without using the GAT feature #60147

Closed
remexre opened this issue Apr 21, 2019 · 6 comments
Closed

GAT ICE, without using the GAT feature #60147

remexre opened this issue Apr 21, 2019 · 6 comments
Labels
A-associated-items Area: Associated items (types, constants & functions) 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.

Comments

@remexre
Copy link
Contributor

remexre commented Apr 21, 2019

Building the ecs crate (libs/ecs) of 3fab9cb3890cff565d4dbedd9b320d6b49dd4d48 of https://github.com/remexre/ia gets the following ICE:

$ rustc --version
rustc 1.34.0 (91856ed52 2019-04-10)

$ cargo check
    Checking ecs v0.1.0 (/home/nathan/Projects/ia/libs/ecs)
error[E0658]: generic associated types are unstable (see issue #44265)
  --> libs/ecs/src/component_store.rs:81:5
   |
81 |     type Out<'a>;
   |     ^^^^^^^^^^^^^

error[E0658]: generic associated types are unstable (see issue #44265)
  --> libs/ecs/src/component_store.rs:85:5
   |
85 |     type Out<'a> = HCons<&'a H, T>;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0658]: generic associated types are unstable (see issue #44265)
  --> libs/ecs/src/component_store.rs:89:5
   |
89 |     type Out<'a> = Hlist![Entity];
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: internal compiler error: src/librustc/ty/subst.rs:426: Region parameter out of range when substituting in region 'a (root type=Some
(frunk_core::hlist::HCons<&'a H, T>)) (index=2)

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: <smallvec::SmallVec<A> as core::iter::traits::collect::FromIterator<<A as smallvec::Array>::Item>>::from_iter
  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::traits::project::opt_normalize_projection_type
  22: rustc::traits::project::normalize_projection_type
  23: <rustc::traits::project::AssociatedTypeNormalizer<'a, 'b, 'gcx, 'tcx> as rustc::ty::fold::TypeFolder<'gcx, 'tcx>>::fold_ty
  24: <smallvec::SmallVec<A> as core::iter::traits::collect::FromIterator<<A as smallvec::Array>::Item>>::from_iter
  25: rustc::ty::fold::TypeFoldable::fold_with
  26: rustc::ty::fold::TypeFoldable::fold_with
  27: rustc::ty::fold::TypeFoldable::fold_with
  28: rustc::traits::project::normalize
  29: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once
  30: <core::iter::adapters::flatten::FlatMap<I, U, F> as core::iter::traits::iterator::Iterator>::next
  31: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
  32: rustc::ty::wf::trait_obligations
  33: rustc::ty::context::GlobalCtxt::enter_local
  34: rustc_typeck::check::wfcheck::check_item_well_formed
  35: rustc::ty::query::__query_compute::check_item_well_formed
  36: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::check_item_well_formed<'tcx>>:
:compute
  37: rustc::dep_graph::graph::DepGraph::with_task_impl
  38: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
  39: rustc::hir::Crate::visit_all_item_likes
  40: rustc::util::common::time
  41: rustc_typeck::check_crate
  42: <std::thread::local::LocalKey<T>>::with
  43: rustc::ty::context::TyCtxt::create_and_enter
  44: rustc_driver::driver::compile_input
  45: rustc_driver::run_compiler_with_pool
  46: <scoped_tls::ScopedKey<T>>::set
  47: rustc_driver::run_compiler
  48: syntax::with_globals
  49: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:87
  50: <F as alloc::boxed::FnBox<A>>::call_box
  51: std::sys::unix::thread::Thread::new::thread_start
             at /rustc/91856ed52c58aa5ba66a015354d1cc69e9779bdf/src/liballoc/boxed.rs:759
             at src/libstd/sys_common/thread.rs:14
             at src/libstd/sys/unix/thread.rs:81
  52: <unknown>
             at /usr/src/debug/sys-libs/glibc-2.28-r6/glibc-2.28/nptl/pthread_create.c:486
  53: clone
             at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
query stack during panic:
#0 [check_item_well_formed] processing `<frunk_core::hlist::HCons<H, T> as component_store::IterComponents>`
end of query stack
error: aborting due to 4 previous errors

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

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.0 (91856ed52 2019-04-10) running on x86_64-unknown-linux-gnu

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 `ecs`.

To learn more, run the command again with --verbose.
@jonas-schievink jonas-schievink added A-associated-items Area: Associated items (types, constants & functions) 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. labels Apr 21, 2019
@hellow554
Copy link
Contributor

hellow554 commented Apr 23, 2019

Reduced Example:

trait Foo {}
struct Bar<H>(std::marker::PhantomData<H>);

pub trait Baz {
    type Out<'a>;
}

impl<H: Foo> Baz for Bar<H> {
    type Out<'a> = Bar<&'a H>;
}

@hellow554
Copy link
Contributor

hellow554 commented Apr 23, 2019

Bug was introduced between 68fe518...b92552d

Bisecting shows bug was introduced in b92552d

CC #57272 ping @petrochenkov

@petrochenkov
Copy link
Contributor

#57272 rather uncovered the issue than introduced it.

Semi-implemented features should issue errors rather than ICEs regardless of presence or absence of #![feature(...)].

@hellow554
Copy link
Contributor

hellow554 commented Apr 25, 2019

rather uncovered the issue than introduced

True.. sorry for that :|

Yep, that's right. Even nightly-2018-01-01 panicks with the same ICE. So this was there forever.

@jonas-schievink
Copy link
Contributor

Small reproduction from #60477:

pub trait Foo<T> {
    type Iter<'a>: Iterator<Item=&'a T>;
}

yields:

error[E0658]: generic associated types are unstable (see issue #44265)
 --> src/lib.rs:2:5
  |
2 |     type Iter<'a>: Iterator<Item=&'a T>;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:558:9
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
error: aborting due to 2 previous errors

@jonas-schievink
Copy link
Contributor

This issue is also a duplicate of #58694, so closing in favor of 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 (types, constants & functions) 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.
Projects
None yet
Development

No branches or pull requests

4 participants