-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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: cannot convert '{erased}
to a region vid
#125564
Labels
C-bug
Category: This is a bug.
E-needs-test
Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
F-adt_const_params
`#![feature(adt_const_params)]`
F-generic_const_exprs
`#![feature(generic_const_exprs)]`
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
requires-incomplete-features
This issue requires the use of incomplete features.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
#![allow(incomplete_features)]
#![feature(adt_const_params, generic_const_exprs)]
#![allow(dead_code)]
const fn catone<const M: usize>(_a: &[u8; M]) -> [u8; M + 1]
where
[(); M + 1]:,
{
unimplemented!()
}
struct Catter<const A: &'static [u8]>;
impl<const A: &'static [u8]> Catter<A>
where
[(); A.len() + 1]:,
{
const ZEROS: &'static [u8; A.len()] = &[0_u8; A.len()];
const R: &'static [u8] = &catone(Self::ZEROS);
}
fn main() {} |
cannot convert
'{erased}` to a region vid'{erased}
to a region vid
'{erased}
to a region vid'{erased}
to a region vid
8 tasks
Is this ICE still reproducible now? I cannot reproduce it on my local machine. Version info: rustc 1.83.0-nightly (363ae4188 2024-09-24)
binary: rustc
commit-hash: 363ae4188316b8b22cf6c1890bc73d84d05f70a4
commit-date: 2024-09-24
host: x86_64-unknown-linux-gnu
release: 1.83.0-nightly
LLVM version: 19.1.0 Test case: #![allow(incomplete_features)]
#![feature(unsized_const_params, generic_const_exprs)]
const fn concat_strs() -> &'static str {
const fn concat_arr<const M: usize, const N: usize>(a: [u8; M], b: [u8; N]) -> [u8; M + N] {}
impl<const A: &'static str, const B: &'static str> Inner<A, B>
where
[(); A.len()]:,
[(); B.len()]:,
[(); A.len() + B.len()]:,
{
const ABSTR: &'static str = unsafe {
std::str::from_utf8_unchecked(&concat_arr(
A.as_ptr().cast().read(),
B.as_ptr().cast().read(),
))
};
}
}
fn main() {} Command: rustc +nightly ice-125564.rs -Zincremental-verify-ich=yes -Cincremental=dir -Cdebuginfo=2 Program Outputerror[E0412]: cannot find type `Inner` in this scope
--> ice-125564.rs:7:56
|
7 | impl<const A: &'static str, const B: &'static str> Inner<A, B>
| ^^^^^ not found in this scope
error[E0308]: mismatched types
--> ice-125564.rs:4:27
|
4 | const fn concat_strs() -> &'static str {
| ----------- ^^^^^^^^^^^^ expected `&str`, found `()`
| |
| implicitly returns `()` as its body has no tail or `return` expression
error[E0308]: mismatched types
--> ice-125564.rs:5:84
|
5 | const fn concat_arr<const M: usize, const N: usize>(a: [u8; M], b: [u8; N]) -> [u8; M + N] {}
| ---------- ^^^^^^^^^^^ expected `[u8; M + N]`, found `()`
| |
| implicitly returns `()` as its body has no tail or `return` expression
|
note: consider returning one of these bindings
--> ice-125564.rs:5:57
|
5 | const fn concat_arr<const M: usize, const N: usize>(a: [u8; M], b: [u8; N]) -> [u8; M + N] {}
| ^ ^
warning: type annotations needed
--> ice-125564.rs:15:35
|
15 | A.as_ptr().cast().read(),
| ^^^^
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
= note: for more information, see issue #46906 <https://github.com/rust-lang/rust/issues/46906>
= note: `#[warn(tyvar_behind_raw_pointer)]` on by default
warning: type annotations needed
--> ice-125564.rs:16:35
|
16 | B.as_ptr().cast().read(),
| ^^^^
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
= note: for more information, see issue #46906 <https://github.com/rust-lang/rust/issues/46906>
error: aborting due to 3 previous errors; 2 warnings emitted
Some errors have detailed explanations: E0308, E0412.
For more information about an error, try `rustc --explain E0308`. |
Running @Jaic1 's code above, I also got the same exact output.
Details
error[E0412]: cannot find type `Inner` in this scope
--> test.rs:7:56
|
7 | impl<const A: &'static str, const B: &'static str> Inner<A, B>
| ^^^^^ not found in this scope
error[E0308]: mismatched types
--> test.rs:4:27
|
4 | const fn concat_strs() -> &'static str {
| ----------- ^^^^^^^^^^^^ expected `&str`, found `()`
| |
| implicitly returns `()` as its body has no tail or `return` expression
error[E0308]: mismatched types
--> test.rs:5:84
|
5 | const fn concat_arr<const M: usize, const N: usize>(a: [u8; M], b: [u8; N]) -> [u8; M + N] {}
| ---------- ^^^^^^^^^^^ expected `[u8; M + N]`, found `()`
| |
| implicitly returns `()` as its body has no tail or `return` expression
|
note: consider returning one of these bindings
--> test.rs:5:57
|
5 | const fn concat_arr<const M: usize, const N: usize>(a: [u8; M], b: [u8; N]) -> [u8; M + N] {}
| ^ ^
warning: type annotations needed
--> test.rs:15:35
|
15 | A.as_ptr().cast().read(),
| ^^^^
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
= note: for more information, see issue #46906 <https://github.com/rust-lang/rust/issues/46906>
= note: `#[warn(tyvar_behind_raw_pointer)]` on by default
warning: type annotations needed
--> test.rs:16:35
|
16 | B.as_ptr().cast().read(),
| ^^^^
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
= note: for more information, see issue #46906 <https://github.com/rust-lang/rust/issues/46906>
error: aborting due to 3 previous errors; 2 warnings emitted
Some errors have detailed explanations: E0308, E0412.
For more information about an error, try `rustc --explain E0308`. |
maybe cc @matthiaskrgr |
seems to be fixed indeed 👍 |
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.
E-needs-test
Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
F-adt_const_params
`#![feature(adt_const_params)]`
F-generic_const_exprs
`#![feature(generic_const_exprs)]`
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
requires-incomplete-features
This issue requires the use of incomplete features.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
auto-reduced (treereduce-rust):
original:
Version information
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zincremental-verify-ich=yes -Cincremental=<dir> -Cdebuginfo=2
Program output
@rustbot label +F-adt_const_params +F-generic_const_exprs
The text was updated successfully, but these errors were encountered: