diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2024-12-02 17:36:03 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-02 17:36:03 +0100 |
| commit | e66bd976c691c4967422c5769e73fac9ab85fd87 (patch) | |
| tree | fa08370d46d1b153edfd75037edbddcea36df8fb /tests/rustdoc-ui/coverage/doc-examples.rs | |
| parent | 5e799b25b7302906ef732f924c4dea65f8548460 (diff) | |
| parent | c52fe8bc2a86adc89754776634ffc146efada745 (diff) | |
| download | rust-e66bd976c691c4967422c5769e73fac9ab85fd87.tar.gz rust-e66bd976c691c4967422c5769e73fac9ab85fd87.zip | |
Rollup merge of #133603 - dtolnay:precedence, r=lcnr
Eliminate magic numbers from expression precedence Context: see https://github.com/rust-lang/rust/pull/133140. This PR continues on backporting Syn's expression precedence design into rustc. Rustc's design used mysterious integer quantities represented variously as `i8` or `usize` (e.g. `PREC_CLOSURE = -40i8`), a special significance around `0` that is never named, and an extra `PREC_FORCE_PAREN` precedence level that does not correspond to any expression. Syn's design uses a C-like enum with variants that clearly correspond to specific sets of expression kinds. This PR is a refactoring that has no intended behavior change on its own, but it unblocks other precedence work that rustc's precedence design was poorly suited to accommodate. - Asymmetrical precedence, so that a pretty-printer can tell `(return 1) + 1` needs parens but `1 + return 1` does not. - Squashing the `Closure` and `Jump` cases into a single precedence level. - Numerous remaining false positives and false negatives in rustc pretty-printer's parenthesization of macro metavariables, for example in `$e < rhs` where $e is `lhs as Thing<T>`. FYI `@fmease` — you don't need to review if rustbot picks someone else, but you mentioned being interested in the followup PRs.
Diffstat (limited to 'tests/rustdoc-ui/coverage/doc-examples.rs')
0 files changed, 0 insertions, 0 deletions
