Fix another ICE in point_at_expr_source_of_inferred_type

This commit is contained in:
Michael Goulet 2023-03-02 18:27:06 +00:00
parent 31f858d9a5
commit 4b01a1a07a
3 changed files with 27 additions and 1 deletions

View file

@ -315,7 +315,7 @@ fn visit_expr(&mut self, ex: &'v hir::Expr<'v>) {
probe::ProbeScope::TraitsInScope,
None,
) {
Ok(pick) => pick.self_ty,
Ok(pick) => eraser.fold_ty(pick.self_ty),
Err(_) => rcvr_ty,
};
// Remove one layer of references to account for `&mut self` and

View file

@ -0,0 +1,7 @@
// The error message here still is pretty confusing.
fn main() {
let primes = Vec::new();
primes.contains(3);
//~^ ERROR mismatched types
}

View file

@ -0,0 +1,19 @@
error[E0308]: mismatched types
--> $DIR/bad-type-in-vec-contains.rs:5:21
|
LL | primes.contains(3);
| -------- ^
| | |
| | expected `&_`, found integer
| | help: consider borrowing here: `&3`
| arguments to this method are incorrect
| here the type of `primes` is inferred to be `[_]`
|
= note: expected reference `&_`
found type `{integer}`
note: method defined here
--> $SRC_DIR/core/src/slice/mod.rs:LL:COL
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.