forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
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#105882 - compiler-errors:issue-105832, r=ja…
…ckh726 Don't ICE in closure arg borrow suggestion Fixes rust-lang#105832
- Loading branch information
Showing
3 changed files
with
35 additions
and
5 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,10 @@ | ||
pub enum Sexpr<'a> { | ||
Ident(&'a str), | ||
} | ||
|
||
fn map<'a, F: Fn(String) -> Sexpr<'a>>(f: F) {} | ||
|
||
fn main() { | ||
map(Sexpr::Ident); | ||
//~^ ERROR type mismatch in function arguments | ||
} |
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,22 @@ | ||
error[E0631]: type mismatch in function arguments | ||
--> $DIR/enum-variant-arg-mismatch.rs:8:9 | ||
| | ||
LL | Ident(&'a str), | ||
| ----- found signature defined here | ||
... | ||
LL | map(Sexpr::Ident); | ||
| --- ^^^^^^^^^^^^ expected due to this | ||
| | | ||
| required by a bound introduced by this call | ||
| | ||
= note: expected function signature `fn(String) -> _` | ||
found function signature `fn(&str) -> _` | ||
note: required by a bound in `map` | ||
--> $DIR/enum-variant-arg-mismatch.rs:5:15 | ||
| | ||
LL | fn map<'a, F: Fn(String) -> Sexpr<'a>>(f: F) {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0631`. |