jpernst/rental

Compiler crash if the rental type does not implement Debug or Display

TeXitoi opened this issue · 2 comments

test case:

#[macro_use] extern crate rental;

// comment this derive for crash
#[derive(Debug)]
pub struct I32Ref<'a> {
    r: &'a i32
}
impl<'a> ::std::ops::Deref for I32Ref<'a> {
    type Target = i32;
    fn deref(&self) -> &Self::Target { &self.r }
}

// Comment this impl for crash
impl<'a> ::std::fmt::Display for I32Ref<'a> {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        write!(f, "{}", self.r)
    }
}

rental!{
    mod rent_lib {
        pub rental RentSym<'rental>(Box<i32>, ::I32Ref<'rental>): Deref(i32);
    }
}

fn main() {
}

Sorry about missing this for so long, my notification settings were messed up.
This appears to work in that latest 0.3.3 version, reopen if it's still broken.