Skip to content

Commit 4b01a1a

Browse files
Fix another ICE in point_at_expr_source_of_inferred_type
1 parent 31f858d commit 4b01a1a

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

compiler/rustc_hir_typeck/src/demand.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
315315
probe::ProbeScope::TraitsInScope,
316316
None,
317317
) {
318-
Ok(pick) => pick.self_ty,
318+
Ok(pick) => eraser.fold_ty(pick.self_ty),
319319
Err(_) => rcvr_ty,
320320
};
321321
// Remove one layer of references to account for `&mut self` and
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// The error message here still is pretty confusing.
2+
3+
fn main() {
4+
let primes = Vec::new();
5+
primes.contains(3);
6+
//~^ ERROR mismatched types
7+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
error[E0308]: mismatched types
2+
--> $DIR/bad-type-in-vec-contains.rs:5:21
3+
|
4+
LL | primes.contains(3);
5+
| -------- ^
6+
| | |
7+
| | expected `&_`, found integer
8+
| | help: consider borrowing here: `&3`
9+
| arguments to this method are incorrect
10+
| here the type of `primes` is inferred to be `[_]`
11+
|
12+
= note: expected reference `&_`
13+
found type `{integer}`
14+
note: method defined here
15+
--> $SRC_DIR/core/src/slice/mod.rs:LL:COL
16+
17+
error: aborting due to previous error
18+
19+
For more information about this error, try `rustc --explain E0308`.

0 commit comments

Comments
 (0)