You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Closure signature not mentioned on mismatch with fn ptr #119266
error[E0308]: mismatched types
--> src/main.rs:4:22
|
2 |let x = |a: u8| {};| ------- the found closure
3 |
4 |let x: fn(i32) = x;| ------- ^ expected fn pointer, found closure
||| expected due to this
|
= note: expected fn pointer `fn(i32)`
found closure `{closure@src/main.rs:2:13: 2:20}`
Desired output
error[E0308]: mismatched types
--> src/main.rs:4:22
|
2 |let x = |a: u8| {};| ------- the found closure
3 |
4 |let x: fn(i32) = x;| ------- ^ expected fn pointer, found closure
||| expected due to this
|
= note: expected fn pointer `fn(i32)`| found closure `{closure@src/main.rs:2:13: 2:20}`
= note: closure has signature `fn(u8)`
Rationale and extra context
Here it's obvious, but when the error says that it is mismatched with for<'tcx> fn(context::TyCtxt<'tcx>, rustc_span::def_id::LocalDefId) -> &'tcx rustc_data_structures::unord::UnordSet<rustc_span::Symbol> and that "types differ in mutability" then I have zero chance of figuring what's going on.
Activity
wutchzone commentedon Mar 26, 2024
@rustbot claim
Sounds like a feature I would like to use as well.
Rollup merge of rust-lang#123379 - wutchzone:119266, r=compiler-errors
Rollup merge of rust-lang#123379 - wutchzone:119266, r=compiler-errors
Unrolled build for rust-lang#123379