mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-21 17:52:12 +03:00
avoid ICE in as_ref suggestion for untyped receiver
This commit is contained in:
@@ -2787,7 +2787,7 @@ fn can_use_as_ref(&self, expr: &hir::Expr<'_>) -> Option<(Vec<(Span, String)>, &
|
||||
return None;
|
||||
};
|
||||
|
||||
let self_ty = self.typeck_results.borrow().expr_ty(receiver);
|
||||
let self_ty = self.typeck_results.borrow().expr_ty_opt(receiver)?;
|
||||
let name = method_path.ident.name;
|
||||
let is_as_ref_able = match self_ty.peel_refs().kind() {
|
||||
ty::Adt(def, _) => {
|
||||
|
||||
Reference in New Issue
Block a user