-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
panic on trait implementation selection when using adt_const_params
#89690
Comments
note that passing const parameter by value does not trigger ICE #![allow(incomplete_features)]
#![feature(adt_const_params)]
#[derive(PartialEq, Eq)]
pub enum A {
A,
B,
}
pub trait B<const __: A> {
fn a(&self) {}
}
struct C;
impl B<{ A::A }> for C {}
impl B<{ A::B }> for C {}
fn no_ice() {
B::<{ A::A }>::a(&C);
} |
This doesn't ICE anymore, now gives the following error, which looks correct to me since &A::A : 'static doesn't hold:
|
it doesn't appear to be in the latest nightly yet. i'll check it a little later |
running it with
|
Hm that's weird, it doesn't ICE in playground: |
i believe it didn't reproduce in the playground unless you did something that usually uses cargo (such as running tests). simply running a program uses rustc, iirc |
I'm getting this error sporadically. I can rebuild the exact same code, and this error shows up sometimes but not others. It seems the way to make it go away is to find the file causing the error, delete the problematic match statement, save, rebuild, add the statement back again, save, and rebuild one more time. Perhaps it's an issue with an incremental build? |
Seems to be dupe of #83085. Closing in favor of that (which has a patch for fixing the issue in progress) |
code
meta
this is only possible on the nightly version, due to it using an unstable and incomplete feature (
adt_const_params
)rustc --version --verbose
:error
backtrace
details
this panic is not triggered if the source is compiled with
rustc
directly (assuming theice
function is renamed tomain
). this detail may or may not be useful, but i ran into this distinction trying to reproduce it.the error returned instead is this:
The text was updated successfully, but these errors were encountered: