about summary refs log tree commit diff
path: root/tests/pretty
AgeCommit message (Collapse)AuthorLines
2023-12-11Improve `print_tts` by changing `tokenstream::Spacing`.Nicholas Nethercote-1/+1
`tokenstream::Spacing` appears on all `TokenTree::Token` instances, both punct and non-punct. Its current usage: - `Joint` means "can join with the next token *and* that token is a punct". - `Alone` means "cannot join with the next token *or* can join with the next token but that token is not a punct". The fact that `Alone` is used for two different cases is awkward. This commit augments `tokenstream::Spacing` with a new variant `JointHidden`, resulting in: - `Joint` means "can join with the next token *and* that token is a punct". - `JointHidden` means "can join with the next token *and* that token is a not a punct". - `Alone` means "cannot join with the next token". This *drastically* improves the output of `print_tts`. For example, this: ``` stringify!(let a: Vec<u32> = vec![];) ``` currently produces this string: ``` let a : Vec < u32 > = vec! [] ; ``` With this PR, it now produces this string: ``` let a: Vec<u32> = vec![] ; ``` (The space after the `]` is because `TokenTree::Delimited` currently doesn't have spacing information. The subsequent commit fixes this.) The new `print_tts` doesn't replicate original code perfectly. E.g. multiple space characters will be condensed into a single space character. But it's much improved. `print_tts` still produces the old, uglier output for code produced by proc macros. Because we have to translate the generated code from `proc_macro::Spacing` to the more expressive `token::Spacing`, which results in too much `proc_macro::Along` usage and no `proc_macro::JointHidden` usage. So `space_between` still exists and is used by `print_tts` in conjunction with the `Spacing` field. This change will also help with the removal of `Token::Interpolated`. Currently interpolated tokens are pretty-printed nicely via AST pretty printing. `Token::Interpolated` removal will mean they get printed with `print_tts`. Without this change, that would result in much uglier output for code produced by decl macro expansions. With this change, AST pretty printing and `print_tts` produce similar results. The commit also tweaks the comments on `proc_macro::Spacing`. In particular, it refers to "compound tokens" rather than "multi-char operators" because lifetimes aren't operators.
2023-10-25Remove unnecessary CVarArgs name skipping logicDaniPopes-1/+1
2023-10-25Print variadic argument pattern in HIR pretty printerDaniPopes-0/+28
2023-10-16Preserve unicode escapes in format string literals when pretty-printing ASTPaul Gey-0/+31
2023-09-08Rework no_coverage to coverage(off)Andy Caldwell-1/+1
2023-05-01Rollup merge of #111042 - Zalathar:no-coverage, r=wesleywiserMatthias Krüger-0/+1
Add `#[no_coverage]` to the test harness's `fn main` There are two main motivations for adding `#[no_coverage]` to the test harness's entry point: - The entry point is trivial compiler-generated code that doesn't correspond to user source, and it always runs, so there's no value in instrumenting it for coverage. - Because it has dummy spans, it causes the instrumentor implementation to emit invalid coverage mappings that confuse `llvm-cov` and result in strange coverage reports. Fixes #110749.
2023-05-01Add `#[no_coverage]` to the test harness's `fn main`Zalathar-0/+1
2023-04-30Close parentheses for `offset_of` in AST pretty printingNilstrieb-0/+4
HIR pretty printing already handles it correctly.
2023-03-20Auto merge of #108148 - parthopdas:master, r=oli-obkbors-4/+21
Implementing "<test_binary> --list --format json" for use by IDE test explorers / runners Fixes #107307 PR 1 of 2 - wiring up just the new information + implement the command line changes i.e. --format json + tests upcoming: PR 2 of 2 - clean up "#[cfg(not(bootstrap))]" from PR 1 As per the discussions on - MCP: https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Implementing.20.22.3Ctest_binary.3E.20--list.20--form.E2.80.A6.20compiler-team.23592/near/328747548 - preRFC: https://internals.rust-lang.org/t/pre-rfc-implementing-test-binary-list-format-json-for-use-by-ide-test-explorers-runners/18308 - FYI on Discord: https://discord.com/channels/442252698964721669/459149169546887178/1075581549409484820
2023-03-16Bless pretty tests.Mara Bos-6/+4
2023-03-15Implementing "<test_binary> --list --format json" #107307 #49359Partha P. Das-4/+21
2023-03-12Remove uses of `box_syntax` in rustc and toolsclubby789-3/+0
2023-01-29Update tests.Mara Bos-3/+4
2023-01-12Bless pretty tests.Mara Bos-4/+2
2023-01-11Change `src/test` to `tests` in source files, fix tidy and testsAlbert Larsan-2/+2
2023-01-11Move /src/test to /testsAlbert Larsan-0/+1961