-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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 with generic_const_exprs
and adt_const_params
#97047
Comments
A reduced version: #![feature(adt_const_params, generic_const_exprs)]
pub struct Changes<const CHANGES: &'static [&'static str]>
where
[(); CHANGES.len()]:,
{
changes: [usize; CHANGES.len()],
}
impl<const CHANGES: &'static [&'static str]> Changes<CHANGES>
where
[(); CHANGES.len()]:,
{
pub const fn new() -> Self {
Self {
changes: [0; CHANGES.len()],
}
}
} Error message
Rust versionTested in play.rust-lang.org using |
The other ICE block is also standalone #![feature(adt_const_params, generic_const_exprs)]
pub struct Changes<const CHANGES: &'static [&'static str]>
where
[(); CHANGES.len()]:,
{
changes: [usize; CHANGES.len()],
}
impl<const CHANGES: &'static [&'static str]> Changes<CHANGES>
where
[(); CHANGES.len()]:,
{
pub fn combine(&mut self, other: &Self) {
for _change in &self.changes {}
}
}
|
for the first example: #![feature(adt_const_params, generic_const_exprs)]
pub struct Changes<const CHANGES: &'static [&'static str]>
where
[(); CHANGES.len()]:,
{
changes: [usize; CHANGES.len()],
}
impl<const CHANGES: &'static [&'static str]> Changes<CHANGES>
where
[(); CHANGES.len()]:,
{
pub const fn new() -> Self {
Self {
changes: [0; CHANGES.len()],
}
}
}
Regression in 772d51f 🤔 EDIT: same for the second snippet. |
This is caused by #90529. Seems as if this issue takes care of this FIXME ^^. Not sure what the right solution is, we originally tried to skip reborrows because implicit autorefs/autoderefs lead to confusing error messages given that we don't support derefs and refs in abstract consts. Maybe the right solution is to just clarify that autorefs/autoderefs happen there. Thoughts @lcnr? |
…ulacrum add ice test for rust-lang#97047 Fixes rust-lang#97047
Rollup of 6 pull requests Successful merges: - rust-lang#98701 (Add regression test for rust-lang#50439) - rust-lang#98715 (add ice test for rust-lang#97047) - rust-lang#98753 (Fix `x dist rust-dev` on a fresh checkout) - rust-lang#98805 (Add rust-lang#95469 to the release notes) - rust-lang#98812 (feat: Add a documentation problem issue template) - rust-lang#98819 (update Miri) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Code
Meta
rustc --version --verbose
:Error output
Backtrace
The text was updated successfully, but these errors were encountered: