about summary refs log tree commit diff
path: root/tests/ui/unpretty
AgeCommit message (Collapse)AuthorLines
2025-09-26Auto merge of #145882 - m-ou-se:format-args-extend-1-arg, r=petrochenkovbors-2/+4
Extended temporary argument to format_args!() in all cases Fixes https://github.com/rust-lang/rust/issues/145880 by removing the special case.
2025-09-10fixup no_{core,std} handling codeJana Dönszelmann-1/+1
2025-08-26Update tests.Mara Bos-2/+4
2025-08-21Rollup merge of #145604 - compiler-errors:static-closure, r=fmeaseJacob Pratt-20/+23
Gate static closures behind a parser feature I'd like to gate `static ||` closures behind a feature gate, since we shouldn't allow people to take advantage of this syntax if it's currently unstable. Right now, since it's only rejected after ast lowering, it's accessible to macros. Let's crater this to see if we can claw it back without breaking anyone's code.
2025-08-19Gate static coroutines behind a parser featureMichael Goulet-20/+23
2025-08-14resolve prelude import at `build_reduced_graph` phaseLorrensP-2158466-9/+9
2025-08-11Propagate TraitImplHeader to hirCameron Steffen-1/+1
2025-07-28expand: Micro-optimize prelude injectionVadim Petrochenkov-26/+26
Use `splice` to avoid shifting the other items twice. Put `extern crate std;` first so it's already resolved when we resolve `::std::prelude::rust_20XX`.
2025-07-23Update uitest stderrsJonathan Brouwer-10/+10
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-10fix: Include frontmatter in -Zunpretty outputEd Page-0/+2
In the implementation (#140035), this was left as an open question for the tracking issue (#136889). My assumption is that this should be carried over. Thankfully, either way, `-Zunpretty` is unstable and we can always change it even if we stabilize frontmatter.
2025-07-09test: Verify frontmatter unpretty behaviorEd Page-0/+17
2025-07-06Fix line break after ":" in unpretty attribute printJonathan Brouwer-9/+6
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-06Rewrite empty attribute lintJonathan Brouwer-1/+2
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-01Remove support for dyn*Michael Goulet-26/+20
2025-06-27Rollup merge of #139858 - oli-obk:new-const-traits-syntax, r=fee1-deadMatthias Krüger-6/+6
New const traits syntax This PR only affects the AST and doesn't actually change anything semantically. All occurrences of `~const` outside of libcore have been replaced by `[const]`. Within libcore we have to wait for rustfmt to be bumped in the bootstrap compiler. This will happen "automatically" (when rustfmt is run) during the bootstrap bump, as rustfmt converts `~const` into `[const]`. After this we can remove the `~const` support from the parser Caveat discovered during impl: there is no legacy bare trait object recovery for `[const] Trait` as that snippet in type position goes down the slice /array parsing code and will error r? ``@fee1-dead`` cc ``@nikomatsakis`` ``@traviscross`` ``@compiler-errors``
2025-06-26Change const trait bound syntax from ~const to [const]Oli Scherer-6/+6
2025-06-24Rollup merge of #142704 - tgross35:remove-concat_idents, r=fee1-deadGuillaume Gomez-33/+38
Remove the deprecated unstable `concat_idents!` macro In [rust-lang/rust#137653], the lang and libs-API teams did a joint FCP to deprecate and eventually remove the long-unstable `concat_idents!` macro. The deprecation is landing in 1.88, so do the removal here (target version 1.90). This macro has been superseded by the more recent `${concat(...)}` metavariable expression language feature, which avoids some of the limitations of `concat_idents!`. The metavar expression is unstably available under the [`macro_metavar_expr_concat`] feature. History is mildly interesting here: `concat_idents!` goes back to 2011 when it was introduced with 513276e595f8 ("Add #concat_idents[] and #ident_to_str[]"). The syntax looks a bit different but it still works about the same: let asdf_fdsa = "<.<"; assert(#concat_idents[asd,f_f,dsa] == "<.<"); assert(#ident_to_str[use_mention_distinction] == "use_mention_distinction"); (That test existed from introduction until its removal here.) Closes: https://github.com/rust-lang/rust/issues/29599 [rust-lang/rust#137653]: https://github.com/rust-lang/rust/pull/137653 [`macro_metavar_expr_concat`]: https://github.com/rust-lang/rust/issues/124225
2025-06-24Migrate some tests away from `concat-idents`Trevor Gross-33/+38
`concat_idents!` is in the process of being removed, but a few things it is used to test will still be relevant. Migrate these tests to something other than `concat_idents`.
2025-06-21All HIR attributes are outerDavid Tolnay-45/+30
2025-06-21Add regression test for issue 142649David Tolnay-0/+14
2025-06-18Update unpretty tests.Mara Bos-4/+8
2025-06-13Rollup merge of #134847 - dtolnay:asymmetrical, r=fmeaseMatthias Krüger-1/+1
Implement asymmetrical precedence for closures and jumps I have been through a series of asymmetrical precedence designs in Syn, and finally have one that I like and is worth backporting into rustc. It is based on just 2 bits of state: `next_operator_can_begin_expr` and `next_operator_can_continue_expr`. Asymmetrical precedence is the thing that enables `(return 1) + 1` to require parentheses while `1 + return 1` does not, despite `+` always having stronger precedence than `return` [according to the Rust Reference](https://doc.rust-lang.org/1.83.0/reference/expressions.html#expression-precedence). This is facilitated by `next_operator_can_continue_expr`. Relatedly, it is the thing that enables `(return) - 1` to require parentheses while `return + 1` does not, despite `+` and `-` having exactly the same precedence. This is facilitated by `next_operator_can_begin_expr`. **Example:** ```rust macro_rules! repro { ($e:expr) => { $e - $e; $e + $e; }; } fn main() { repro!{return} repro!{return 1} } ``` `-Zunpretty=expanded` **Before:** ```console fn main() { (return) - (return); (return) + (return); (return 1) - (return 1); (return 1) + (return 1); } ``` **After:** ```console fn main() { (return) - return; return + return; (return 1) - return 1; (return 1) + return 1; } ```
2025-05-04compiletest: Support matching on non-json lines in compiler outputVadim Petrochenkov-1/+2
and migrate most of remaining `error-pattern`s to it.
2025-05-03Implement asymmetrical precedence for closures and jumpsDavid Tolnay-1/+1
2025-05-03Avoid an indent for labelled loops.Nicholas Nethercote-2/+1
2025-05-03Fix some hir pretty-printing over-indenting.Nicholas Nethercote-31/+30
2025-05-03Improve hir pretty-printing of attributes.Nicholas Nethercote-6/+32
2025-05-03Fix hir pretty-printing of `global_asm!`.Nicholas Nethercote-1/+2
One of the boxes isn't closed, and this causes everything after it to be over-indented.
2025-05-02Improve coverage of HIR pretty printing.Nicholas Nethercote-104/+1014
By taking the existing `expanded-exhaustive.rs` test and running it with both `Zunpretty=expanded` *and* `Zunpretty=hir`. Also rename some files, and split the asm parts out so they only run on x86-64.
2025-04-29Improve pretty-printing of braces.Nicholas Nethercote-1/+1
Most notably, the `FIXME` for suboptimal printing of `use` groups in `tests/ui/macros/stringify.rs` is fixed. And all other test output changes result in pretty printed output being closer to the original formatting in the source code.
2025-04-24Deprecate the unstable `concat_idents!`Trevor Gross-0/+3
`concat_idents` has been around unstably for a long time, but there is now a better (but still unstable) way to join identifiers using `${concat(...)}` syntax with `macro_metavar_expr_concat`. This resolves a lot of the problems with `concat_idents` and is on a better track toward stabilization, so there is no need to keep both versions around. `concat_idents!` still has a lot of use in the ecosystem so deprecate it before removing, as discussed in [1]. Link: https://github.com/rust-lang/rust/issues/124225 [1]: https://rust-lang.zulipchat.com/#narrow/channel/219381-t-libs/topic/Removing.20.60concat_idents.60
2025-04-18Remove let_chains feature gate from some places in the testsuiteest31-8/+3
2025-04-16Explicitly annotate edition for `unpretty=expanded` and `unpretty=hir` testsLukas Wirth-1/+19
These emit prelude imports which means they are always edition dependent
2025-03-28Add `{ast,hir,thir}::PatKind::Missing` variants.Nicholas Nethercote-0/+8
"Missing" patterns are possible in bare fn types (`fn f(u32)`) and similar places. Currently these are represented in the AST with `ast::PatKind::Ident` with no `by_ref`, no `mut`, an empty ident, and no sub-pattern. This flows through to `{hir,thir}::PatKind::Binding` for HIR and THIR. This is a bit nasty. It's very non-obvious, and easy to forget to check for the exceptional empty identifier case. This commit adds a new variant, `PatKind::Missing`, to do it properly. The process I followed: - Add a `Missing` variant to `{ast,hir,thir}::PatKind`. - Chang `parse_param_general` to produce `ast::PatKind::Missing` instead of `ast::PatKind::Missing`. - Look through `kw::Empty` occurrences to find functions where an existing empty ident check needs replacing with a `PatKind::Missing` check: `print_param`, `check_trait_item`, `is_named_param`. - Add a `PatKind::Missing => unreachable!(),` arm to every exhaustive match identified by the compiler. - Find which arms are actually reachable by running the test suite, changing them to something appropriate, usually by looking at what would happen to a `PatKind::Ident`/`PatKind::Binding` with no ref, no `mut`, an empty ident, and no subpattern. Quite a few of the `unreachable!()` arms were never reached. This makes sense because `PatKind::Missing` can't happen in every pattern, only in places like bare fn tys and trait fn decls. I also tried an alternative approach: modifying `ast::Param::pat` to hold an `Option<P<Pat>>` instead of a `P<Pat>`, but that quickly turned into a very large and painful change. Adding `PatKind::Missing` is much easier.
2025-03-25compiletest: Support matching on diagnostics without a spanVadim Petrochenkov-0/+2
2025-03-10Fix pretty printing of parsed attrs in hir_prettyMichael Goulet-14/+9
2025-03-05Revert #138019 after further discussion about adding this exception in ↵Jana Dönszelmann-5/+14
hir-pretty
2025-03-05Pretty-print `#[deprecated]` attribute in HIR.Predrag Gruevski-0/+67
2025-02-23Rollup merge of #137423 - Urgau:imprv-pretty-hir, r=compiler-errorsJacob Pratt-0/+83
Improve a bit HIR pretty printer This PR improve (a bit) the HIR pretty printer. It does so by: - Not printing elided lifetimes (those are not expressible in surface Rust anyway) - And by rendering implicit self with the shorthand syntax I also tried fixing some indentation and other things but gave up for now. Best reviewed commit by commit.
2025-02-22Render implicit self with their shorthand syntax in HIR pretty printingUrgau-1/+33
2025-02-22Filter elided lifetimes in HIR pretty printingUrgau-4/+4
2025-02-18Pre-commit unpretty HIR testUrgau-0/+51
2025-02-16Fix test that relies on error languageChris Denton-3/+3
2025-02-11Add a TyPat in the AST to reuse the generic arg lowering logicOli Scherer-1/+1
2025-01-22Point at invalid utf-8 span on user's source codeEsteban Küber-1/+1
``` error: couldn't read `$DIR/not-utf8-bin-file.rs`: stream did not contain valid UTF-8 --> $DIR/not-utf8-2.rs:6:5 | LL | include!("not-utf8-bin-file.rs"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: `[193]` is not valid utf-8 --> $DIR/not-utf8-bin-file.rs:2:14 | LL | let _ = "�|�␂!5�cc␕␂��"; | ^ = note: this error originates in the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info) ``` When we attempt to load a Rust source code file, if there is a OS file failure we try reading the file as bytes. If that succeeds we try to turn it into UTF-8. If *that* fails, we provide additional context about *where* the file has the first invalid UTF-8 character. Fix #76869.
2025-01-15Rollup merge of #132397 - m-ou-se:warn-missing-abi, r=NadrierilJacob Pratt-8/+8
Make missing_abi lint warn-by-default. This makes the missing_abi lint warn-by-default, as suggested here: https://github.com/rust-lang/rfcs/pull/3722#issuecomment-2447719047 This needs a lang FCP.
2025-01-08Rename PatKind::Lit to ExprOli Scherer-4/+4
2025-01-08Exhaustively handle expressions in patternsOli Scherer-1/+1
2025-01-07Update tests.Mara Bos-8/+8
2025-01-03turn rustc_box into an intrinsicRalf Jung-16/+91