rust/tests
bors 1203e0866e Auto merge of #106824 - m-ou-se:format-args-flatten, r=oli-obk
Flatten/inline format_args!() and (string and int) literal arguments into format_args!()

Implements https://github.com/rust-lang/rust/issues/78356

Gated behind `-Zflatten-format-args=yes`.

Part of #99012

This change inlines string literals, integer literals and nested format_args!() into format_args!() during ast lowering, making all of the following pairs result in equivalent hir:

```rust
println!("Hello, {}!", "World");
println!("Hello, World!");
```

```rust
println!("[info] {}", format_args!("error"));
println!("[info] error");
```

```rust
println!("[{}] {}", status, format_args!("error: {}", msg));
println!("[{}] error: {}", status, msg);
```

```rust
println!("{} + {} = {}", 1, 2, 1 + 2);
println!("1 + 2 = {}", 1 + 2);
```

And so on.

This is useful for macros. E.g. a `log::info!()` macro could just pass the tokens from the user directly into a `format_args!()` that gets efficiently flattened/inlined into a `format_args!("info: {}")`.

It also means that `dbg!(x)` will have its file, line, and expression name inlined:

```rust
eprintln!("[{}:{}] {} = {:#?}", file!(), line!(), stringify!(x), x); // before
eprintln!("[example.rs:1] x = {:#?}", x); // after
```

Which can be nice in some cases, but also means a lot more unique static strings than before if dbg!() is used a lot.
2023-03-16 13:46:52 +00:00
..
assembly Update the minimum external LLVM to 14 2023-02-10 16:06:25 -08:00
auxiliary Move /src/test to /tests 2023-01-11 09:32:08 +00:00
codegen Auto merge of #109035 - scottmcm:ptr-read-should-know-undef, r=WaffleLapkin,JakobDegen 2023-03-15 11:44:12 +00:00
codegen-units Use unused_generic_params from crate metadata 2023-03-14 16:33:12 +00:00
debuginfo Remove the capture_disjoint_fields feature 2023-02-28 01:21:15 +00:00
incremental Move /src/test to /tests 2023-01-11 09:32:08 +00:00
mir-opt Auto merge of #108282 - cjgillot:mir-checked-sh, r=tmiasko 2023-03-15 21:31:06 +00:00
pretty Bless pretty tests. 2023-03-16 11:21:50 +01:00
run-make Update coverage info. 2023-03-09 17:51:38 +00:00
run-make-fulldeps rustdoc: fix test case for custom themes 2023-03-08 12:49:35 -07:00
run-pass-valgrind Move /src/test to /tests 2023-01-11 09:32:08 +00:00
rustdoc rustdoc: remove std:: from primitive intra-doc link tooltips 2023-03-15 11:34:37 -07:00
rustdoc-gui Rollup merge of #106915 - notriddle:notriddle/load-only-one-theme, r=GuillaumeGomez,jsha 2023-03-09 12:11:52 +01:00
rustdoc-js rustdoc: fix type search when more than one where clause applies 2023-03-07 11:37:04 -07:00
rustdoc-js-std Rollup merge of #108875 - notriddle:notriddle/return-trait, r=GuillaumeGomez 2023-03-16 08:57:05 +01:00
rustdoc-json Add regression test for #107677 2023-02-18 18:28:17 +01:00
rustdoc-ui Bless -Zhelp output test. 2023-03-16 12:26:20 +01:00
ui Auto merge of #106824 - m-ou-se:format-args-flatten, r=oli-obk 2023-03-16 13:46:52 +00:00
ui-fulldeps Remove uses of box_syntax in rustc and tools 2023-03-12 13:19:46 +00:00
COMPILER_TESTS.md Move /src/test to /tests 2023-01-11 09:32:08 +00:00