Skip to content

type parameter T/#0 (T/0) out of range when substituting #85137

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

Closed
edg-l opened this issue May 10, 2021 · 1 comment
Closed

type parameter T/#0 (T/0) out of range when substituting #85137

edg-l opened this issue May 10, 2021 · 1 comment
Labels
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

@edg-l
Copy link
Contributor

edg-l commented May 10, 2021

Code

trait Hello {
}

type HelloType<T = impl Hello> = T;

fn muchwow() -> HelloType {
    unimplemented!()
}


fn main() {
}

Playground Link

Meta

rustc --version --verbose:

rustc 1.52.0 (88f19c6da 2021-05-03)
binary: rustc
commit-hash: 88f19c6dab716c6281af7602e30f413e809c5974
commit-date: 2021-05-03
host: x86_64-unknown-linux-gnu
release: 1.52.0
LLVM version: 12.0.0

Error output

error: internal compiler error: compiler/rustc_middle/src/ty/subst.rs:529:17: type parameter `T/#0` (T/0) out of range when substituting, substs=[]
 --> src/main.rs:6:17
  |
6 | fn muchwow() -> HelloType {
  |                 ^^^^^^^^^

thread 'rustc' panicked at 'Box<Any>', /rustc/88f19c6dab716c6281af7602e30f413e809c5974/library/std/src/panic.rs:59:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.52.0 (88f19c6da 2021-05-03) running on x86_64-unknown-linux-gnu

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

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

query stack during panic:
#0 [fn_sig] computing function signature of `muchwow`
#1 [collect_mod_item_types] collecting item types in top-level module
end of query stack
error: aborting due to previous error

error: could not compile `minimal`

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

thread 'rustc' panicked at 'Box<Any>', /rustc/88f19c6dab716c6281af7602e30f413e809c5974/library/std/src/panic.rs:59:5
stack backtrace:
   0: std::panicking::begin_panic
   1: std::panic::panic_any
   2: rustc_errors::HandlerInner::span_bug
   3: rustc_errors::Handler::span_bug
   4: rustc_middle::ty::context::tls::with_opt
   5: rustc_middle::util::bug::opt_span_bug_fmt
   6: rustc_middle::util::bug::span_bug_fmt
   7: <rustc_middle::ty::subst::SubstFolder as rustc_middle::ty::fold::TypeFolder>::fold_ty
   8: rustc_middle::ty::fold::TypeFoldable::fold_with
   9: rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_fold_with
  10: <<dyn rustc_typeck::astconv::AstConv>::create_substs_for_ast_path::SubstsForAstPathCtxt as rustc_typeck::astconv::CreateSubstsForGenericArgsCtxt>::inferred_kind
  11: <dyn rustc_typeck::astconv::AstConv>::create_substs_for_ast_path
  12: <dyn rustc_typeck::astconv::AstConv>::ast_path_substs_for_ty
  13: <dyn rustc_typeck::astconv::AstConv>::ast_path_to_ty
  14: <dyn rustc_typeck::astconv::AstConv>::ast_ty_to_ty_inner
  15: <dyn rustc_typeck::astconv::AstConv>::ty_of_fn
  16: rustc_typeck::collect::fn_sig
  17: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  18: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  19: rustc_data_structures::stack::ensure_sufficient_stack
  20: rustc_query_system::query::plumbing::force_query_with_job
  21: rustc_query_system::query::plumbing::get_query_impl
  22: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::fn_sig
  23: rustc_typeck::collect::convert_item
  24: <rustc_typeck::collect::CollectItemTypesVisitor as rustc_hir::intravisit::Visitor>::visit_item
  25: rustc_middle::hir::map::Map::visit_item_likes_in_module
  26: rustc_typeck::collect::collect_mod_item_types
  27: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  28: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  29: rustc_query_system::query::plumbing::force_query_with_job
  30: rustc_query_system::query::plumbing::get_query_impl
  31: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::collect_mod_item_types
  32: rustc_session::session::Session::track_errors
  33: rustc_typeck::check_crate
  34: rustc_interface::passes::analysis
  35: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  36: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  37: rustc_data_structures::stack::ensure_sufficient_stack
  38: rustc_query_system::query::plumbing::force_query_with_job
  39: rustc_query_system::query::plumbing::get_query_impl
  40: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
  41: rustc_interface::passes::QueryContext::enter
  42: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  43: rustc_span::with_source_map
  44: rustc_interface::interface::create_compiler_and_run
  45: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

@edg-l edg-l 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. labels May 10, 2021
@SNCPlay42
Copy link
Contributor

Duplicate of #82952, which is already fixed on nightly/beta.

@edg-l edg-l closed this as completed May 12, 2021
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. 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

2 participants