jpernst / rental

Rust macro to generate self-referential structs
Apache License 2.0
211 stars 11 forks source link

Mention that you cannot use generic types as a suffix, potentially explain why #49

Open shepmaster opened 4 years ago

shepmaster commented 4 years ago
rental! {
    pub mod rent_query {
        use std::sync::Arc;

        #[rental]
        pub struct RentQuery<I: 'static> {
            data: Arc<Vec<u8>>,
            iter: I,
        }
    }
}
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
   --> src/main.rs:118:1
    |
118 | / rental! {
119 | |     pub mod rent_query {
120 | |         use std::sync::Arc;
121 | |
...   |
127 | |     }
128 | | }
    | |_^
    |
    = note: `I` does not have a fixed size
    = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)