Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion crates/hir-ty/src/method_resolution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1504,7 +1504,7 @@ fn autoderef_method_receiver(
ty: Ty,
) -> Vec<(Canonical<Ty>, ReceiverAdjustments)> {
let mut deref_chain: Vec<_> = Vec::new();
let mut autoderef = autoderef::Autoderef::new(table, ty, true);
let mut autoderef = autoderef::Autoderef::new(table, ty, false);
while let Some((ty, derefs)) = autoderef.next() {
deref_chain.push((
autoderef.table.canonicalize(ty).value,
Expand Down
21 changes: 21 additions & 0 deletions crates/hir-ty/src/tests/method_resolution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1236,6 +1236,27 @@ fn main() {
);
}

#[test]
fn inherent_method_ref_self_deref_raw() {
check_types(
r#"
struct Val;

impl Val {
pub fn method(&self) -> u32 {
0
}
}

fn main() {
let foo: *const Val;
foo.method();
// ^^^^^^^^^^^^ {unknown}
}
"#,
);
}

#[test]
fn trait_method_deref_raw() {
check_types(
Expand Down