Hello everyone,
The following code fails to compile with the message "mutable statics are not allowed to have destructors [E0397]" both on stable and nightly:
struct A;
trait Foo {
type Associated;
}
impl Foo for A {
type Associated = A;
}
struct Bar<T: Foo>(T::Associated);
static mut STATIC: Bar<A> = Bar(A);
Neither Bar
nor the unit struct A
implement Drop
. When you replace the definition of Bar
with struct Bar<T: Foo>(T)
or struct Bar(A)
everything works as expected (but of course these have a different intentions). Even if this is intended behaviour (which seems unlikely to me), the error message could definitely use some work.