Prevent explicitly specifiying lifetime arguments to functions when the parameters are not visible in the type signature. - #160581
Prevent explicitly specifiying lifetime arguments to functions when the parameters are not visible in the type signature.#160581addiesh wants to merge 1 commit into
Conversation
…he parameters are not visible in the type signature.
|
HIR ty lowering was modified cc @fmease |
|
Thanks for the pull request, and welcome! The Rust Project is excited to review your changes, and you should hear from @mejrs (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
Why was this reviewer chosen?The reviewer was selected based on:
|
|
Isn't this a breaking change? |
|
I don't think so? Afaik, the only way that this can happen is through a bug. It may be worth a crater run to check to see if anyone is relying on this behavior though? |
|
Well, that depends on how breaking it is :) |
This comment has been minimized.
This comment has been minimized.
|
@bors try |
This comment has been minimized.
This comment has been minimized.
Prevent explicitly specifiying lifetime arguments to functions when the parameters are not visible in the type signature.
|
@craterbot check |
|
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
|
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
|
🎉 Experiment
Footnotes
|
|
ok so, that's good! only one crate actually impacted, 4 different versions of it though... Unsurprising to me that it's a math-related crate (https://crates.io/crates/faer) given how those love generics. @mejrs, what do you think is the way forward here? Looking at the results, the four broken versions (or at least, the four versions with consumers) are The easiest place to see the behavior is defined here and used here. The function has an elided lifetime parameter and is turbofished using fn _something() {
// sparse/linalg/qr.rs:1388
let mut s_L = crate::mat::from_column_major_slice_mut_generic::<'_, E, _, _>(
s_L.into_inner(),
s_pattern.len() + s_ncols,
s_ncols,
);
}
// mat/matmut.rs:2231
#[track_caller]
pub fn from_column_major_slice_mut_generic<E: Entity, R: Shape, C: Shape>(
slice: SliceMut<'_, E>,
nrows: R,
ncols: C,
) -> MatMut<'_, E, R, C> {
/* ... */
} |
It looks like all of What you can do right now is to reach out to the crate maintainer and ask them pretty please to release
I'd suggest doing the above and then nominating it for the relevant team to discuss whether to accept the breakage. For that it would be very helpful if the above has been done. |
This is meant to fix #154490:
This started as a larger PR (#160471) but these changes work on their own.
Eventually, that PR should introduce the same checks for late-bound lifetimes.