Skip to content
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

Record span of const kw in GenericParamKind #73597

Merged
merged 1 commit into from
Jun 26, 2020

Conversation

ayazhafiz
Copy link
Contributor

@ayazhafiz ayazhafiz commented Jun 21, 2020

Context: this is needed for a fix of rust-lang/rustfmt#4263,
which currently records the span of a const generic param incorrectly
because the location of the const kw is not known.

I am not sure how to add tests for this; any guidance in how to do so
would be appreciated 🙂

@rust-highfive
Copy link
Collaborator

r? @ecstatic-morse

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 21, 2020
@ecstatic-morse
Copy link
Contributor

You need to use exhaustive matching everywhere that currently has it.

@ecstatic-morse ecstatic-morse added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 22, 2020
@ayazhafiz
Copy link
Contributor Author

You need to use exhaustive matching everywhere that currently has it.

Will do, why is this needed though?

Copy link
Contributor

@ecstatic-morse ecstatic-morse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exhaustive matching directs people who need to add fields to AST/HIR data structures to code that usually needs to inspect every piece of that data structure.

@@ -335,6 +335,8 @@ pub enum GenericParamKind {
},
Const {
ty: P<Ty>,
/// Span of the `const` keyword.
span: Span,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
span: Span,
kw_span: Span,

@ayazhafiz
Copy link
Contributor Author

Makes sense

@ayazhafiz
Copy link
Contributor Author

r? @ecstatic-morse

Is there a good way to test this change?

@ecstatic-morse
Copy link
Contributor

Not to my knowledge since it's never used for diagnostics. r=me after squash.

@bors d+

Context: this is needed to fix rust-lang/rustfmt#4263,
which currently records the span of a const generic param incorrectly
because the location of the `const` kw is not known.

I am not sure how to add tests for this; any guidance in how to do so
would be appreciated 🙂
@ayazhafiz
Copy link
Contributor Author

@bors r+

@bors
Copy link
Contributor

bors commented Jun 23, 2020

@ayazhafiz: 🔑 Insufficient privileges: Not in reviewers

@ayazhafiz
Copy link
Contributor Author

@bors r=ecstatic-morse

@bors
Copy link
Contributor

bors commented Jun 23, 2020

@ayazhafiz: 🔑 Insufficient privileges: Not in reviewers

@ayazhafiz
Copy link
Contributor Author

r? @ecstatic-morse

@ayazhafiz
Copy link
Contributor Author

Apologies, I guess I don't get the bors delegation command

@ecstatic-morse
Copy link
Contributor

@bors delegate+ rollup

@bors
Copy link
Contributor

bors commented Jun 23, 2020

✌️ @ayazhafiz can now approve this pull request

@ayazhafiz
Copy link
Contributor Author

@bors r+

@bors
Copy link
Contributor

bors commented Jun 23, 2020

📌 Commit 86f6c0e has been approved by ayazhafiz

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 23, 2020
@ecstatic-morse
Copy link
Contributor

@bors r-
@bors r=ecstatic-morse

You need to use the name of the reviewer when delegated to.

@bors
Copy link
Contributor

bors commented Jun 23, 2020

📌 Commit 86f6c0e has been approved by ecstatic-morse

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 23, 2020
@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 23, 2020
Manishearth added a commit to Manishearth/rust that referenced this pull request Jun 24, 2020
…morse

Record span of `const` kw in GenericParamKind

Context: this is needed for a fix of rust-lang/rustfmt#4263,
which currently records the span of a const generic param incorrectly
because the location of the `const` kw is not known.

I am not sure how to add tests for this; any guidance in how to do so
would be appreciated 🙂
Manishearth added a commit to Manishearth/rust that referenced this pull request Jun 26, 2020
…morse

Record span of `const` kw in GenericParamKind

Context: this is needed for a fix of rust-lang/rustfmt#4263,
which currently records the span of a const generic param incorrectly
because the location of the `const` kw is not known.

I am not sure how to add tests for this; any guidance in how to do so
would be appreciated 🙂
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 26, 2020
…arth

Rollup of 13 pull requests

Successful merges:

 - rust-lang#72620 (Omit DW_AT_linkage_name when it is the same as DW_AT_name)
 - rust-lang#72967 (Don't move cursor in search box when using arrows to navigate results)
 - rust-lang#73102 (proc_macro: Stop flattening groups with dummy spans)
 - rust-lang#73297 (Support configurable deny-warnings for all in-tree crates.)
 - rust-lang#73507 (Cleanup MinGW LLVM linkage workaround)
 - rust-lang#73588 (Fix handling of reserved registers for ARM inline asm)
 - rust-lang#73597 (Record span of `const` kw in GenericParamKind)
 - rust-lang#73629 (Make AssocOp Copy)
 - rust-lang#73681 (Update Chalk to 0.14)
 - rust-lang#73707 (Fix links in `SliceIndex` documentation)
 - rust-lang#73719 (emitter: column width defaults to 140)
 - rust-lang#73729 (disable collectionbenches for android)
 - rust-lang#73748 (Add code block to code in documentation of `List::rebase_onto`)

Failed merges:

r? @ghost
@bors bors merged commit 7f6dfb4 into rust-lang:master Jun 26, 2020
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jul 14, 2020
…morse

Record span of `const` kw in GenericParamKind

Context: this is needed for a fix of rust-lang/rustfmt#4263,
which currently records the span of a const generic param incorrectly
because the location of the `const` kw is not known.

I am not sure how to add tests for this; any guidance in how to do so
would be appreciated 🙂
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jul 14, 2020
…arth

Rollup of 13 pull requests

Successful merges:

 - rust-lang#72620 (Omit DW_AT_linkage_name when it is the same as DW_AT_name)
 - rust-lang#72967 (Don't move cursor in search box when using arrows to navigate results)
 - rust-lang#73102 (proc_macro: Stop flattening groups with dummy spans)
 - rust-lang#73297 (Support configurable deny-warnings for all in-tree crates.)
 - rust-lang#73507 (Cleanup MinGW LLVM linkage workaround)
 - rust-lang#73588 (Fix handling of reserved registers for ARM inline asm)
 - rust-lang#73597 (Record span of `const` kw in GenericParamKind)
 - rust-lang#73629 (Make AssocOp Copy)
 - rust-lang#73681 (Update Chalk to 0.14)
 - rust-lang#73707 (Fix links in `SliceIndex` documentation)
 - rust-lang#73719 (emitter: column width defaults to 140)
 - rust-lang#73729 (disable collectionbenches for android)
 - rust-lang#73748 (Add code block to code in documentation of `List::rebase_onto`)

Failed merges:

r? @ghost
@cuviper cuviper added this to the 1.46 milestone May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants