-
Notifications
You must be signed in to change notification settings - Fork 13.5k
AST pretty: Use builtin_syntax
for type ascription
#124637
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
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.
whatever tho @ my last comment
@@ -422,7 +422,8 @@ impl<'a> State<'a> { | |||
self.print_type(ty); | |||
} | |||
ast::ExprKind::Type(expr, ty) => { | |||
self.word("type_ascribe!("); | |||
self.word("builtin # type_ascribe"); |
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.
Hmm... I think I'm kind of torn here. I feel like it's still useful to print it like type_ascribe!(
, though it's kind of lying to the user. We do the macro-ish syntax for deref pats, since users won't be writing builtin # deref
themselves.
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.
Oh, lol, I see. It's due to #124619.
In that case, I wonder if we need to fix deref patterns too here...
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.
I cc'ed #124619 to give some extra context but it's not really related. #124619 describes a rustfmt
bug which I plan on fixing out of tree / in the rustfmt
repo.
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.
oh, in that case, I feel like we might want to keep this as type_ascribe!()
lol -- but whatever, if you don't agree, i don't particularly care
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.
I'm definitely not a fan of builtin #
's visual appearance, it looks grotesque and verbose. However, printing a fake macro call I like even less.
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.
I think it better to print the builtin
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.
because that doesn't need to be imported
r? compiler-errors @bors r+ rollup |
…yn, r=compiler-errors AST pretty: Use `builtin_syntax` for type ascription Follow-up to rust-lang#122806. CC #124619.
Rollup of 7 pull requests Successful merges: - rust-lang#124441 (String.truncate comment microfix (greater or equal)) - rust-lang#124594 (run-make-support: preserve tooks.mk behavior for EXTRACXXFLAGS) - rust-lang#124604 (library/std: Remove unused `gimli-symbolize` feature) - rust-lang#124607 (`rustc_expand` cleanups) - rust-lang#124609 (variable-precision float operations can differ depending on optimization levels) - rust-lang#124610 (Tweak `consts_may_unify`) - rust-lang#124637 (AST pretty: Use `builtin_syntax` for type ascription) Failed merges: - rust-lang#124638 (Move some tests from `rustc_expand` to `rustc_parse`.) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 10 pull requests Successful merges: - rust-lang#123480 (deref patterns: impl `DerefPure` for more std types) - rust-lang#124412 (io safety: update Unix explanation to use `Arc`) - rust-lang#124441 (String.truncate comment microfix (greater or equal)) - rust-lang#124594 (run-make-support: preserve tooks.mk behavior for EXTRACXXFLAGS) - rust-lang#124604 (library/std: Remove unused `gimli-symbolize` feature) - rust-lang#124607 (`rustc_expand` cleanups) - rust-lang#124609 (variable-precision float operations can differ depending on optimization levels) - rust-lang#124610 (Tweak `consts_may_unify`) - rust-lang#124626 (const_eval_select: add tracking issue) - rust-lang#124637 (AST pretty: Use `builtin_syntax` for type ascription) Failed merges: - rust-lang#124638 (Move some tests from `rustc_expand` to `rustc_parse`.) r? `@ghost` `@rustbot` modify labels: rollup
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.
@bors r- |
Follow-up to #122806.
CC rust-lang/rustfmt#6159.