in which we decline to suggest the anonymous lifetime in declarations#61679
Merged
bors merged 1 commit intorust-lang:masterfrom Jun 14, 2019
Merged
Conversation
Centril
suggested changes
Jun 9, 2019
oli-obk
reviewed
Jun 9, 2019
src/librustc/hir/lowering.rs
Outdated
Contributor
There was a problem hiding this comment.
nit: directly return here instead of using an intermediate variable
oli-obk
reviewed
Jun 9, 2019
src/librustc/hir/lowering.rs
Outdated
Contributor
There was a problem hiding this comment.
alternatively you could add a ParamMode argument to lower_ty, not sure if that is better though
Contributor
Author
There was a problem hiding this comment.
That was my first idea, but I decided against it, because it seemed inelegant to change the signature when most of the TyKind match arm bodies don't concern themselves with ParamMode.
Contributor
|
r=me with nits addressed |
The elided-lifetimes-in-path lint (part of our suite of Rust 2018 idiom lints which we are hoping to promote to Warn status) was firing with an illegal suggestion to write an anonymous lifetime in a struct/item declaration (where we don't allow it). The linting code was already deciding whether to act on the basis of a `ParamMode` enum, indicating whether the present path-segment was part of an expression, or anywhere else. The present case seemed to be part of the "anywhere else", and yet meriting different rules as far as the lint was concerned, so it seemed expedient to introduce a new enum member. We yank out a `TyKind::Path` arm into its own method so that we can call it with our new `ParamMode` specifically when lowering struct fields. (The alternative strategy of changing the signature of `lower_ty` to take a `ParamMode` would be inelegant given that most of the `TyKind` match arm bodies therein don't concern themselves with `ParamMode`.) Resolves rust-lang#61124.
9c55aa0 to
7a3184a
Compare
Contributor
Author
|
@bors r=oli-obk |
Collaborator
|
📌 Commit 7a3184a has been approved by |
Collaborator
bors
added a commit
that referenced
this pull request
Jun 14, 2019
…ifetime, r=oli-obk in which we decline to suggest the anonymous lifetime in declarations The elided-lifetimes-in-path lint (part of our suite of Rust 2018 idiom lints which we are hoping to promote to Warn status) was firing with an illegal suggestion to write an anonymous lifetime in a struct/item declaration (where we don't allow it). The linting code was already deciding whether to act on the basis of a `ParamMode` enum, indicating whether the present path-segment was part of an expression, or anywhere else. The present case seemed to be part of the "anywhere else", and yet meriting different rules as far as the lint was concerned, so it seemed expedient to introduce a new enum member. We yank out `TyKind::Path` arm into its own method so that we can call it with our new `ParamMode` specifically when lowering struct fields—one would have hoped to think of something more elegant than this, but it definitely beats changing the signature of `lower_ty` to take a `ParamMode`! Resolves #61124. cc @memoryruins r? @oli-obk
Collaborator
|
☀️ Test successful - checks-travis, status-appveyor |
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Aug 26, 2024
…fmease Remove `ParamMode::ExplicitNamed` This was introduced as a hack to improve a diagnostics suggestion in rust-lang#61679. It was subsequently broken, but also it was an incomplete hack that I don't believe we need to support, so let's just remove it.
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Aug 26, 2024
…fmease Remove `ParamMode::ExplicitNamed` This was introduced as a hack to improve a diagnostics suggestion in rust-lang#61679. It was subsequently broken, but also it was an incomplete hack that I don't believe we need to support, so let's just remove it.
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Aug 27, 2024
Rollup merge of rust-lang#129626 - compiler-errors:explicit-named, r=fmease Remove `ParamMode::ExplicitNamed` This was introduced as a hack to improve a diagnostics suggestion in rust-lang#61679. It was subsequently broken, but also it was an incomplete hack that I don't believe we need to support, so let's just remove it.
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
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.
The elided-lifetimes-in-path lint (part of our suite of Rust 2018 idiom lints which we are hoping to promote to Warn status) was firing with an illegal suggestion to write an anonymous lifetime in a
struct/item declaration (where we don't allow it). The linting code was already deciding whether to act on the basis of a
ParamModeenum, indicating whether the present path-segment was part of anexpression, or anywhere else. The present case seemed to be part of the "anywhere else", and yet meriting different rules as far as the lint was concerned, so it seemed expedient to introduce a new enum member. We yank out
TyKind::Patharm into its own method so that we can call it with our newParamModespecifically when lowering struct fields—one would have hoped to think of something more elegant than this, but it definitely beats changing the signature oflower_tyto take aParamMode!Resolves #61124.
cc @memoryruins
r? @oli-obk