-
Notifications
You must be signed in to change notification settings - Fork 888
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
Type ascription builtin is silently replaced by rustfmt(?) #6159
Comments
looks like rustfmt wasn't updated to print type ascription correctly, this issue should be removed to the rustfmt repo probably |
@Mark-Simulacrum The diff is helpful, but can you also provide a complete code snippet that we can use to reproduce the issue. A few more questions. What version of rustfmt were you using when you ran into this issue, and are you using any rustfmt configurations? |
@Nilstrieb do you know how for example, |
@Nilstrieb @Mark-Simulacrum Okay, I think the issue here is that From what I can tell Here's where this get's parsed in rustc. In this case rustfmt is handling this as expected. It sees a |
haha, looks like ast_pretty wasn't correctly updated then, fun. I don't think any AST changes are needed, it just needs to print the ExprKind::Type with the builtin syntax. |
@Nilstrieb Do you have thoughts on how rustfmt can tell the difference between |
the latter does not exist anymore |
If |
It was implemented by Yukang and me, with the biggest change in rust-lang/rust#109128 |
Thanks for the link! |
And rust-lang/rust#122806 made the macro |
Working on a patch for rust-lang/rustfmt, let's see if I can make it work. |
Nice! I think you can just move the ExprKind::Type to the same match arm as ExprKind::OffsetOf in rust-lang/rustfmt Though we haven't done a sync in a while so I'm not sure if we've pulled in some of the more recent changes in rustfmt yet. |
…yn, r=compiler-errors AST pretty: Use `builtin_syntax` for type ascription Follow-up to rust-lang#122806. CC #124619.
…yn, r=compiler-errors AST pretty: Use `builtin_syntax` for type ascription Follow-up to rust-lang#122806. CC #124619.
Rollup merge of rust-lang#124637 - fmease:ast-pretty-ty-asc-builtin-syn, r=compiler-errors AST pretty: Use `builtin_syntax` for type ascription Follow-up to rust-lang#122806. CC #124619.
Moving it back to the rustfmt repo since this is strictly rustfmt-related (wrong output for @rustbot transfer rustfmt |
someone needs to make a PR for that :D |
…r=jackh726 Meta: Enable the brand new triagebot transfer command cc rust-lang/triagebot#1780, rust-lang/rust-forge#741, https://github.com/rust-lang/rust/issues/124619#issuecomment-2094258528 cc `@ehuss,` `@jackh726`
…jackh726 Meta: Enable the brand new triagebot transfer command cc rust-lang/triagebot#1780, rust-lang/rust-forge#741, https://github.com/rust-lang/rust/issues/124619#issuecomment-2094258528 cc `@ehuss,` `@jackh726`
@rustbot transfer rustfmt |
After the latest subtree sync, and starting with |
rustfmt complains about the type_ascribe macro asking for the builtin to be replaced with the
... : ...
syntax:I've worked around this with
#[rustfmt::skip]
on the macro which seems to work, but filing an issue since it seems like somewhat odd behavior as well.The text was updated successfully, but these errors were encountered: