-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Rewrite lifetimes
lint pass
#14715
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Jarcho
wants to merge
4
commits into
rust-lang:master
Choose a base branch
from
Jarcho:lifetime_ice_2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Rewrite lifetimes
lint pass
#14715
+1,454
−1,118
Conversation
This file contains hidden or 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
* Change lint message to not mention the lifetime names * Only point to the lifetime definition in the lint span.
…done when no lint is produced, but has a few behavior changes. * Input to output inference on `dyn Trait` lifetimes is handled with a sufficient MSRV. * Elision on `dyn Trait` input lifetimes where the lifetime is used only once is suggested on all versions. * Lifetimes that are only used as a constraint on a single type are no longer detected. This is a regression. * A bunch of cases where the lints where prevented, but only a single lifetime was non-elidible now lint on remaining lifetimes.
☔ The latest upstream changes (possibly 03a5b6b) made this pull request unmergeable. Please resolve the merge conflicts. |
r? clippy |
The dogfood error hints at a missing semicolon. Should be easy to fix. |
This will take more time to review than I have right now, but I have a 9 hour flight tomorrow, so I could pull that branch before departure... |
In any event, add a semicolon to |
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.
Based on #14702
This should generally be a perf improvement. The old implementation allocated a lot of things and then did multiple passes over the data. This only does a single pass allocating significantly less. It also bails out earlier in most cases.
Some behaviour changes:
dyn Trait + 'a
is now elided when possible instead of completely bailing out of the lint.<'a, T: 'a>
where'a
is only used for the type outlives constraint. Theses lifetimes can be removed, but I'd rather handle that at the same time as handling outlives constraints on lifetimes.changelog: [
elidable_lifetime_names
]: Lint whendyn Trait + 'a
can be elided.changelog: [
needless_lifetimes
] [elidable_lifetime_names
]: Lint more cases when only some lifetimes can be elided.