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: compiler/rustc_middle/src/ty/subst.rs:538:17: type parameter T/#0 (T/0) out of range when substituting, substs=[] #86237

Closed
Cancelll opened this issue Jun 12, 2021 · 3 comments
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

@Cancelll
Copy link

Code

#![feature(const_generics)]
struct Foo<T = [u8; std]> {}
impl Foo {}

Meta

rustc --version --verbose:

rustc 1.54.0-nightly (0a8629bff 2021-06-11)
binary: rustc
commit-hash: 0a8629bff642c3c3b84bb644c0099194f063b627
commit-date: 2021-06-11
host: x86_64-unknown-linux-gnu
release: 1.54.0-nightly
LLVM version: 12.0.1

Error output

error[E0423]: expected value, found crate `std`
 --> mutant.rs:2:21
  |
2 | struct Foo<T = [u8; std]> {}
  |                     ^^^ not a value

warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
 --> mutant.rs:1:12
  |
1 | #![feature(const_generics)]
  |            ^^^^^^^^^^^^^^
  |
  = note: `#[warn(incomplete_features)]` on by default
  = note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information

error: internal compiler error: compiler/rustc_middle/src/ty/subst.rs:538:17: type parameter `T/#0` (T/0) out of range when substituting, substs=[]
 --> mutant.rs:3:6
  |
3 | impl Foo {}
  |      ^^^

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/0a8629bff642c3c3b84bb644c0099194f063b627/compiler/rustc_errors/src/lib.rs:953:9
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.54.0-nightly (0a8629bff 2021-06-11) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z mir-opt-level=3 -Z new-llvm-pass-manager=yes -Z unsound-mir-opts=yes -Z polonius=yes -Z polymorphize=yes -C debuginfo=2 -C opt-level=3 --crate-type staticlib

query stack during panic:
#0 [type_of] computing type of `<impl at mutant.rs:3:1: 3:12>`
#1 [collect_mod_item_types] collecting item types in top-level module
end of query stack
error: aborting due to 2 previous errors; 1 warning emitted

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

error[E0423]: expected value, found crate `std`
 --> mutant.rs:2:21
  |
2 | struct Foo<T = [u8; std]> {}
  |                     ^^^ not a value

warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
 --> mutant.rs:1:12
  |
1 | #![feature(const_generics)]
  |            ^^^^^^^^^^^^^^
  |
  = note: `#[warn(incomplete_features)]` on by default
  = note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information

error: internal compiler error: compiler/rustc_middle/src/ty/subst.rs:538:17: type parameter `T/#0` (T/0) out of range when substituting, substs=[]
 --> mutant.rs:3:6
  |
3 | impl Foo {}
  |      ^^^

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/0a8629bff642c3c3b84bb644c0099194f063b627/compiler/rustc_errors/src/lib.rs:953:9
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::subst::SubstFolder as rustc_middle::ty::fold::TypeFolder>::fold_const
  10: rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_fold_with
  11: <<dyn rustc_typeck::astconv::AstConv>::create_substs_for_ast_path::SubstsForAstPathCtxt as rustc_typeck::astconv::CreateSubstsForGenericArgsCtxt>::inferred_kind
  12: <dyn rustc_typeck::astconv::AstConv>::create_substs_for_ast_path
  13: <dyn rustc_typeck::astconv::AstConv>::ast_path_substs_for_ty
  14: <dyn rustc_typeck::astconv::AstConv>::ast_path_to_ty
  15: <dyn rustc_typeck::astconv::AstConv>::ast_ty_to_ty_inner
  16: rustc_typeck::collect::type_of::type_of
  17: rustc_query_system::query::plumbing::get_query_impl
  18: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::type_of
  19: rustc_typeck::collect::convert_item
  20: <rustc_typeck::collect::CollectItemTypesVisitor as rustc_hir::intravisit::Visitor>::visit_item
  21: rustc_middle::hir::map::Map::visit_item_likes_in_module
  22: rustc_typeck::collect::collect_mod_item_types
  23: rustc_query_system::query::plumbing::get_query_impl
  24: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::collect_mod_item_types
  25: rustc_session::session::Session::track_errors
  26: rustc_typeck::check_crate
  27: rustc_interface::passes::analysis
  28: rustc_query_system::query::plumbing::get_query_impl
  29: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
  30: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  31: rustc_span::with_source_map
  32: rustc_interface::interface::create_compiler_and_run
  33: scoped_tls::ScopedKey<T>::set
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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.54.0-nightly (0a8629bff 2021-06-11) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z mir-opt-level=3 -Z new-llvm-pass-manager=yes -Z unsound-mir-opts=yes -Z polonius=yes -Z polymorphize=yes -C debuginfo=2 -C opt-level=3 --crate-type staticlib

query stack during panic:
#0 [type_of] computing type of `<impl at mutant.rs:3:1: 3:12>`
#1 [collect_mod_item_types] collecting item types in top-level module
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 2 previous errors; 1 warning emitted

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

@Cancelll Cancelll 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 Jun 12, 2021
@Cancelll
Copy link
Author

Possibly related to #83938

@BoxyUwU
Copy link
Member

BoxyUwU commented Jun 12, 2021

I think this is the same ICE as that issue yeah

@oli-obk
Copy link
Contributor

oli-obk commented Jun 12, 2021

closing as duplicate of #83938

@oli-obk oli-obk closed this as completed Jun 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

3 participants