derive(Debug) does not compile
jean-airoldie opened this issue · 3 comments
jean-airoldie commented
Hi,
The following does not compile:
#[ouroboros::self_referencing]
#[derive(Debug)]
pub struct Struct<'a> {
bytes: Vec<u8>,
#[borrows(bytes)]
slice: &'a [u8],
}
error: bad syntax
--> src/lib.rs:4:1
|
4 | #[derive(Debug)]
| ^^^^^^^^^^^^^^^^
error: could not compile `ouroboros-private` (lib) due to previous error
Neither does this:
#[derive(Debug)]
#[ouroboros::self_referencing]
pub struct Struct<'a> {
bytes: Vec<u8>,
#[borrows(bytes)]
slice: &'a [u8],
}
Checking ouroboros-private v0.1.0 (/home/maxence/bug/ouroboros-private)
error[E0609]: no field `bytes` on type `&Struct<'a>`
--> src/lib.rs:4:5
|
4 | bytes: Vec<u8>,
| ^^^^^ unknown field
error[E0609]: no field `slice` on type `&Struct<'a>`
--> src/lib.rs:6:5
|
6 | slice: &'a [u8],
| ^^^^^ unknown field
For more information about this error, try `rustc --explain E0609`.
error: could not compile `ouroboros-private` (lib) due to 2 previous errors
Im using rustc 1.72.0-nightly (1c53407e8 2023-05-28)
kpreid commented
You might want to write a manual impl fmt::Debug for Struct<'_>
anyway, because the derive, if it succeeded, would print the entire contents of bytes
and the entire contents of the slice
of it, duplicating some data.
jean-airoldie commented
Good point.
circuitsacul commented
But this is still a bug...