Change:
<ins> error[E0308]: mismatched types --> $DIR/issue-105675.rs:5:5 | LL |     thing(f); |     ^^^^^^^^ one type is more general than the other | = note: expected trait `for<'a, 'b> FnOnce<(&'a u32, &'b u32, u32)>` found trait `for<'a> FnOnce<(&u32, &'a u32, u32)>` note: this closure does not fulfill the lifetime requirements --> $DIR/issue-105675.rs:4:13 | LL |     let f = | _ , y: &u32 , z | (); |             ^^^^^^^^^^^^^^^^^^^ note: the lifetime requirement is introduced here --> $DIR/issue-105675.rs:1:18 | LL | fn thing(x: impl FnOnce(&u32, &u32, u32)) {} |                  ^^^^^^^^^^^^^^^^^^^^^^^ help: consider specifying the type of the closure parameters | LL |     let f = |_: &_, y: &u32, z| (); |             ~~~~~~~~~~~~~~~~~~~ error[E0308]: mismatched types --> $DIR/issue-105675.rs:5:5 | LL |     thing(f); |     ^^^^^^^^ one type is more general than the other | = note: expected trait `for<'a, 'b> FnOnce<(&'a u32, &'b u32, u32)>` found trait `for<'a> FnOnce<(&u32, &'a u32, u32)>` note: this closure does not fulfill the lifetime requirements --> $DIR/issue-105675.rs:4:13 | LL |     let f = | _ , y: &u32 , z | (); |             ^^^^^^^^^^^^^^^^^^^ note: the lifetime requirement is introduced here --> $DIR/issue-105675.rs:1:18 | LL | fn thing(x: impl FnOnce(&u32, &u32, u32)) {} |                  ^^^^^^^^^^^^^^^^^^^^^^^ error[E0308]: mismatched types --> $DIR/issue-105675.rs:9:5 | LL |     thing(f); |     ^^^^^^^^ one type is more general than the other | = note: expected trait `for<'a, 'b> FnOnce<(&'a u32, &'b u32, u32)>` found trait `FnOnce<(&u32, &u32, u32)>` note: this closure does not fulfill the lifetime requirements --> $DIR/issue-105675.rs:8:13 | LL |     let f = | x, y: _  , z: u32 | (); |             ^^^^^^^^^^^^^^^^^^^^^ note: the lifetime requirement is introduced here --> $DIR/issue-105675.rs:1:18 | LL | fn thing(x: impl FnOnce(&u32, &u32, u32)) {} |                  ^^^^^^^^^^^^^^^^^^^^^^^ help: consider specifying the type of the closure parameters | LL |     let f = |x: &_, y: &_, z: u32| (); |             ~~~~~~~~~~~~~~~~~~~~~~ error[E0308]: mismatched types --> $DIR/issue-105675.rs:9:5 | LL |     thing(f); |     ^^^^^^^^ one type is more general than the other | = note: expected trait `for<'a, 'b> FnOnce<(&'a u32, &'b u32, u32)>` found trait `FnOnce<(&u32, &u32, u32)>` note: this closure does not fulfill the lifetime requirements --> $DIR/issue-105675.rs:8:13 | LL |     let f = | x, y: _  , z: u32 | (); |             ^^^^^^^^^^^^^^^^^^^^^ note: the lifetime requirement is introduced here --> $DIR/issue-105675.rs:1:18 | LL | fn thing(x: impl FnOnce(&u32, &u32, u32)) {} |                  ^^^^^^^^^^^^^^^^^^^^^^^ help: consider specifying the type of the closure parameters | LL |     let f = |x: &_, y: &_, z: u32| (); |             ~~~~~~~~~~~~~~~~~~~~~~ error: implementation of `FnOnce` is not general enough --> $DIR/issue-105675.rs:9:5 | LL |     thing(f); |     ^^^^^^^^ implementation of `FnOnce` is not general enough | = note: closure with signature `fn(&'2 u32, &u32, u32)` must implement `FnOnce<(&'1 u32, &u32, u32)>`, for any lifetime `'1`... = note: ...but it actually implements `FnOnce<(&'2 u32, &u32, u32)>`, for some specific lifetime `'2` error: implementation of `FnOnce` is not general enough --> $DIR/issue-105675.rs:9:5 | LL |     thing(f); |     ^^^^^^^^ implementation of `FnOnce` is not general enough | = note: closure with signature `fn(&u32, &'2 u32, u32)` must implement `FnOnce<(&u32, &'1 u32, u32)>`, for any lifetime `'1`... = note: ...but it actually implements `FnOnce<(&u32, &'2 u32, u32)>`, for some specific lifetime `'2` error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0308`. </ins>

Discussion:
a new project with (in my case, it used pathfinding version 4.0.0 or 4.0.1) with: produces the following output: For the two closures ( and ), if I add a type for the parameter by changing to , it builds without any errors. If it had told me that it needed type annotations, I would have understood the problem and been able to fix it right away. (I assumed that there was enough type information for it to infer the correct types.) The first confusing bit is that both errors highlight the entire call to , including all parameters. This makes it harder to figure out which one it is complaining about (though the second note contains the line number). Does the first argument have something to do with the lifetimes it is complaining about? I found this part of the message hard to understand: The type parameters look almost identical, and the didn't make sense to me. Could it somehow indicate the bounds of that lifetime (2), or better explain why that lifetime doesn't last long enough? FYI: found as part of solving Advent of Code 2022, Day 12. <!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOT_END --
A smaller MCVE:
I'm thinking whether we should fix this as a compiler bug (i.e., make it compile) or suggesting people write explicit type here
maybe related:
Also if we move the closure to the parameter: This will also compile. Combined with , I guess something is wrong with propagating lifetime of closures when we store it in a variable...
claim