-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
A-tytype system / type inference / traits / method resolutiontype system / type inference / traits / method resolutionC-bugCategory: bugCategory: bug
Description
rust-analyzer version: 0.3.2702-standalone
rustc version: 1.91.0
editor or extension: VS Code
relevant settings: none
code snippet to reproduce:
[dependencies]
uoctl = "1.0.1"pub const UINPUT_IOCTL_BASE: u8 = b'U';
pub const UI_DEV_CREATE: Ioctl = _IO(UINPUT_IOCTL_BASE, 1);
fn main() {
UI_DEV_CREATE.ioctl(0)
}There was a regression that happened in the last couple of weeks or months where rust-analyzer stopped correctly resolving the ioctl method. Haven't bisected reduced it or anything (I think this part of r-a is currently being reworked, so bisecting might be a waste of time).
In the uoctl crate, I've used an interesting pattern like this:
pub struct Ioctl<T: ?Sized = NoArgs> {
request: u32,
_p: PhantomData<T>,
}
pub struct NoArgs {
// Unsized type so that the `impl<T> Ioctl<T>` does not conflict.
_f: [u8],
}
impl Ioctl<NoArgs> {
pub unsafe fn ioctl(self, fd: &impl AsRawFd) -> io::Result<c_int> { ... }
}
impl<T> Ioctl<T> {
pub unsafe fn ioctl(self, fd: &impl AsRawFd, arg: T) -> io::Result<c_int> { ... }
}So these non-overlapping ioctl definitions might be confusing r-a now. Though this did work fine before.
Metadata
Metadata
Assignees
Labels
A-tytype system / type inference / traits / method resolutiontype system / type inference / traits / method resolutionC-bugCategory: bugCategory: bug