-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
You need to use exhaustive matching everywhere that currently has it. |
Will do, why is this needed though? |
There was a problem hiding this 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.
src/librustc_ast/ast.rs
Outdated
@@ -335,6 +335,8 @@ pub enum GenericParamKind { | |||
}, | |||
Const { | |||
ty: P<Ty>, | |||
/// Span of the `const` keyword. | |||
span: Span, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
span: Span, | |
kw_span: Span, |
Makes sense |
Is there a good way to test this change? |
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 🙂
@bors r+ |
@ayazhafiz: 🔑 Insufficient privileges: Not in reviewers |
@bors r=ecstatic-morse |
@ayazhafiz: 🔑 Insufficient privileges: Not in reviewers |
Apologies, I guess I don't get the bors delegation command |
@bors delegate+ rollup |
✌️ @ayazhafiz can now approve this pull request |
@bors r+ |
📌 Commit 86f6c0e has been approved by |
📌 Commit 86f6c0e has been approved by |
…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 🙂
…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 🙂
…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
…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 🙂
…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
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 🙂