Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CI after Rust 1.83 #246

Merged
merged 5 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ jobs:
RUST_BACKTRACE: 1
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-C debuginfo=0 --deny warnings ${{ matrix.platform.rustflags }}"
OPTIONS: ${{ matrix.platform.options }}
# Disable doc tests on Rust 1.83
OPTIONS: ${{ matrix.platform.options }} ${{ matrix.rust_version == 'stable' && '--lib' || '' }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we link an issue or comment describing this problem in more detail?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I linked to rust-lang/rust#132203

Copy link
Member

@MarijnS95 MarijnS95 Dec 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for doing your due diligence to look up the actual upstream issue. I'll comment there later because it doesn't seem to be explicitly mentioned that this "regression" has trickled into 1.83 - i.e. they didn't fix / back it out before the release.

At the same time I hate to call this a regression, it's a good change. As outlined in #127 (comment) already, I feel like having the path relative to README.md (i.e. the span of that file) is much more sensible than having it relative to whichever random file (or files, it could be multiple in different locations) is/are including README.md.
But that requires a breaking change...

EDIT: upstream Rust issues and pull requests are incredibly poorly documented. They all reference each other, but none of them have an accurate summary describing what they're observing or changing, requiring one to follow links all the way to the beginning, then unwind again to understand what is going on:

  1. Span in rustdoc errors is incorrectly reported for include_str!(): rustdoc reports issues against lib.rs rather than an include_str!'d file rust-lang/rust#130470
  2. Fix for that: rustdoc: use the correct span for doctests rust-lang/rust#130582
  3. That fix regresses recursive imports: regression: change in paths/CWD for rustdoc tests rust-lang/rust#132203
  4. Fixing regression by making it an edition 2024 change: rustdoc: make doctest span tweak a 2024 edition change rust-lang/rust#132210
  5. Decision to change such behaviour must have a tracking issue etc: Tracking issue for Rust 2024: Fix doctest include paths rust-lang/rust#132230
    (Notice my frustration again: this spends more words explaining what a tracking issue is, than describing what it is tracking beyond "fixing the path used for include in rustdoc doctests")

FEATURES: ${{ format(',{0}', matrix.platform.features ) }}
CMD: ${{ matrix.platform.cmd }}
RUSTDOCFLAGS: -Dwarnings
Expand Down
7 changes: 5 additions & 2 deletions src/backends/cg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,10 @@ impl<D, W> Drop for CGImpl<D, W> {

impl<D: HasDisplayHandle, W: HasWindowHandle> SurfaceInterface<D, W> for CGImpl<D, W> {
type Context = D;
type Buffer<'a> = BufferImpl<'a, D, W> where Self: 'a;
type Buffer<'a>
= BufferImpl<'a, D, W>
where
Self: 'a;

fn new(window_src: W, _display: &D) -> Result<Self, InitError<W>> {
// `NSView`/`UIView` can only be accessed from the main thread.
Expand Down Expand Up @@ -288,7 +291,7 @@ pub struct BufferImpl<'a, D, W> {
buffer: Vec<u32>,
}

impl<'a, D: HasDisplayHandle, W: HasWindowHandle> BufferInterface for BufferImpl<'a, D, W> {
impl<D: HasDisplayHandle, W: HasWindowHandle> BufferInterface for BufferImpl<'_, D, W> {
#[inline]
fn pixels(&self) -> &[u32] {
&self.buffer
Expand Down
7 changes: 5 additions & 2 deletions src/backends/kms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,10 @@ struct SharedBuffer {

impl<D: HasDisplayHandle + ?Sized, W: HasWindowHandle> SurfaceInterface<D, W> for KmsImpl<D, W> {
type Context = Arc<KmsDisplayImpl<D>>;
type Buffer<'a> = BufferImpl<'a, D, W> where Self: 'a;
type Buffer<'a>
= BufferImpl<'a, D, W>
where
Self: 'a;

/// Create a new KMS backend.
fn new(window: W, display: &Arc<KmsDisplayImpl<D>>) -> Result<Self, InitError<W>> {
Expand Down Expand Up @@ -191,7 +194,7 @@ impl<D: HasDisplayHandle + ?Sized, W: HasWindowHandle> SurfaceInterface<D, W> fo
.filter(|connector| {
connector
.current_encoder()
.map_or(false, |encoder| encoders.contains(&encoder))
.is_some_and(|encoder| encoders.contains(&encoder))
})
.map(|info| info.handle())
.collect::<Vec<_>>();
Expand Down
11 changes: 7 additions & 4 deletions src/backends/orbital.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl OrbitalMap {
unsafe { slice::from_raw_parts(self.address as *const u32, self.size_unaligned / 4) }
}

unsafe fn data_mut(&self) -> &mut [u32] {
unsafe fn data_mut(&mut self) -> &mut [u32] {
unsafe { slice::from_raw_parts_mut(self.address as *mut u32, self.size_unaligned / 4) }
}
}
Expand Down Expand Up @@ -99,7 +99,7 @@ impl<D: HasDisplayHandle, W: HasWindowHandle> OrbitalImpl<D, W> {

{
// Map window buffer
let window_map =
let mut window_map =
unsafe { OrbitalMap::new(self.window_fd(), window_width * window_height * 4) }
.expect("failed to map orbital window");

Expand Down Expand Up @@ -128,7 +128,10 @@ impl<D: HasDisplayHandle, W: HasWindowHandle> OrbitalImpl<D, W> {

impl<D: HasDisplayHandle, W: HasWindowHandle> SurfaceInterface<D, W> for OrbitalImpl<D, W> {
type Context = D;
type Buffer<'a> = BufferImpl<'a, D, W> where Self: 'a;
type Buffer<'a>
= BufferImpl<'a, D, W>
where
Self: 'a;

fn new(window: W, _display: &D) -> Result<Self, InitError<W>> {
let raw = window.window_handle()?.as_raw();
Expand Down Expand Up @@ -188,7 +191,7 @@ pub struct BufferImpl<'a, D, W> {
pixels: Pixels,
}

impl<'a, D: HasDisplayHandle, W: HasWindowHandle> BufferInterface for BufferImpl<'a, D, W> {
impl<D: HasDisplayHandle, W: HasWindowHandle> BufferInterface for BufferImpl<'_, D, W> {
#[inline]
fn pixels(&self) -> &[u32] {
match &self.pixels {
Expand Down
9 changes: 5 additions & 4 deletions src/backends/wayland/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,10 @@ impl<D: HasDisplayHandle + ?Sized, W: HasWindowHandle> SurfaceInterface<D, W>
for WaylandImpl<D, W>
{
type Context = Arc<WaylandDisplayImpl<D>>;
type Buffer<'a> = BufferImpl<'a, D, W> where Self: 'a;
type Buffer<'a>
= BufferImpl<'a, D, W>
where
Self: 'a;

fn new(window: W, display: &Arc<WaylandDisplayImpl<D>>) -> Result<Self, InitError<W>> {
// Get the raw Wayland window.
Expand Down Expand Up @@ -261,9 +264,7 @@ pub struct BufferImpl<'a, D: ?Sized, W> {
age: u8,
}

impl<'a, D: HasDisplayHandle + ?Sized, W: HasWindowHandle> BufferInterface
for BufferImpl<'a, D, W>
{
impl<D: HasDisplayHandle + ?Sized, W: HasWindowHandle> BufferInterface for BufferImpl<'_, D, W> {
#[inline]
fn pixels(&self) -> &[u32] {
self.stack.member()
Expand Down
7 changes: 5 additions & 2 deletions src/backends/web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,10 @@ impl<D: HasDisplayHandle, W: HasWindowHandle> WebImpl<D, W> {

impl<D: HasDisplayHandle, W: HasWindowHandle> SurfaceInterface<D, W> for WebImpl<D, W> {
type Context = WebDisplayImpl<D>;
type Buffer<'a> = BufferImpl<'a, D, W> where Self: 'a;
type Buffer<'a>
= BufferImpl<'a, D, W>
where
Self: 'a;

fn new(window: W, display: &WebDisplayImpl<D>) -> Result<Self, InitError<W>> {
let raw = window.window_handle()?.as_raw();
Expand Down Expand Up @@ -374,7 +377,7 @@ pub struct BufferImpl<'a, D, W> {
imp: &'a mut WebImpl<D, W>,
}

impl<'a, D: HasDisplayHandle, W: HasWindowHandle> BufferInterface for BufferImpl<'a, D, W> {
impl<D: HasDisplayHandle, W: HasWindowHandle> BufferInterface for BufferImpl<'_, D, W> {
fn pixels(&self) -> &[u32] {
&self.imp.buffer
}
Expand Down
7 changes: 5 additions & 2 deletions src/backends/win32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,10 @@ impl<D: HasDisplayHandle, W: HasWindowHandle> Win32Impl<D, W> {

impl<D: HasDisplayHandle, W: HasWindowHandle> SurfaceInterface<D, W> for Win32Impl<D, W> {
type Context = D;
type Buffer<'a> = BufferImpl<'a, D, W> where Self: 'a;
type Buffer<'a>
= BufferImpl<'a, D, W>
where
Self: 'a;

/// Create a new `Win32Impl` from a `Win32WindowHandle`.
fn new(window: W, _display: &D) -> Result<Self, crate::error::InitError<W>> {
Expand Down Expand Up @@ -281,7 +284,7 @@ impl<D: HasDisplayHandle, W: HasWindowHandle> SurfaceInterface<D, W> for Win32Im

pub struct BufferImpl<'a, D, W>(&'a mut Win32Impl<D, W>);

impl<'a, D: HasDisplayHandle, W: HasWindowHandle> BufferInterface for BufferImpl<'a, D, W> {
impl<D: HasDisplayHandle, W: HasWindowHandle> BufferInterface for BufferImpl<'_, D, W> {
#[inline]
fn pixels(&self) -> &[u32] {
self.0.buffer.as_ref().unwrap().pixels()
Expand Down
9 changes: 6 additions & 3 deletions src/backends/x11.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,10 @@ struct ShmBuffer {

impl<D: HasDisplayHandle + ?Sized, W: HasWindowHandle> SurfaceInterface<D, W> for X11Impl<D, W> {
type Context = Arc<X11DisplayImpl<D>>;
type Buffer<'a> = BufferImpl<'a, D, W> where Self: 'a;
type Buffer<'a>
= BufferImpl<'a, D, W>
where
Self: 'a;

/// Create a new `X11Impl` from a `HasWindowHandle`.
fn new(window_src: W, display: &Arc<X11DisplayImpl<D>>) -> Result<Self, InitError<W>> {
Expand Down Expand Up @@ -384,8 +387,8 @@ impl<D: HasDisplayHandle + ?Sized, W: HasWindowHandle> SurfaceInterface<D, W> fo

pub struct BufferImpl<'a, D: ?Sized, W: ?Sized>(&'a mut X11Impl<D, W>);

impl<'a, D: HasDisplayHandle + ?Sized, W: HasWindowHandle + ?Sized> BufferInterface
for BufferImpl<'a, D, W>
impl<D: HasDisplayHandle + ?Sized, W: HasWindowHandle + ?Sized> BufferInterface
for BufferImpl<'_, D, W>
{
#[inline]
fn pixels(&self) -> &[u32] {
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ pub struct Buffer<'a, D, W> {
_marker: PhantomData<(Arc<D>, Cell<()>)>,
}

impl<'a, D: HasDisplayHandle, W: HasWindowHandle> Buffer<'a, D, W> {
impl<D: HasDisplayHandle, W: HasWindowHandle> Buffer<'_, D, W> {
/// Is age is the number of frames ago this buffer was last presented. So if the value is
/// `1`, it is the same as the last frame, and if it is `2`, it is the same as the frame
/// before that (for backends using double buffering). If the value is `0`, it is a new
Expand Down Expand Up @@ -244,7 +244,7 @@ impl<'a, D: HasDisplayHandle, W: HasWindowHandle> Buffer<'a, D, W> {
}
}

impl<'a, D: HasDisplayHandle, W: HasWindowHandle> ops::Deref for Buffer<'a, D, W> {
impl<D: HasDisplayHandle, W: HasWindowHandle> ops::Deref for Buffer<'_, D, W> {
type Target = [u32];

#[inline]
Expand All @@ -253,7 +253,7 @@ impl<'a, D: HasDisplayHandle, W: HasWindowHandle> ops::Deref for Buffer<'a, D, W
}
}

impl<'a, D: HasDisplayHandle, W: HasWindowHandle> ops::DerefMut for Buffer<'a, D, W> {
impl<D: HasDisplayHandle, W: HasWindowHandle> ops::DerefMut for Buffer<'_, D, W> {
#[inline]
fn deref_mut(&mut self) -> &mut [u32] {
self.buffer_impl.pixels_mut()
Expand Down
Loading