-
Couldn't load subscription status.
- Fork 1.9k
Closed
Labels
A-tytype system / type inference / traits / method resolutiontype system / type inference / traits / method resolutionB-unstableunstable featureunstable featureC-featureCategory: feature requestCategory: feature request
Description
rust-analyzer version: 0.3.1557-standalone (cd3bf9f 2023-06-18)
rustc version: rustc 1.72.0-nightly (2d0aa57 2023-06-18)
relevant settings: N/A
In the following example (playground):
#![feature(arbitrary_self_types)]
struct Ptr<T> {
ptr: *const T,
}
impl<T> std::ops::Deref for Ptr<T> {
type Target = *const T;
fn deref(&self) -> &Self::Target {
&self.ptr
}
}
struct Val;
impl Val {
fn add(self: Ptr<Val>) {}
}
fn main() {
let val = Val;
let val_ptr = Ptr { ptr: &val };
val_ptr.add();
}RA complains on line 24 (val_ptr.add()):
this operation is unsafe and requires an unsafe function or blockrust-analyzer[missing-unsafe](https://rust-analyzer.github.io/manual.html#missing-unsafe)
expected 1 argument, found 0rust-analyzer[mismatched-arg-count](https://rust-analyzer.github.io/manual.html#mismatched-arg-count)
The .add method is resolved to <*const Val>::add, when it should be resolved to Val::add.
Metadata
Metadata
Assignees
Labels
A-tytype system / type inference / traits / method resolutiontype system / type inference / traits / method resolutionB-unstableunstable featureunstable featureC-featureCategory: feature requestCategory: feature request