Split elided_lifetime_in_paths into finer-grained lints - #120808
Open
shepmaster wants to merge 7 commits into
Open
Split elided_lifetime_in_paths into finer-grained lints#120808shepmaster wants to merge 7 commits into
shepmaster wants to merge 7 commits into
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Converts the existing
elided_lifetime_in_pathslint into three smaller pieces:hidden_lifetimes_in_input_paths— fires forfn(ContainsLifetime) -> ...hidden_lifetimes_in_output_paths— fires forfn(...) -> ContainsLifetimehidden_lifetimes_in_type_paths— fires for many other usages ofContainsLifetime, such as in astaticor in a turbofishA new group
hidden_lifetimes_in_pathsis created with the three smaller lints and places that use the oldelided_lifetime_in_pathsname are updated to match.Background
In general, we want to discourage function signatures like
fn (&T) -> ContainsLifetime,fn (ContainsLifetime) -> &T, andfn (ContainsLifetime) -> ContainsLifetimeas it is not obvious that a lifetime flows through the function and back out as there is no visual indication thatContainsLifetimehas a lifetime generic (such types are not usually literally called "contains lifetime" 😃).In #120808 (comment) (and multiple followup comments, e.g. #120808 (comment)), the lang team decided on a plan where we introduce a new warn-by-default lint
mismatched_lifetime_syntaxes(supersedingelided_named_lifetimes) which helps insure consistency between input and output lifetime syntaxes and then splitelided_lifetime_in_pathsinto three parts. The combination of these lints should be enough to accomplish the original goal.History
Note that this PR has substantially changed from its original version. Check the (copious) comments below as well as the edit history of this message.