Closed tronical closed 1 month ago
Reduced testcase:
pub type Rgb8Pixel = rgb::RGB8;
#[derive(Debug, Clone)]
#[repr(C)]
pub struct SharedPixelBuffer<Pixel> {
data: Vec<Pixel>,
}
impl<Pixel: Clone + rgb::Pod> SharedPixelBuffer<Pixel>
where
[Pixel]: rgb::ComponentBytes<u8>,
{
pub fn as_bytes(&self) -> &[u8] {
todo!()
//use rgb::ComponentBytes;
//self.data.as_slice().as_bytes()
}
}
pub fn foo(pixels: &SharedPixelBuffer<Rgb8Pixel>) {
let _ = pixels.as_bytes();
}
compiles with rgb 0.8.40 but not 0.8.42
The underlying issue is the lack of , wait,nevermind it's already default so that can't be the issue.Pod
implementation on the pixel types like Rgb<u8>
since that is now gated behind the bytemuck
feature, I think making the bytemuck
feature a default feature should fix this.
Ah ok so the underlying issue is when we switched to a default generic implementation we use the pixel-level generic type parameter instead of the the component-level one as with the previous implementations. So this will compile:
pub type Rgb8Pixel = rgb::RGB8;
#[derive(Debug, Clone)]
#[repr(C)]
pub struct SharedPixelBuffer<Pixel> {
data: Vec<Pixel>,
}
impl<Pixel: Clone + rgb::Pod> SharedPixelBuffer<Pixel>
where
[Pixel]: rgb::ComponentBytes<Pixel>,
{
pub fn as_bytes(&self) -> &[u8] {
todo!()
//use rgb::ComponentBytes;
//self.data.as_slice().as_bytes()
}
}
pub fn foo(pixels: &SharedPixelBuffer<Rgb8Pixel>) {
let _ = pixels.as_bytes();
}
fn main() {}
I've reverted the change, yanked 0.8.42, and released 0.8.43.
Thank you :)
We see build errors in Slint with the 0.8.42 release:
Bisection suggests that this regressed with commit 788e50fa60247a5c6954944c9319abfe7088ef2d
Since 0.8.42 is a patch release, this unfortunately breaks the build of our existing releases.