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 when attempting to use const_evaluatable_checked without the feature enabled #78241

Closed
beepster4096 opened this issue Oct 22, 2020 · 6 comments
Labels
A-const-eval Area: constant evaluation (mir interpretation) A-const-generics Area: const generics (parameters and arguments) C-bug Category: This is a bug. const-generics-fixed-by-const_generics A bug that has been fixed once `const_generics` is enabled. F-generic_const_exprs `#![feature(generic_const_exprs)]` 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

@beepster4096
Copy link
Contributor

Code

trait Ice{}
impl<const N: usize> Ice for [(); N] where [(); 2 * N]:{}

Meta

rustc --version --verbose:

rustc 1.47.0 (18bf6b4f0 2020-10-07)
binary: rustc
commit-hash: 18bf6b4f01a6feaf7259ba7cdae58031af1b7b39
commit-date: 2020-10-07
host: x86_64-pc-windows-msvc
release: 1.47.0
LLVM version: 11.0

Error output

error: internal compiler error: src\librustc_middle\ty\subst.rs:568:17: const parameter `N/#0` (Const { ty: usize, val: Param(N/#0) }/0) out of range when substituting substs=[]

thread 'rustc' panicked at 'Box<Any>', /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39\src\librustc_errors\lib.rs:873: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.47.0 (18bf6b4f0 2020-10-07) running on x86_64-pc-windows-msvc

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

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

error: internal compiler error: src\librustc_middle\ty\subst.rs:568:17: const parameter `N/#0` (Const { ty: usize, val: Param(N/#0) }/0) out of range when substituting substs=[]

thread 'rustc' panicked at 'Box<Any>', /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39\src\librustc_errors\lib.rs:873:9
stack backtrace:
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.47.0 (18bf6b4f0 2020-10-07) running on x86_64-pc-windows-msvc

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

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

query stack during panic:
#0 [const_eval_raw] const-evaluating `<[u8; N] as Bruh>::{{constant}}#0`
#1 [const_eval_validated] const-evaluating + checking `<[u8; N] as Bruh>::{{constant}}#0`
#2 [const_eval_validated] const-evaluating + checking `<[u8; N] as Bruh>::{{constant}}#0`
#3 [param_env] computing normalized predicates of `<[u8; N] as Bruh>`
#4 [check_item_well_formed] checking that `<[u8; N] as Bruh>` is well-formed
#5 [analysis] running analysis passes on this crate
end of query stack

@beepster4096 beepster4096 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 Oct 22, 2020
@jonas-schievink
Copy link
Contributor

Duplicate of #43408

@jonas-schievink jonas-schievink marked this as a duplicate of #43408 Oct 22, 2020
@jonas-schievink
Copy link
Contributor

Ah, maybe not, with type generics it errors properly

@workingjubilee
Copy link
Member

@rustbot modify labels: +const-generics-fixed-by-min-const-generics, +const-generics-fixed-by-const-generics, +A-const-generics, +F-const_evaluatable_checked

@rustbot
Copy link
Collaborator

rustbot commented Oct 22, 2020

Error: Label const-generics-fixed-by-min-const-generics can only be set by Rust team members

Please let @rust-lang/release know if you're having trouble with this bot.

@camelid camelid added A-const-eval Area: constant evaluation (mir interpretation) A-const-generics Area: const generics (parameters and arguments) const-generics-fixed-by-const_generics A bug that has been fixed once `const_generics` is enabled. const-generics-fixed-by-min_const_generics F-generic_const_exprs `#![feature(generic_const_exprs)]` labels Oct 22, 2020
@camelid
Copy link
Member

camelid commented Oct 22, 2020

@workingjubilee Applied the labels you suggested.

@lcnr
Copy link
Contributor

lcnr commented Oct 22, 2020

@jonas-schievink

Ah, maybe not, with type generics it errors properly

Did you instead get a "type parameter has to be Sized" error? The following does ICE

trait Ice{}
impl<T> Ice for T where [(); 2 * std::mem::size_of::<*mut T>()]:{}

While it may not be a direct duplicate of #43408 it does have the same underlying issue and can't be fixed before the stabilization of min_const_generics. Therefore closing as duplicate

@lcnr lcnr closed this as completed Oct 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-eval Area: constant evaluation (mir interpretation) A-const-generics Area: const generics (parameters and arguments) C-bug Category: This is a bug. const-generics-fixed-by-const_generics A bug that has been fixed once `const_generics` is enabled. F-generic_const_exprs `#![feature(generic_const_exprs)]` 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

6 participants