});
let rptr_ty = self.new_ref_ty(pat.span, mutbl, inner_ty);
debug!("check_pat_ref: demanding {:?} = {:?}", expected, rptr_ty);
- let err = self.demand_eqtype_diag(pat.span, expected, rptr_ty);
+ let err = self.demand_eqtype_pat_diag(pat.span, expected, rptr_ty, ti);
// Look for a case like `fn foo(&foo: u32)` and suggest
// `fn foo(foo: &u32)`
--> $DIR/destructure-trait-ref.rs:32:10
|
LL | let &&x = &1isize as &dyn T;
- | ^^
+ | ^^ ----------------- this expression has type `&dyn T`
| |
| expected trait object `dyn T`, found reference
| help: you can probably remove the explicit borrow: `x`
--> $DIR/destructure-trait-ref.rs:36:11
|
LL | let &&&x = &(&1isize as &dyn T);
- | ^^
+ | ^^ -------------------- this expression has type `&&dyn T`
| |
| expected trait object `dyn T`, found reference
| help: you can probably remove the explicit borrow: `x`
error[E0308]: mismatched types
--> $DIR/issue-5100.rs:40:9
|
+LL | match (true, false) {
+ | ------------- this expression has type `(bool, bool)`
LL | &(true, false) => ()
| ^^^^^^^^^^^^^^ expected tuple, found reference
|
|
LL | fn foo(&foo: Foo) {
| ^^^^------
- | |
+ | | |
+ | | expected due to this
| expected struct `Foo`, found reference
| help: did you mean `foo`: `&Foo`
|
--> $DIR/issue-38371.rs:18:9
|
LL | fn agh(&&bar: &u32) {
- | ^^^^
+ | ^^^^ ---- expected due to this
| |
| expected `u32`, found reference
| help: you can probably remove the explicit borrow: `bar`
--> $DIR/issue-38371.rs:21:8
|
LL | fn bgh(&&bar: u32) {
- | ^^^^^ expected `u32`, found reference
+ | ^^^^^ --- expected due to this
+ | |
+ | expected `u32`, found reference
|
= note: expected type `u32`
found reference `&_`
|
LL | let &_
| ^^ types differ in mutability
+...
+LL | = foo;
+ | --- this expression has type `&mut {integer}`
|
= note: expected mutable reference `&mut {integer}`
found reference `&_`
|
LL | let &mut _
| ^^^^^^ types differ in mutability
+...
+LL | = bar;
+ | --- this expression has type `&{integer}`
|
= note: expected reference `&{integer}`
found mutable reference `&mut _`
error[E0308]: mismatched types
--> $DIR/match-ergonomics.rs:4:10
|
+LL | match &x[..] {
+ | ------ this expression has type `&[i32]`
LL | [&v] => {},
| ^^
| |
error[E0308]: mismatched types
--> $DIR/match-ergonomics.rs:29:9
|
+LL | match y {
+ | - this expression has type `i32`
LL | &v => {},
| ^^
| |
--> $DIR/match-ergonomics.rs:40:13
|
LL | if let [&v] = &x[..] {}
- | ^^
+ | ^^ ------ this expression has type `&[i32]`
| |
| expected `i32`, found reference
| help: you can probably remove the explicit borrow: `v`