-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #118584 - gurry:118144-projection-kind-mismatched, r=Wa…
…ffleLapkin Fix ICE `ProjectionKinds Deref and Field were mismatched` Fix #118144 Removed the check that ICEd if the sequence of projection kinds were different across captures. Instead we now sort based only on `Field` projection kinds.
- Loading branch information
Showing
3 changed files
with
51 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Regression test for ICE #118144 | ||
|
||
struct V(i32); | ||
|
||
fn func(func_arg: &mut V) { | ||
|| { | ||
// Declaring `x` separately instead of using | ||
// a destructuring binding like `let V(x) = ...` | ||
// becaue only `V(x) = ...` triggers the ICE | ||
let x; | ||
V(x) = func_arg; //~ ERROR: mismatched types | ||
func_arg.0 = 0; | ||
}; | ||
} | ||
|
||
fn main() {} |
11 changes: 11 additions & 0 deletions
11
tests/ui/closures/2229_closure_analysis/issue-118144.stderr
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,11 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/issue-118144.rs:11:9 | ||
| | ||
LL | V(x) = func_arg; | ||
| ^^^^ -------- this expression has type `&mut V` | ||
| | | ||
| expected `&mut V`, found `V` | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. |