about summary refs log tree commit diff
path: root/src/test/pretty
AgeCommit message (Collapse)AuthorLines
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
2020-03-18use pretty-compare-only in a testMazdak Farrokhzad-0/+1
2020-03-17Update pretty testsGuillaume Gomez-6/+5
2020-03-17Update tests for erasing regions in typeckMatthew Jasper-22/+22
2020-03-04Extent pretty-print testAaron Hill-0/+9
2020-03-04Permit attributes on 'if' expressionsAaron Hill-0/+28
Previously, attributes on 'if' expressions (e.g. #[attr] if true {}) were disallowed during parsing. This made it impossible for macros to perform any custom handling of such attributes (e.g. stripping them away), since a compilation error would be emitted before they ever had a chance to run. This PR permits attributes on 'if' expressions ('if-attrs' from here on). Both built-in attributes (e.g. `#[allow]`, `#[cfg]`) are supported. We still do *not* accept attributes on 'other parts' of an if-else chain. That is, the following code snippet still fails to parse: ```rust if true {} #[attr] else if false {} else #[attr] if false {} #[attr] else {} ```
2020-02-21print vis & defaultness for nested itemsMazdak Farrokhzad-26/+47
2020-02-13parser: unify item list parsing.Mazdak Farrokhzad-0/+7
as a consequence, `trait X { #![attr] }` becomes legal.
2020-02-07add regression testMikhail Babenko-0/+42
2020-02-02pretty: print attrs in struct exprMazdak Farrokhzad-0/+16
2020-01-24Remove unused ignore-license directivesTomasz Miąsko-5/+0
The tidy check was removed in rust-lang/rust#53617
2019-12-20ast_stmt_expr_attr -> pretty & ui testsMazdak Farrokhzad-0/+175
2019-12-18Add more tests for raw_ref_opMatthew Jasper-0/+12
2019-12-07Print the visibility in `print_variant`.Mazdak Farrokhzad-0/+8
2019-11-02Merge branch 'master' into format-temporariesJon Gjengset-1/+1
2019-10-28Fix a previously forgotten pretty-printing test after a change to the ↵Patryk Wychowaniec-1/+1
pretty-printing mechanism.
2019-09-28Update pretty-print test with new format! implJon Gjengset-26/+30
2019-09-15Print visibility of `macro` itemsMatthew Jasper-1/+1
2019-08-25pprust: Do not print spaces before some tokensVadim Petrochenkov-9/+6
2019-08-16Remove meaningless comments in src/testsd234678-2/+0
2019-08-10resolve: Remove remaining special cases from built-in macrosVadim Petrochenkov-5/+5
2019-07-15pprust: Support `macro` macrosVadim Petrochenkov-0/+7
2019-07-15pprust: Fix formatting regressions from the previous commitsVadim Petrochenkov-10/+57
Fix some remaining cases of bad formatting Update some failing tests
2019-07-15pprust: Do not convert attributes into `MetaItem`s for printingVadim Petrochenkov-2/+9
Fixes https://github.com/rust-lang/rust/issues/62628
2019-07-15pprust: Use `print_mac_common` for delimited token groupsVadim Petrochenkov-3/+3
2019-07-15pprust: Use `print_mac_common` for `macro_rules` definitionsVadim Petrochenkov-3/+5
2019-07-15pprust: Move some methods to the `PrintState` traitVadim Petrochenkov-2/+2
So that path and macro argument printing code can be shared
2019-06-08Introduce `#[rustc_dummy]` attribute and use it in testsVadim Petrochenkov-155/+146
Unlike other built-in attributes, this attribute accepts any input
2019-05-24Move async/await tests to test/ui/async-awaitvarkor-7/+0
2019-03-15rustc: pass Option<&Substs> and Namespace around in ty::item_path.Eduard-Mihai Burtescu-17/+17
2019-03-14Moved issue tests to subdirs and normalised names.Alexander Regueiro-6/+10
2019-03-03NitAlexander Regueiro-1/+1
2019-03-02Fix C-variadic function printingDan Robertson-0/+15
There is no longer a need to append the string `", ..."` to a functions args as `...` is parsed as an argument and will appear in the functions arguments.