forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
only do the elided-lifetimes-in-paths lint on type paths
Instead of linting for invisible lifetimes during (a callee of) `visit_path` (in the `LifetimeContext` visitor), we do it in the `hir::TyPath` branch of `visit_ty`. This fixes a false positive where we were suggesting `<'_>` on the struct name of a struct construction expression. (Applying the suggestion would result in a parse error.) Also, it seems better for the primary lint span (as distinguished from the zero-width suggestion span where we propose the insertion of anonymous lifetimes) to cover the entire path including any angle-bracketed type parameters, rather than just the last path-name segment. That is: we should highlight all of `Ref<T>` when we suggest replacing it with `Ref<'_, T>`, rather than just highlighting the `Ref`. (Interestingly, this false positive didn't happen for tuple structs like the one we already had in our UI test, probably because of something something value vs. type namespace &c. that the present author doesn't understand.) This is in the matter of issue no. 52041.
- Loading branch information
1 parent
7d03b39
commit 22c4f56
Showing
4 changed files
with
55 additions
and
21 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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