-
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
ICE compiler panics on type inference when using proc macro (stable) #55765
Comments
This is the minimal set of impls for the traits in impl<U: FieldName, T> MaybeInit<U, T> for Uninit<U, T> {
#[inline(always)]
fn get(self) -> Option<T> {
None
}
}
impl<U: FieldName, T> MaybeInit<U, (T,)> for T {
#[inline(always)]
fn get(self) -> Option<(T,)> {
Some(Init::<U, (T,)>::get(self))
}
}
impl<U: FieldName, T> Init<U, (T,)> for T {
#[inline(always)]
fn get(self) -> (T,) {
(self,)
}
} |
On the most recent nightly (as of this comment), this is also an ICE, but the stack trace changes to
|
@estebank could you add a type-inference label, as I think that type inference is where the compiler is going wrong. --edit-- |
Can you still reproduce this? I tried a bit but could not reproduce. |
Yep, looks like it's fixed on the latest stable |
I was working on yet another implementation of the builder pattern, and pushing the type system to hold info about whether a type has been initialized. I used a proc macro to handle the boiler plate code. When I was testing it I ran into this ICE.
The code I wrote should fail to compile, but it shouldn't cause an ICE.
I tried creating a minimal example, but when I inline the macro call, the ICE disappears.
note removing type inference by changing
main
to the code below, also gets rid of hte ICE.The
PartialInit
derive macro creates this code (comments have been stripped for brevity):And the relevant code can be seen here.
the
run
crate contains the test codethe
partial-init-core
contains necessary traits and structs for partial-init-derivethe
partial-init-derive
crate contains the proc-macrostack trace
The text was updated successfully, but these errors were encountered: