about summary refs log tree commit diff
path: root/src/test/pretty
AgeCommit message (Collapse)AuthorLines
2022-02-07Bless use tree pretty print testDavid Tolnay-5/+11
2022-02-07Add pretty printer test for use treesDavid Tolnay-0/+17
2022-02-03Bless all pretty printer tests and ui testsDavid Tolnay-11/+12
2022-01-31Bless all pretty printer tests and ui testsDavid Tolnay-2/+1
2022-01-30Restore a visual alignment mode for block commentsDavid Tolnay-3/+3
2022-01-30Bless all pretty printer tests and ui testsDavid Tolnay-158/+138
2022-01-17Emit simpler code from format_argsDavid Tolnay-16/+2
2022-01-12Remove pretty tests for LLVM-style inline assemblyTomasz Miąsko-17/+3
2021-12-29Move equal sign back into head iboxDavid Tolnay-2/+1
2021-12-29Fix spacing of pretty printed const item without bodyDavid Tolnay-11/+12
2021-12-28Remove pretty printer space inside block with only outer attrsDavid Tolnay-11/+11
2021-12-12Stabilize asm! and global_asm!Amanieu d'Antras-6/+8
They are also removed from the prelude as per the decision in https://github.com/rust-lang/rust/issues/87228. stdarch and compiler-builtins are updated to work with the new, stable asm! and global_asm! macros.
2021-12-08Pretty print break and continue without redundant spaceDavid Tolnay-6/+5
2021-12-05Add pretty printer test for async blocksDavid Tolnay-0/+9
Currently fails with: ---- [pretty] pretty/async.rs stdout ---- error: pretty-printed source does not match expected source expected: ------------------------------------------ // pp-exact // pretty-compare-only // edition:2021 async fn f() { let first = async { 1 }; let second = async move { 2 }; join(first, second).await } ------------------------------------------ actual: ------------------------------------------ // pp-exact // pretty-compare-only // edition:2021 async fn f() { let first = async { 1 }; let second = async move { 2 }; join(first, second).await } ------------------------------------------ diff: ------------------------------------------ 3 // edition:2021 4 5 async fn f() { - let first = async { 1 }; - let second = async move { 2 }; + let first = async { 1 }; + let second = async move { 2 }; 8 join(first, second).await 9 } 10
2021-12-01Pretty print empty blocks as {}David Tolnay-80/+79
2021-11-06Don't destructure args tuple in format_args!Cameron Steffen-2/+2
2021-09-21Use ZST for fmt unsafetyCameron Steffen-39/+27
This allows the format_args! macro to keep the pre-expansion code out of the unsafe block without doing gymnastics with nested `match` expressions. This reduces codegen.
2021-09-09Revert "Add test for pretty printing anonymous types"Felix S. Klock II-24/+0
This reverts commit d59b1f1ef4be692b67c1ff1b49ec810fd59452cf.
2021-08-16Make Arguments constructors unsafeCameron Steffen-27/+39
2021-07-27Auto merge of #83491 - jyn514:remove-pretty, r=pnkfelixbors-2/+2
Remove unstable `--pretty` flag It doesn't do anything `--unpretty` doesn't, and due to a bug, also didn't show up in `--help`. I don't think there's any reason to keep it around, I haven't seen anyone using it. Closes https://github.com/rust-lang/rust/issues/36473.
2021-07-03rustc_ast_pretty: Don't print space after `$`Noah Lev-6/+6
For example, this code: $arg:expr used to be pretty-printed as: $ arg : expr but is now pretty-printed as: $arg : expr
2021-06-29Rollup merge of #86358 - klensy:pp-loop, r=Mark-SimulacrumYuki Okushi-3/+20
fix pretty print for `loop`
2021-06-26Auto merge of #86586 - Smittyvb:https-everywhere, r=petrochenkovbors-2/+2
Use HTTPS links where possible While looking at #86583, I wondered how many other (insecure) HTTP links were in `rustc`. This changes most other `http` links to `https`. While most of the links are in comments or documentation, there are a few other HTTP links that are used by CI that are changed to HTTPS. Notes: - I didn't change any to or in licences - Some links don't support HTTPS :( - Some `http` links were dead, in those cases I upgraded them to their new places (all of which used HTTPS)
2021-06-23Use HTTPS links where possibleSmitty-2/+2
2021-06-23fix pretty print for `loop` in mir and hirklensy-3/+20
2021-06-22Auto merge of #85193 - pnkfelix:readd-support-for-inner-attrs-within-match, ↵bors-7/+18
r=nikomatsakis Re-add support for parsing (and pretty-printing) inner-attributes in match body Re-add support for parsing (and pretty-printing) inner-attributes within body of a `match`. In other words, we can do `match EXPR { #![inner_attr] ARM_1 ARM_2 ... }` again. I believe this unbreaks the only four crates that crater flagged as broken by PR #83312. (I am putting this up so that the lang-team can check it out and decide whether it changes their mind about what to do regarding PR #83312.)
2021-05-24Add test for pretty printing anonymous typesjedel1043-0/+24
2021-05-15Remove some unncessary spaces from pretty-printed tokenstream outputAaron Hill-4/+4
In addition to making the output look nicer for all crates, this also aligns the pretty-printing output with what the `rental` crate expects. This will allow us to eventually disable a backwards-compat hack in a follow-up PR.
2021-05-11Updates to tests.Felix S. Klock II-7/+18
2021-05-03parser: Remove support for inner attributes on non-block expressionsVadim Petrochenkov-50/+39
2021-04-28Be stricter about rejecting LLVM reserved registers in asm!Amanieu d'Antras-2/+2
2021-04-23Remove unstable `--pretty` flagJoshua Nelson-2/+2
It doesn't do anything `--unpretty` doesn't, and due to a bug, also didn't show up in `--help`. I don't think there's any reason to keep it around, I haven't seen anyone using it.
2021-02-25Update test/pretty output for edition preludes.Mara Bos-6/+6
2021-02-13Fix pretty printing of generic associated type constraintsMatthew Jasper-0/+2
2021-02-08Fix pretty printer macro_rules with semicolon.Eric Huss-0/+19
2021-01-11test for issue 80832Jeremy Fitzhardinge-0/+20
2020-11-23Rename `optin_builtin_traits` to `auto_traits`Camelid-1/+1
They were originally called "opt-in, built-in traits" (OIBITs), but people realized that the name was too confusing and a mouthful, and so they were renamed to just "auto traits". The feature flag's name wasn't updated, though, so that's what this PR does. There are some other spots in the compiler that still refer to OIBITs, but I don't think changing those now is worth it since they are internal and not particularly relevant to this PR. Also see <https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/opt-in.2C.20built-in.20traits.20(auto.20traits).20feature.20name>.
2020-11-12fix pretty print for qpaththiolliere-0/+16
2020-09-02pretty: trim paths of unique symbolsDan Aloni-28/+28
If a symbol name can only be imported from one place for a type, and as long as it was not glob-imported anywhere in the current crate, we can trim its printed path and print only the name. This has wide implications on error messages with types, for example, shortening `std::vec::Vec` to just `Vec`, as long as there is no other `Vec` importable anywhere. This adds a new '-Z trim-diagnostic-paths=false' option to control this feature. On the good path, with no diagnosis printed, we should try to avoid issuing this query, so we need to prevent trimmed_def_paths query on several cases. This change also relies on a previous commit that differentiates between `Debug` and `Display` on various rustc types, where the latter is trimmed and presented to the user and the former is not.
2020-08-02tests: add regression test for #74745David Wood-0/+5
This commit adds a regression test for #74745. While a `ignore-tidy-trailing-lines` header is required, this doesn't stop the test from reproducing, so long as there is no newline at the end of the file. However, adding the header comments made the test fail due to a bug in pprust, fixed in the previous commit. Signed-off-by: David Wood <david@davidtw.co>
2020-08-02pprust: adjust mixed comment printingDavid Wood-2/+0
This commit adjusts the pretty printing of mixed comments so that the initial zero-break isn't emitted at the beginning of the line. Through this, the `block-comment-wchar` test can have the `pp-exact` file removed, as it no longer converges from pretty printing of the source. Signed-off-by: David Wood <david@davidtw.co>
2020-07-17Make fmt::Arguments::as_str() return a 'static str.Mara Bos-21/+21
2020-07-12pprust: support multiline comments within linesDavid Wood-0/+34
This commit adds support to rustc_ast_pretty for multiline comments that start and end within a line of source code. Signed-off-by: David Wood <david@davidtw.co>
2020-06-15asm: Allow multiple template strings; interpret them as newline-separatedJosh Triplett-0/+17
Allow the `asm!` macro to accept a series of template arguments, and interpret them as if they were concatenated with a '\n' between them. This allows writing an `asm!` where each line of assembly appears in a separate template string argument. This syntax makes it possible for rustfmt to reliably format and indent each line of assembly, without risking changes to the inside of a template string. It also avoids the complexity of having the user carefully format and indent a multi-line string (including where to put the surrounding quotes), and avoids the extra indentation and lines of a call to `concat!`. For example, rewriting the second example from the [blog post on the new inline assembly syntax](https://blog.rust-lang.org/inside-rust/2020/06/08/new-inline-asm.html) using multiple template strings: ```rust fn main() { let mut bits = [0u8; 64]; for value in 0..=1024u64 { let popcnt; unsafe { asm!( " popcnt {popcnt}, {v}", "2:", " blsi rax, {v}", " jz 1f", " xor {v}, rax", " tzcnt rax, rax", " stosb", " jmp 2b", "1:", v = inout(reg) value => _, popcnt = out(reg) popcnt, out("rax") _, // scratch inout("rdi") bits.as_mut_ptr() => _, ); } println!("bits of {}: {:?}", value, &bits[0..popcnt]); } } ``` Note that all the template strings must appear before all other arguments; you cannot, for instance, provide a series of template strings intermixed with the corresponding operands. In order to get srcloc mappings right for macros that generate multi-line string literals, create one line_span for each line in the string literal, each pointing to the macro. Make `rustc_parse_format::Parser::curarg` `pub`, so that we can propagate it from one template string argument to the next.
2020-06-13pretty/asm.rs should only be tested for x86_64 and not AArch64Yerkebulan Tulibergenov-0/+2
2020-05-18Add tests for asm!Amanieu d'Antras-0/+44
2020-03-26Update tests to use llvm_asm!Amanieu d'Antras-8/+8
2020-03-26introduce `negative_impls` feature gate and documentNiko Matsakis-1/+1
They used to be covered by `optin_builtin_traits` but negative impls are now applicable to all traits, not just auto traits. This also adds docs in the unstable book for the current state of auto traits.
2020-03-18Rollup merge of #70075 - GuillaumeGomez:fix-repr-display, r=petrochenkovMazdak Farrokhzad-6/+5
Fix repr pretty display Fixes #70027. r? @varkor
2020-03-18Rollup merge of #69838 - Centril:expand-module, r=petrochenkovMazdak Farrokhzad-0/+1
Expansion-driven outline module parsing After this PR, the parser will not do any conditional compilation or loading of external module files when `mod foo;` is encountered. Instead, the parser only leaves `mod foo;` in place in the AST, with no items filled in. Expansion later kicks in and will load the actual files and do the parsing. This entails that the following is now valid: ```rust #[cfg(FALSE)] mod foo { mod bar { mod baz; // `foo/bar/baz.rs` doesn't exist, but no error! } } ``` Fixes https://github.com/rust-lang/rust/issues/64197. r? @petrochenkov