-
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.
Rollup merge of #106581 - estebank:bad-suggestion, r=compiler-errors
Do not emit wrong E0308 suggestion for closure mismatch Found in #76353.
- Loading branch information
Showing
3 changed files
with
33 additions
and
1 deletion.
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 @@ | ||
struct S<'a>(&'a str); | ||
|
||
fn f(inner: fn(&str, &S)) { | ||
} | ||
|
||
#[allow(unreachable_code)] | ||
fn main() { | ||
let inner: fn(_, _) = unimplemented!(); | ||
f(inner); //~ 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,19 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/closure-with-wrong-borrows.rs:9:7 | ||
| | ||
LL | f(inner); | ||
| - ^^^^^ one type is more general than the other | ||
| | | ||
| arguments to this function are incorrect | ||
| | ||
= note: expected fn pointer `for<'a, 'b, 'c> fn(&'a str, &'b S<'c>)` | ||
found fn pointer `fn(_, _)` | ||
note: function defined here | ||
--> $DIR/closure-with-wrong-borrows.rs:3:4 | ||
| | ||
LL | fn f(inner: fn(&str, &S)) { | ||
| ^ ------------------- | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. |