Repository navigation
error: internal compiler error: src/librustc/ty/subst.rs:611: type parameter B/#2 (B/2) out of range when substituting (root type=Some((B,))) substs=[ReEarlyBound(0, 'a)] #67844
Copy link
Copy link
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-type_alias_impl_trait`#[feature(type_alias_impl_trait)]``#[feature(type_alias_impl_trait)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priorityMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.ICE tracked in rust-lang/glacier.
Description
Uncommenting the features and running in Nightly makes the complaints about unstable features go away while the panick stays.
I’m not sure yet how to make a smaller example out of this. smaller examples in comments below
This code was a step of me trying out if I could turn this working code (link) into a trait to get method syntax.
//#![feature(unboxed_closures)]
//#![feature(type_alias_impl_trait)]
type Curried<'a, A: 'a, B, C, F: Fn(A, B) -> C>
= impl Fn<(A,), Output = impl FnOnce(B) -> C + 'a> + 'a;
fn curry<'a, A: 'a, B, C, F: Fn(A, B) -> C> (f: &'a F)
-> Curried<'a, A, B, C, F>
{
move |a| move |b| f(a,b)
}
fn main() {}Errors:
Compiling playground v0.0.1 (/playground)
error[E0658]: `impl Trait` in type aliases is unstable
--> src/main.rs:4:1
|
4 | / type Curried<'a, A: 'a, B, C, F: Fn(A, B) -> C>
5 | | = impl Fn<(A,), Output = impl FnOnce(B) -> C + 'a> + 'a;
| |_________________________________________________________^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/63063
error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change. Use parenthetical notation (Fn(Foo, Bar) -> Baz) instead
--> src/main.rs:5:9
|
5 | = impl Fn<(A,), Output = impl FnOnce(B) -> C + 'a> + 'a;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/29625
error: internal compiler error: src/librustc/ty/subst.rs:611: type parameter `B/#2` (B/2) out of range when substituting (root type=Some((B,))) substs=[ReEarlyBound(0, 'a)]
thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:890:9
stack backtrace:
0: backtrace::backtrace::libunwind::trace
at /cargo/registry/src/github.life-white.uk-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
1: backtrace::backtrace::trace_unsynchronized
at /cargo/registry/src/github.life-white.uk-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:61
4: core::fmt::write
at src/libcore/fmt/mod.rs:1028
5: std::io::Write::write_fmt
at src/libstd/io/mod.rs:1412
6: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:65
7: std::sys_common::backtrace::print
at src/libstd/sys_common/backtrace.rs:50
8: std::panicking::default_hook::{{closure}}
at src/libstd/panicking.rs:188
9: std::panicking::default_hook
at src/libstd/panicking.rs:205
10: rustc_driver::report_ice
11: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:468
12: std::panicking::begin_panic
13: rustc_errors::HandlerInner::span_bug
14: rustc_errors::Handler::span_bug
15: rustc::util::bug::opt_span_bug_fmt::{{closure}}
16: rustc::ty::context::tls::with_opt::{{closure}}
17: rustc::ty::context::tls::with_context_opt
18: rustc::ty::context::tls::with_opt
19: rustc::util::bug::opt_span_bug_fmt
20: rustc::util::bug::span_bug_fmt
21: <rustc::ty::subst::SubstFolder as rustc::ty::fold::TypeFolder>::fold_ty
22: rustc::ty::fold::TypeFoldable::fold_with
23: rustc::ty::structural_impls::<impl rustc::ty::fold::TypeFoldable for &rustc::ty::TyS>::super_fold_with
24: <rustc::ty::subst::SubstFolder as rustc::ty::fold::TypeFolder>::fold_ty
25: rustc::ty::fold::TypeFoldable::fold_with
26: rustc::ty::subst::Subst::subst
27: <core::iter::adapters::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
28: rustc::ty::GenericPredicates::instantiate_into
29: rustc::infer::opaque_types::Instantiator::fold_opaque_ty
30: <rustc::ty::fold::BottomUpFolder<F,G,H> as rustc::ty::fold::TypeFolder>::fold_ty
31: rustc::infer::opaque_types::Instantiator::fold_opaque_ty
32: <rustc::ty::fold::BottomUpFolder<F,G,H> as rustc::ty::fold::TypeFolder>::fold_ty
33: rustc_typeck::check::FnCtxt::instantiate_opaque_types_from_value
34: rustc_typeck::check::check_fn
35: rustc::ty::context::tls::with_context::{{closure}}
36: rustc_typeck::check::typeck_tables_of
37: rustc::ty::query::__query_compute::typeck_tables_of
38: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::typeck_tables_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::find_opaque_ty_constraints::ConstraintLocator::check
42: rustc::hir::intravisit::Visitor::visit_nested_item
43: rustc_typeck::collect::find_opaque_ty_constraints
44: rustc_typeck::collect::checked_type_of
45: rustc_typeck::collect::type_of
46: rustc::ty::query::__query_compute::type_of
47: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::type_of>::compute
48: rustc::dep_graph::graph::DepGraph::with_task_impl
49: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
50: <rustc_typeck::collect::CollectItemTypesVisitor as rustc::hir::intravisit::Visitor>::visit_item
51: rustc::hir::map::Map::visit_item_likes_in_module
52: rustc_typeck::collect::collect_mod_item_types
53: rustc::ty::query::__query_compute::collect_mod_item_types
54: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::collect_mod_item_types>::compute
55: rustc::dep_graph::graph::DepGraph::with_task_impl
56: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
57: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::ensure_query
58: rustc_typeck::check_crate::{{closure}}::{{closure}}
59: rustc::util::common::time
60: rustc_typeck::check_crate
61: rustc_interface::passes::analysis
62: rustc::ty::query::__query_compute::analysis
63: rustc::dep_graph::graph::DepGraph::with_task_impl
64: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
65: rustc_interface::passes::BoxedGlobalCtxt::access::{{closure}}
66: rustc_interface::passes::create_global_ctxt::{{closure}}
67: rustc_interface::passes::BoxedGlobalCtxt::enter
68: rustc_interface::interface::run_compiler_in_existing_thread_pool
69: std::thread::local::LocalKey<T>::with
70: scoped_tls::ScopedKey<T>::set
71: syntax::with_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
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.40.0 (73528e339 2019-12-16) running on x86_64-unknown-linux-gnu
note: compiler flags: -C codegen-units=1 -C debuginfo=2 --crate-type bin
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [typeck_tables_of] processing `curry`
#1 [type_of] processing `Curried`
#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 3 previous errors
For more information about this error, try `rustc --explain E0658`.
error: could not compile `playground`.
To learn more, run the command again with --verbose.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-type_alias_impl_trait`#[feature(type_alias_impl_trait)]``#[feature(type_alias_impl_trait)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priorityMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.ICE tracked in rust-lang/glacier.
Type
Projects
- StatusShow more project fieldsDone
Activity
matthewjasper commentedon Jan 3, 2020
Minimized:
steffahn commentedon Jan 3, 2020
Ah, neat, so it has nothing to do with closures or Fn traits.
pnkfelix commentedon Jan 16, 2020
T-compiler triage: I'm going to assume from @matthewjasper 's self-assignment that this does not require discussion at T-compiler meeting. Removing I-nominated label.
Aaron1011 commentedon Jan 23, 2020
Are nested type-alias-impl-traits even allowed by the RFC? If not, we should check and emit an error we we construct the type.
matthewjasper commentedon Jan 23, 2020
They are
Properly use parent generics for opaque types
Rollup merge of rust-lang#69008 - Aaron1011:fix/opaque-ty-parent, r=m…
steffahn commentedon Feb 13, 2020
@Aaron1011 any ideas how I can get my original example running though?
I was starting with this function (which does compile)
and wanted to give a name to its return type.
The straightforward approach seems to be
But the compiler is still unhappy with lifetimes currently, after your fix. I'm getting the following.
At least it works without the lifetimes (i.e. after removing parametrization over 'a and replacing all occurrences of 'a with 'static).
steffahn commentedon Feb 13, 2020
@Aaron1011
Also I'm now (self-compiled master with the fix) getting a panic on this (admittedly incorrect) program:
which didn't panic on the latest nightly (2020-02-13).
Edit: I double checked: the behavior changes precisely over your 2 commits.
Message is:
Aaron1011 commentedon Feb 13, 2020
@steffahn: Can you open separate issues for each of those problems?
steffahn commentedon Feb 13, 2020
@Aaron1011 Okay, done ^^ (#69136, #69137)