Transmutations between associated types on a trait with a non-'static lifetime parameter causes ICE #21174
Labels
E-needs-test
Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Minimised example:
Both the
transmute
and thetransmute_copy
fail in the same way, with an ICE:Adding
'static
bounds toA
andB
on the trait or in the fn’s where clause doesn’t fix it, but changing<'a, T: Trait<'a>>
to<T: Trait<'static>>
does fix it. (In the particular case that I was dealing with, the lifetime could be changed to'static
where this was a problem, but it would only have taken a slight variation of it for me to be in a situation where I needed a non-'static
implementation. There were, of course, other arguments which were using the'a
.)The whole thing around there seems a bit fragile and I’m not quite sure what’s supposed to work and what’s not; if we just take an
T::A
and transmute it to()
, for example, we get “error: cannot transmute to or from a type that contains type parameters in its interior [E0139]”. Anyway, an ICE is always a bug, so here’s the report! ☺The text was updated successfully, but these errors were encountered: