-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not offer any of the suggestions in emit_coerce_suggestions for ex…
…pr from destructuring assignment desugaring
- Loading branch information
1 parent
ed1ce58
commit 33f73c2
Showing
4 changed files
with
139 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
struct S { | ||
a: usize, | ||
b: usize, | ||
} | ||
|
||
fn main() { | ||
let a: usize; | ||
let b: usize; | ||
let c: usize; | ||
|
||
(c) = (&123); //~ ERROR mismatched types | ||
(a, b) = (123, &mut 123); //~ ERROR mismatched types | ||
|
||
let x: String; | ||
(x,) = (1,); //~ ERROR mismatched types | ||
|
||
let x: i32; | ||
[x] = [&1]; //~ ERROR mismatched types | ||
|
||
let x: &i32; | ||
[x] = [1]; //~ ERROR mismatched types | ||
|
||
let x = (1, &mut 2); | ||
(a, b) = x; //~ ERROR mismatched types | ||
|
||
S { a, b } = S { a: 1, b: &mut 2 }; //~ ERROR mismatched types | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/issue-109991.rs:11:11 | ||
| | ||
LL | let c: usize; | ||
| ----- expected due to this type | ||
LL | | ||
LL | (c) = (&123); | ||
| ^^^^^^ expected `usize`, found `&{integer}` | ||
| | ||
help: consider removing the borrow | ||
| | ||
LL - (c) = (&123); | ||
LL + (c) = (123); | ||
| | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/issue-109991.rs:12:9 | ||
| | ||
LL | let b: usize; | ||
| ----- expected due to this type | ||
... | ||
LL | (a, b) = (123, &mut 123); | ||
| ^ expected `usize`, found `&mut {integer}` | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/issue-109991.rs:15:6 | ||
| | ||
LL | let x: String; | ||
| ------ expected due to this type | ||
LL | (x,) = (1,); | ||
| ^ expected `String`, found integer | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/issue-109991.rs:18:6 | ||
| | ||
LL | let x: i32; | ||
| --- expected due to this type | ||
LL | [x] = [&1]; | ||
| ^ expected `i32`, found `&{integer}` | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/issue-109991.rs:21:6 | ||
| | ||
LL | let x: &i32; | ||
| ---- expected due to this type | ||
LL | [x] = [1]; | ||
| ^ expected `&i32`, found integer | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/issue-109991.rs:24:9 | ||
| | ||
LL | let b: usize; | ||
| ----- expected due to this type | ||
... | ||
LL | (a, b) = x; | ||
| ^ expected `usize`, found `&mut {integer}` | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/issue-109991.rs:26:31 | ||
| | ||
LL | S { a, b } = S { a: 1, b: &mut 2 }; | ||
| ^^^^^^ expected `usize`, found `&mut {integer}` | ||
| | ||
help: consider removing the borrow | ||
| | ||
LL - S { a, b } = S { a: 1, b: &mut 2 }; | ||
LL + S { a, b } = S { a: 1, b: 2 }; | ||
| | ||
|
||
error: aborting due to 7 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0308`. |