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

builtin_macros: allow external consumers for AsmArgs parsing #92016

Merged
merged 1 commit into from
Dec 18, 2021

Conversation

calebcartwright
Copy link
Member

As discussed in Zulip (https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/parsing.20of.20AsmArgs.20for.20inline.20assembly), we need a function entry point that rustfmt can leverage from a pre-expansion context to get a more structured representation of the asm args without having to duplicate/maintain the token stream parsing

r? @Amanieu and/or @joshtriplett

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Dec 17, 2021
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 17, 2021
// Internal consumers should continue to leverage `expand_asm`/`expand__global_asm`
pub fn parse_asm_args<'a>(
p: &mut Parser<'a>,
sess: &'a ParseSess,
Copy link
Member Author

Choose a reason for hiding this comment

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

Realize that it's just the handler that's currently needed for the diagnostics (source map wasn't actually needed for the initial parsing) but figured it might be easier to just pass a ref of the session anyway so that any future changes needing more from the sess could be made without requiring signature and call site updates.

Lmk if it'd be better to reduce this to just the handler though

@Amanieu
Copy link
Member

Amanieu commented Dec 17, 2021

@bors r+

@bors
Copy link
Contributor

bors commented Dec 17, 2021

📌 Commit 78a8e00 has been approved by Amanieu

@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-review Status: Awaiting review from the assignee but also interested parties. labels Dec 17, 2021
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 17, 2021
…sing, r=Amanieu

builtin_macros: allow external consumers for AsmArgs parsing

As discussed in Zulip (https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/parsing.20of.20AsmArgs.20for.20inline.20assembly), we need a function entry point that rustfmt can leverage from a pre-expansion context to get a more structured representation of the asm args without having to duplicate/maintain the token stream parsing

r? `@Amanieu` and/or `@joshtriplett`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 17, 2021
…sing, r=Amanieu

builtin_macros: allow external consumers for AsmArgs parsing

As discussed in Zulip (https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/parsing.20of.20AsmArgs.20for.20inline.20assembly), we need a function entry point that rustfmt can leverage from a pre-expansion context to get a more structured representation of the asm args without having to duplicate/maintain the token stream parsing

r? ``@Amanieu`` and/or ``@joshtriplett``
This was referenced Dec 17, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 18, 2021
…askrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#87901 (Fix suggestion of additional `pub` when using `pub pub fn ...`)
 - rust-lang#89090 (Lint bare traits in AstConv.)
 - rust-lang#91818 (Show the unused type for `unused_results` lint)
 - rust-lang#91910 (miri: lift restriction on extern types being the only field in a struct)
 - rust-lang#91928 (Constify (most) `Option` methods)
 - rust-lang#91975 (Move generator check earlier in inlining.)
 - rust-lang#92016 (builtin_macros: allow external consumers for AsmArgs parsing)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit fd445dd into rust-lang:master Dec 18, 2021
@rustbot rustbot added this to the 1.59.0 milestone Dec 18, 2021
@calebcartwright calebcartwright deleted the expose-asm-args-parsing branch December 19, 2021 23:07
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 27, 2021
…acro-asm, r=cjgillot

rustc_builtin_macros: make asm mod public for rustfmt

Follow up to rust-lang#92016, as I'd completely missed that the mod we needed was internal
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. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants