forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#130879 - fmease:fix-diag-ice, r=compiler-er…
…rors Pass correct HirId to late_bound_vars in diagnostic code Fixes rust-lang#130858. Fixes rust-lang#125655. Fixes rust-lang#130391. Fixes rust-lang#130663. r? compiler-errors
- Loading branch information
Showing
6 changed files
with
55 additions
and
10 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 was deleted.
Oops, something went wrong.
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,15 @@ | ||
// We used to bind the closure return type `&'a ()` with the late-bound vars of | ||
// the owner (here `main` & `env` resp.) instead of the ones of the enclosing | ||
// function-like / closure inside diagnostic code which was incorrect. | ||
|
||
#![feature(closure_lifetime_binder)] | ||
|
||
// issue: rust-lang/rust#130391 | ||
fn main() { | ||
let _ = for<'a> |x: &'a u8| -> &'a () { x }; //~ ERROR mismatched types | ||
} | ||
|
||
// issue: rust-lang/rust#130663 | ||
fn env<'r>() { | ||
let _ = for<'a> |x: &'a u8| -> &'a () { x }; //~ ERROR mismatched types | ||
} |
25 changes: 25 additions & 0 deletions
25
tests/ui/closures/binder/closure-return-type-mismatch.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,25 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/closure-return-type-mismatch.rs:9:45 | ||
| | ||
LL | let _ = for<'a> |x: &'a u8| -> &'a () { x }; | ||
| ------ ^ expected `&()`, found `&u8` | ||
| | | ||
| expected `&'a ()` because of return type | ||
| | ||
= note: expected reference `&'a ()` | ||
found reference `&'a u8` | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/closure-return-type-mismatch.rs:14:45 | ||
| | ||
LL | let _ = for<'a> |x: &'a u8| -> &'a () { x }; | ||
| ------ ^ expected `&()`, found `&u8` | ||
| | | ||
| expected `&'a ()` because of return type | ||
| | ||
= note: expected reference `&'a ()` | ||
found reference `&'a u8` | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0308`. |
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