Closed
Description
Minimal test case:
struct Wrapper(~str);
impl Wrapper {
pub fn new() -> Wrapper {
Wrapper(~"Bob")
}
pub fn say_hi(&self) {
println(fmt!("hello %s", **self));
}
}
impl Drop for Wrapper {
fn drop(&mut self) {}
}
fn main() {
{
// This runs without complaint.
let x = Wrapper::new();
x.say_hi();
}
{
// This fails to compile.
// error: internal compiler error: drop_ty_immediate: non-box ty
Wrapper::new().say_hi();
}
}
I originally ran accross this when wrapping a *T
, but it also fails when I try to wrap int
and other numeric types, bool
, Option<T>
, ~T
, and other structs that also wrap a single value of those types.