Skip to content

Conversation

@joboet
Copy link
Member

@joboet joboet commented Feb 8, 2026

This attempts to achieve the same thing as #104525, but without adding a dedicated method to Display.

Draft for experimentation

This attempts to achieve the same thing as rust-lang#104525, but without adding a
dedicated method to `Display`.

Draft for experimentation
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Feb 8, 2026
@joboet
Copy link
Member Author

joboet commented Feb 8, 2026

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Feb 8, 2026
[EXPERIMENT] optimize `format_args` placeholders without options
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Feb 8, 2026
@rust-log-analyzer
Copy link
Collaborator

The job aarch64-gnu-llvm-20-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
REPOSITORY                                   TAG       IMAGE ID       CREATED       SIZE
ghcr.io/dependabot/dependabot-updater-core   latest    afc745c7535d   12 days ago   783MB
=> Removing docker images...
Deleted Images:
untagged: ghcr.io/dependabot/dependabot-updater-core:latest
untagged: ghcr.io/dependabot/dependabot-updater-core@sha256:faae3d3a1dedd24cde388bb506bbacc0f7ed1eae99ebac129af66acd8540c84a
deleted: sha256:afc745c7535da1bb12f92c273b9a7e9c52c3f12c5873714b2542da259c6d9769
deleted: sha256:64e147d5e54d9be8b8aa322e511cda02296eda4b8b8d063c6a314833aca50e29
deleted: sha256:5cba409bb463f4e7fa1a19f695450170422582c1bc7c0e934d893b4e5f558bc6
deleted: sha256:cddc6ebd344b0111eaab170ead1dfda24acdfe865ed8a12599a34d338fa8e28b
deleted: sha256:2412c3f334d79134573cd45e657fb6cc0abd75bef3881458b0d498d936545c8d
---
test [ui] tests/ui/abi/abi-sysv64-register-usage.rs ... ignored, ignored when the architecture is aarch64
test [ui] tests/ui/abi/abi-typo-unstable.rs#feature_disabled ... ok
test [ui] tests/ui/abi/abi-typo-unstable.rs#feature_enabled ... ok
test [ui] tests/ui/abi/anon-extern-mod.rs ... ok
test [ui] tests/ui/abi/avr-sram.rs#disable_sram ... ok
test [ui] tests/ui/abi/avr-sram.rs#no_sram ... ok
test [ui] tests/ui/abi/avr-sram.rs#has_sram ... ok
test [ui] tests/ui/abi/arm-unadjusted-intrinsic.rs#aarch64 ... ok
test [ui] tests/ui/abi/arm-unadjusted-intrinsic.rs#arm ... ok
test [ui] tests/ui/abi/bad-custom.rs ... ok
test [ui] tests/ui/abi/c-stack-as-value.rs ... ok
test [ui] tests/ui/abi/c-zst.rs#aarch64-darwin ... ok
---
test [ui] tests/ui/asm/aarch64/may_unwind.rs ... ok
test [ui] tests/ui/asm/aarch64/type-check-3.rs ... ok
test [ui] tests/ui/asm/aarch64/type-check-2.rs ... ok
test [ui] tests/ui/asm/aarch64/type-f16.rs ... ok
test [ui] tests/ui/asm/aarch64v8r.rs#hf ... ok
test [ui] tests/ui/asm/aarch64v8r.rs#r82 ... ok
test [ui] tests/ui/asm/aarch64v8r.rs#sf ... ok
test [ui] tests/ui/asm/asm-with-nested-closure.rs ... ok
test [ui] tests/ui/asm/aarch64/sym.rs ... ok
test [ui] tests/ui/asm/binary_asm_labels.rs ... ignored, only executed when the architecture is x86_64
test [ui] tests/ui/asm/arm-low-dreg.rs ... ok
test [ui] tests/ui/asm/bad-template.rs#aarch64 ... ok
---
test [ui] tests/ui/extern/issue-64655-extern-rust-must-allow-unwind.rs#fat2 ... ok
test [ui] tests/ui/extern/issue-64655-extern-rust-must-allow-unwind.rs#fat3 ... ok
test [ui] tests/ui/extern/issue-80074.rs ... ok
test [ui] tests/ui/extern/issue-95829.rs ... ok
test [ui] tests/ui/extern/lgamma-linkage.rs ... ok
test [ui] tests/ui/extern/issue-64655-extern-rust-must-allow-unwind.rs#thin1 ... ok
test [ui] tests/ui/extern/not-in-block.rs ... ok
test [ui] tests/ui/extern/unsized-extern-derefmove.rs ... ok
test [ui] tests/ui/extern/no-mangle-associated-fn.rs ... ok
test [ui] tests/ui/feature-gates/allow-features-empty.rs ... ok
---
test [ui] tests/ui/imports/ambiguous-7.rs ... ok
test [ui] tests/ui/imports/ambiguous-import-visibility-module.rs ... ok
test [ui] tests/ui/imports/ambiguous-8.rs ... ok
test [ui] tests/ui/imports/ambiguous-glob-vs-expanded-extern.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-glob-vs-multiouter.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-globvsglob.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-no-implicit-prelude.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-non-prelude-core-glob.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-non-prelude-std-glob.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-pick-core.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-pick-std.rs ... ok
---
---- [ui] tests/ui/const-generics/infer/issue-77092.rs stdout ----
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/const-generics/infer/issue-77092/issue-77092.stderr`
diff of stderr:

25    = note: required for `[i32; _]` to implement `Debug`
26    = note: 1 redundant requirement hidden
27    = note: required for `&mut [i32; _]` to implement `Debug`
- note: required by a bound in `core::fmt::rt::Argument::<'_>::new_debug`
+ note: required by a bound in `core::fmt::rt::Argument::<'_>::new_debug_simple`
29   --> $SRC_DIR/core/src/fmt/rt.rs:LL:COL
+   ::: $SRC_DIR/core/src/fmt/rt.rs:LL:COL
+    |
+    = note: in this macro invocation
+    = note: this error originates in the macro `argument_constructor` (in Nightly builds, run with -Z macro-backtrace for more info)
30 help: consider specifying the generic arguments
31    |
32 LL |         println!("{:?}", take_array_from_mut::<i32, N>(&mut arr, i));


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args const-generics/infer/issue-77092.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/const-generics/infer/issue-77092.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/const-generics/infer/issue-77092" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error[E0284]: type annotations needed
##[error]  --> /checkout/tests/ui/const-generics/infer/issue-77092.rs:11:26
   |
LL |         println!("{:?}", take_array_from_mut(&mut arr, i));
   |                          ^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `N` declared on the function `take_array_from_mut`
   |
note: required by a const generic parameter in `take_array_from_mut`
  --> /checkout/tests/ui/const-generics/infer/issue-77092.rs:3:27
   |
LL | fn take_array_from_mut<T, const N: usize>(data: &mut [T], start: usize) -> &mut [T; N] {
   |                           ^^^^^^^^^^^^^^ required by this const generic parameter in `take_array_from_mut`
help: consider specifying the generic arguments
   |
LL |         println!("{:?}", take_array_from_mut::<i32, N>(&mut arr, i));
   |                                             ++++++++++

error[E0284]: type annotations needed
##[error]  --> /checkout/tests/ui/const-generics/infer/issue-77092.rs:11:26
   |
LL |         println!("{:?}", take_array_from_mut(&mut arr, i));
   |                   ----   ^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `N` declared on the function `take_array_from_mut`
   |                   |
   |                   required by this formatting parameter
   |
   = note: required for `[i32; _]` to implement `Debug`
   = note: 1 redundant requirement hidden
   = note: required for `&mut [i32; _]` to implement `Debug`
note: required by a bound in `core::fmt::rt::Argument::<'_>::new_debug_simple`
  --> /rustc/FAKE_PREFIX/library/core/src/fmt/rt.rs:95:8
  ::: /rustc/FAKE_PREFIX/library/core/src/fmt/rt.rs:106:4
   |
   = note: in this macro invocation
   = note: this error originates in the macro `argument_constructor` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider specifying the generic arguments
   |
LL |         println!("{:?}", take_array_from_mut::<i32, N>(&mut arr, i));
   |                                             ++++++++++

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0284`.
---
Saved the actual stdout to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/unpretty/flattened-format-args/flattened-format-args.stdout`
diff of stdout:

11     {
12         ::std::io::_print({
13                 super let args = (&x,);
-                 super let args = [format_argument::new_display(args.0)];
+                 super let args =
+                     [format_argument::new_display_simple(args.0)];
15                 unsafe {
16                     format_arguments::new(b"\x08a 123 b \xc0\x05 xyz\n\x00",
17                         &args)


The actual stdout differed from the expected stdout
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args unpretty/flattened-format-args.rs`

error: 1 errors occurred comparing output.
status: exit status: 0
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/unpretty/flattened-format-args.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/unpretty/flattened-format-args" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2015" "-Zunpretty=hir" "-Zflatten-format-args=yes"
--- stdout -------------------------------
extern crate std;
#[prelude_import]
use ::std::prelude::rust_2015::*;
//@ compile-flags: -Zunpretty=hir -Zflatten-format-args=yes
//@ check-pass
//@ edition: 2015

fn main() {
    let x = 1;
    // Should flatten to println!("a 123 b {x} xyz\n"):
    {
        ::std::io::_print({
                super let args = (&x,);
                super let args =
                    [format_argument::new_display_simple(args.0)];
                unsafe {
                    format_arguments::new(b"\x08a 123 b \xc0\x05 xyz\n\x00",
                        &args)
                }
            });
    };
}
------------------------------------------
stderr: none

---- [ui] tests/ui/unpretty/flattened-format-args.rs stdout end ----
---- [ui] tests/ui/unpretty/exhaustive.rs#hir stdout ----
Saved the actual stdout to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/unpretty/exhaustive.hir/exhaustive.hir.stdout`
diff of stdout:

405         format_arguments::from_str("");
406         {
407             super let args = (&expr,);
-             super let args = [format_argument::new_display(args.0)];
+             super let args = [format_argument::new_display_simple(args.0)];
409             unsafe { format_arguments::new(b"\xc0\x00", &args) }
410         };
411     }


The actual stdout differed from the expected stdout
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args unpretty/exhaustive.rs`

error in revision `hir`: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/unpretty/exhaustive.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--cfg" "hir" "--check-cfg" "cfg(test,FALSE,expanded,hir)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/unpretty/exhaustive.hir" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2024" "-Zunpretty=hir"
--- stdout -------------------------------
//@ revisions: expanded hir
//@[expanded]compile-flags: -Zunpretty=expanded
//@[expanded]check-pass
//@[hir]compile-flags: -Zunpretty=hir
//@[hir]check-fail
//@ edition:2024

// Note: the HIR revision includes a `.stderr` file because there are some
// errors that only occur once we get past the AST.

#![feature(auto_traits)]
#![feature(box_patterns)]
#![feature(builtin_syntax)]
#![feature(const_trait_impl)]
---

    /// outer single-line doc comment
    /**
     * outer multi-line doc comment
     */
    #[doc = "outer doc attribute"]
    #[doc = "macro"]
    #[allow()]
    #[attr = Repr {reprs: [ReprC]}]
    struct Struct;
}

mod expressions {
    /// ExprKind::Array
    fn expr_array() {
        [];
        [true];
        [true];
        [true, true];
        ["long........................................................................"];
        ["long............................................................",
                true];
    }

    /// ExprKind::ConstBlock
    fn expr_const_block() {
---
                };
    }

    /// ExprKind::Call
    fn expr_call() {
        let f;
        f();
        f::<u8>();
        f::<1>();
        f::<'static, u8, 1>();
        f(true);
        f(true);
        ()();
    }

    /// ExprKind::MethodCall
    fn expr_method_call() {
        let x;
        x.f();
        x.f::<u8>();
        x.collect::<Vec<_>>();
    }

    /// ExprKind::Tup
    fn expr_tup() { (); (true,); (true, false); (true, false); }

    /// ExprKind::Binary
    fn expr_binary() {
        let (a, b, c, d, x, y);
        true || false;
        true || false && false;
        a < 1 && 2 < b && c > 3 && 4 > d;
        a & b & !c;
        a + b * c - d + -1 * -2 - -3;
        x = !y;
    }

    /// ExprKind::Unary
    fn expr_unary() { let expr; *expr; !expr; -expr; }

    /// ExprKind::Lit
    fn expr_lit() { 'x'; 1000i8; 1.00000000000000000000001; }

    /// ExprKind::Cast
    fn expr_cast() { let expr; expr as T; expr as T<u8>; }

    /// ExprKind::Type
    fn expr_type() { let expr; type_ascribe!(expr, T); }

    /// ExprKind::Let
    fn expr_let() {
        let b;
        if let Some(a) = b { }
        if let _ = true && false { }
        if let _ = (true && false) { }
    }

    /// ExprKind::If
    fn expr_if() {
        if true { }
        if !true { }
        if let true = true { } else { }
        if true { } else if false { }
        if true { } else if false { } else { }
        if true { return; } else if false { 0 } else { 0 }
    }

    /// ExprKind::While
    fn expr_while() {
        loop { if false { } else { break; } }
        'a: loop { if false { } else { break; } }
        loop { if let true = true { } else { break; } }
    }

    /// ExprKind::ForLoop
    fn expr_for_loop() {
        let x;
        {
            let _t =
                match into_iter(x) {
                    mut iter =>
                        loop {
                            match next(&mut iter) {
                                None {} => break,
                                Some {  0: _ } => { }
                            }
                        },
                };
            _t
        };
        {
            let _t =
                match into_iter(x) {
                    mut iter =>
                        'a: loop {
                            match next(&mut iter) {
                                None {} => break,
                                Some {  0: _ } => { }
                            }
                        },
                };
            _t
        }
    }

    /// ExprKind::Loop
    fn expr_loop() { loop { } 'a: loop { } }

    /// ExprKind::Match
    fn expr_match() {
        let value;
        match value { }
        match value { ok => 1, }
        match value { ok => 1, err => 0, }
    }

    /// ExprKind::Closure
    fn expr_closure() {
        let value;
        || { };
        |x| { };
        |x: u8| { };
        || ();
        move || value;
        || |mut _task_context: ResumeTy| { { let _t = value; _t } };
        move || |mut _task_context: ResumeTy| { { let _t = value; _t } };
        || value; //[hir]~ ERROR closures cannot be static
        move || value; //[hir]~ ERROR closures cannot be static
        || |mut _task_context: ResumeTy| { { let _t = value; _t } };
        move || |mut _task_context: ResumeTy| { { let _t = value; _t } };
        || -> u8 { value };
        1 + (|| { });
    }

    /// ExprKind::Block
    fn expr_block() {
        { }
        unsafe { }
        'a: { }
        #[allow()]
        { }
        #[allow()]
        { }
    }

    /// ExprKind::Gen
    fn expr_gen() {
        |mut _task_context: ResumeTy| { };
        move |mut _task_context: ResumeTy| { };
        || { };
        move || { };
        |mut _task_context: ResumeTy| { };
        move |mut _task_context: ResumeTy| { };
    }

    /// ExprKind::Await
    fn expr_await() {
        let fut;
        {
            fut; //[hir]~ ERROR `await` is only allowed
            (/*ERROR*/)
        };
    }

    /// ExprKind::TryBlock
    fn expr_try_block() {
        { from_output(()) }
        { return; from_output(()) }
        type_ascribe!({ from_output(()) }, Option<_>);
        type_ascribe!({
                from_output(match branch(None) {
                        Break {  0: residual } => #[allow(unreachable_code)]
                            break from_residual(residual),
                        Continue {  0: val } => #[allow(unreachable_code)]
                            val,
                    })
            }, Option<String>)
    }

    /// ExprKind::Assign
    fn expr_assign() { let expr; expr = true; }

    /// ExprKind::AssignOp
    fn expr_assign_op() { let expr; expr += true; }

    /// ExprKind::Field
    fn expr_field() { let expr; expr.field; expr.0; }

    /// ExprKind::Index
    fn expr_index() { let expr; expr[true]; }

    /// ExprKind::Range
    fn expr_range() {
        let (lo, hi);
        RangeFull {  };
        RangeTo { end: hi };
        RangeFrom { start: lo };
        Range { start: lo, end: hi };
        Range { start: lo, end: hi };
        RangeToInclusive { end: hi };
        range_inclusive_new(lo, hi);
        range_inclusive_new(-2, -1);
    }

    /// ExprKind::Underscore
    fn expr_underscore() {
        (/*ERROR*/); //[hir]~ ERROR in expressions, `_` can only
    }

    /// ExprKind::Path
    fn expr_path() {
        let x;
        crate::expressions::expr_path;
        crate::expressions::expr_path::<'static>;
        <T as Default>::default;
        <T as ::core::default::Default>::default;
        x; //[hir]~ ERROR parenthesized type parameters
        x::<T, T>; //[hir]~ ERROR parenthesized type parameters
        crate::expressions::expr_path;
        //[hir]~^ ERROR parenthesized type parameters
        //[hir]~| ERROR parenthesized type parameters
        core::marker::PhantomData;
        //[hir]~^ ERROR parenthesized type parameters
        //[hir]~| ERROR parenthesized type parameters
    }

    /// ExprKind::AddrOf
    fn expr_addr_of() {
        let expr;
        &expr;
        &mut expr;
        &raw const expr;
        &raw mut expr;
    }

    /// ExprKind::Break
    fn expr_break() { 'a: { break; break 'a; break true; break 'a true; } }

    /// ExprKind::Continue
    fn expr_continue() { 'a: { continue; continue 'a; } }

    /// ExprKind::Ret
    fn expr_ret() { return; return true; }


---




        //[hir]~ ERROR `yield` can only be used





---


        // ...

        //[hir]~ ERROR invalid ABI





---




        //[hir]~ ERROR `..` patterns are not allowed here





---




        //[hir]~ ERROR parenthesized type parameters


        //[hir]~ ERROR `impl Trait` is not allowed
        //[hir]~ ERROR `impl Trait` is not allowed
        //[hir]~ ERROR `impl Trait` is not allowed
        //[hir]~ ERROR `impl Trait` is not allowed
        //[hir]~ ERROR `impl Trait` is not allowed
        //[hir]~ ERROR `impl Trait` is not allowed









        const { offset_of!(T, field) };
    }
    /// ExprKind::MacCall
    fn expr_mac_call() { "..."; "..."; "..."; }
    /// ExprKind::Struct
    fn expr_struct() {
        struct Struct {
        }
        let (x, base);
        Struct {  };
        <Struct as ToOwned>::Owned {  };
        Struct { .. };
        Struct { ..base };
        Struct { x };
        Struct { x, ..base };
        Struct { x: true };
        Struct { x: true, .. };
        Struct { x: true, ..base };
        Struct { 0: true, ..base };
    }
    /// ExprKind::Repeat
    fn expr_repeat() { [(); 0]; }
    /// ExprKind::Paren
    fn expr_paren() { let expr; expr; }
    /// ExprKind::Try
    fn expr_try() {
        let expr;
        match branch(expr) {
            Break {  0: residual } => #[allow(unreachable_code)]
                return from_residual(residual),
            Continue {  0: val } => #[allow(unreachable_code)]
                val,
        };
    }
    /// ExprKind::Yield
    fn expr_yield() { yield (); yield true; }
    /// ExprKind::Yeet
    fn expr_yeet() { return from_yeet(()); return from_yeet(0); }
    /// ExprKind::Become
    fn expr_become() { become true; }
    /// ExprKind::IncludedBytes
    fn expr_include_bytes() {
        b"data for include_bytes in ../expanded-exhaustive.rs\n";
    }
    /// ExprKind::FormatArgs
    fn expr_format_args() {
        let expr;
        format_arguments::from_str("");
        {
            super let args = (&expr,);
            super let args = [format_argument::new_display_simple(args.0)];
            unsafe { format_arguments::new(b"\xc0\x00", &args) }
        };
    }
}
mod items {
    /// ItemKind::ExternCrate
    mod item_extern_crate {
        extern crate core;
        extern crate self as unpretty;
        extern crate core as _;
    }
    /// ItemKind::Use
    mod item_use {
        use ::{};
        use crate::expressions;
        use crate::items::item_use;
        use core::*;
    }
    /// ItemKind::Static
    mod item_static {
        static A: () = { };
        static mut B: () = { };
    }
    /// ItemKind::Const
    mod item_const {
        const A: () = { };
        trait TraitItems {
            const
            B:
            ();
            const
            C:
---
    mod item_fn {
        const unsafe extern "C" fn f() { }
        async unsafe extern "C" fn g()
            ->
                /*impl Trait*/ |mut _task_context: ResumeTy|
            { { let _t = { }; _t } }
        fn h<'a, T>() where T: 'a { }
        trait TraitItems {
            unsafe extern "C" fn f();
        }
        impl TraitItems for _ {
            unsafe extern "C" fn f() { }
        }
    }
    /// ItemKind::Mod
    mod item_mod { }
    /// ItemKind::ForeignMod
    mod item_foreign_mod {
        extern "Rust" { }
        extern "C" { }
    }
    /// ItemKind::GlobalAsm: see exhaustive-asm.rs
    /// ItemKind::TyAlias
    mod item_ty_alias {
        type Type<'a> where T: 'a = T;
    }
    /// ItemKind::Enum
    mod item_enum {
        enum Void { }
        enum Empty {
            Unit,
            Tuple(),
            Struct {
                },
        }
        enum Generic<'a, T> where T: 'a {
            Tuple(T),
            Struct {
                    t: T,
                },
        }
    }
    /// ItemKind::Struct
    mod item_struct {
        struct Unit;
        struct Tuple();
        struct Newtype(Unit);
        struct Struct {
        }
        struct Generic<'a, T> where T: 'a {
            t: T,
        }
    }
    /// ItemKind::Union
    mod item_union {
        union Generic<'a, T> where T: 'a {
            t: T,
        }
    }
    /// ItemKind::Trait
    mod item_trait {
        auto unsafe trait Send { }
        trait Trait<'a>: Sized where Self: 'a { }
    }
    /// ItemKind::TraitAlias
    mod item_trait_alias {
        trait Trait<T> = Sized where for<'a> T: 'a;
    }
    /// ItemKind::Impl
    mod item_impl {
        impl () { }
        impl <T> () { }
        impl Default for () { }
        impl <T> const Default for () { }
    }
    /// ItemKind::MacCall
    mod item_mac_call { }
    /// ItemKind::MacroDef
    mod item_macro_def {
        macro_rules! mac { () => {...}; }
        macro stringify { () => {} }
    }
    /// ItemKind::Delegation
    /** FIXME: todo */
    mod item_delegation { }
    /// ItemKind::DelegationMac
    /** FIXME: todo */
    mod item_delegation_mac { }
}
mod patterns {
    /// PatKind::Missing
    fn pat_missing() { let _: for fn(u32, T, &'_ str); }
    /// PatKind::Wild
    fn pat_wild() { let _; }
    /// PatKind::Ident
    fn pat_ident() {
        let x;
        let ref x;
        let mut x;
        let ref mut x;
        let ref mut x@_;
    }
    /// PatKind::Struct
    fn pat_struct() {
        let T {};
        let T::<T> {};
        let T::<'static> {};
        let T {  x };
        let T {  x: _x };
        let T { .. };
        let T {  x, .. };
        let T {  x: _x, .. };
        let T {  0: _x, .. };
        let <T as ToOwned>::Owned {};
    }
    /// PatKind::TupleStruct
    fn pat_tuple_struct() {
        struct Tuple();
        let Tuple();
        let Tuple::<T>();
        let Tuple::<'static>();
        let Tuple(x);
        let Tuple(..);
        let Tuple(x, ..);
    }
    /// PatKind::Or
    fn pat_or() { let true | false; let true; let true | false; }
    /// PatKind::Path
    fn pat_path() {
        let core::marker::PhantomData;
        let core::marker::PhantomData::<T>;
        let core::marker::PhantomData::<'static>;
        let <T as Trait>::CONST;
    }
    /// PatKind::Tuple
    fn pat_tuple() { let (); let (true,); let (true, false); }
    /// PatKind::Box
    fn pat_box() { let box pat; }
    /// PatKind::Deref
    fn pat_deref() { let deref!(pat); }
    /// PatKind::Ref
    fn pat_ref() { let &pat; let &mut pat; }
    /// PatKind::Expr
    fn pat_expr() { let 1000i8; let -""; }
    /// PatKind::Range
    fn pat_range() { let ..1; let 0...; let 0..1; let 0...1; let -2...-1; }
    /// PatKind::Slice
    fn pat_slice() { let []; let [true]; let [true]; let [true, false]; }
    /// PatKind::Rest
    fn pat_rest() { let _; }
    /// PatKind::Never
    fn pat_never() { let !; let Some(!); }
    /// PatKind::Paren
    fn pat_paren() { let pat; }
    /// PatKind::MacCall
    fn pat_mac_call() { let ""; let ""; let ""; }
}
mod statements {
    /// StmtKind::Let
    fn stmt_let() {
        let _;
        let _ = true;
        let _: T = true;
        let _ = true else { return; };
    }
    /// StmtKind::Item
    fn stmt_item() {
        struct Struct {
        }
        struct Unit;
    }
    /// StmtKind::Expr
    fn stmt_expr() { () }
    /// StmtKind::Semi
    fn stmt_semi() { 1 + 1; }
    /// StmtKind::Empty
    fn stmt_empty() { }
    /// StmtKind::MacCall
    fn stmt_mac_call() { "..."; "..."; "..."; }
}
mod types {
    /// TyKind::Slice
    fn ty_slice() { let _: [T]; }
    /// TyKind::Array
    fn ty_array() { let _: [T; 0]; }
    /// TyKind::Ptr
    fn ty_ptr() { let _: *const T; let _: *mut T; }
    /// TyKind::Ref
    fn ty_ref() {
        let _: &T;
        let _: &mut T;
        let _: &'static T;
        let _: &'static mut [T];
        let _: &T<T<T<T<T>>>>;
        let _: &T<T<T<T<T>>>>;
    }
    /// TyKind::BareFn
    fn ty_bare_fn() {
        let _: fn();
        let _: fn() -> ();
        let _: fn(T);
        let _: fn(t: T);
        let _: fn();
        let _: for<'a> fn();
    }
    /// TyKind::Never
    fn ty_never() { let _: !; }
    /// TyKind::Tup
    fn ty_tup() { let _: (); let _: (T,); let _: (T, T); }
    /// TyKind::Path
    fn ty_path() {
        let _: T;
        let _: T<'static>;
        let _: T<T>;
        let _: T<T>;
        let _: T;
        let _: <T as ToOwned>::Owned;
    }
    /// TyKind::TraitObject
    fn ty_trait_object() {
        let _: dyn Send;
        let _: dyn Send + 'static;
        let _: dyn Send + 'static;
        let _: dyn for<'a> Send;
    }
    /// TyKind::ImplTrait
    const fn ty_impl_trait() {
        let _: (/*ERROR*/);
        let _: (/*ERROR*/);
        let _: (/*ERROR*/);
        let _: (/*ERROR*/);
        let _: (/*ERROR*/);
        let _: (/*ERROR*/);
    }
    /// TyKind::Paren
    fn ty_paren() { let _: T; }
    /// TyKind::Typeof
    /** unused for now */
    fn ty_typeof() { }
    /// TyKind::Infer
    fn ty_infer() { let _: _; }
    /// TyKind::ImplicitSelf
    /** there is no syntax for this */
    fn ty_implicit_self() { }
    /// TyKind::MacCall
    fn ty_mac_call() {
        macro_rules! ty { ($ty:ty) => { $ty } }
        let _: T;
        let _: T;
        let _: T;
    }
    /// TyKind::CVarArgs
    /** FIXME: todo */
    fn ty_c_var_args() { }
    /// TyKind::Pat
    fn ty_pat() { let _: u32 is 1..=RangeMax; }
}
mod visibilities {
    /// VisibilityKind::Public
    mod visibility_public {
        struct Pub;
    }
    /// VisibilityKind::Restricted
    mod visibility_restricted {
        struct PubCrate;
        struct PubSelf;
        struct PubSuper;
        struct PubInCrate;
        struct PubInSelf;
        struct PubInSuper;
        struct PubInCrateVisibilities;
        struct PubInSelfSuper;
        struct PubInSuperMod;
    }
}
------------------------------------------
--- stderr -------------------------------
error[E0697]: closures cannot be static
##[error]  --> /checkout/tests/ui/unpretty/exhaustive.rs:211:9
   |
LL |         static || value;            //[hir]~ ERROR closures cannot be static
   |         ^^^^^^^^^

error[E0697]: closures cannot be static
##[error]  --> /checkout/tests/ui/unpretty/exhaustive.rs:212:9
   |
LL |         static move || value;       //[hir]~ ERROR closures cannot be static
   |         ^^^^^^^^^^^^^^

error[E0728]: `await` is only allowed inside `async` functions and blocks
##[error]  --> /checkout/tests/ui/unpretty/exhaustive.rs:241:13
   |
LL |     fn expr_await() {
   |     --------------- this is not `async`
LL |         let fut;
LL |         fut.await;  //[hir]~ ERROR `await` is only allowed
   |             ^^^^^ only allowed inside `async` functions and blocks

error: in expressions, `_` can only be used on the left-hand side of an assignment
##[error]  --> /checkout/tests/ui/unpretty/exhaustive.rs:292:9
   |
LL |         _;      //[hir]~ ERROR in expressions, `_` can only
   |         ^ `_` not allowed here

error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
##[error]  --> /checkout/tests/ui/unpretty/exhaustive.rs:302:9
   |
LL |         x::();            //[hir]~ ERROR parenthesized type parameters
   |         ^^^^^ only `Fn` traits may use parentheses

error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
##[error]  --> /checkout/tests/ui/unpretty/exhaustive.rs:303:9
   |
LL |         x::(T, T) -> T;   //[hir]~ ERROR parenthesized type parameters
   |         ^^^^^^^^^^^^^^ only `Fn` traits may use parentheses
   |
help: use angle brackets instead
   |
LL -         x::(T, T) -> T;   //[hir]~ ERROR parenthesized type parameters
LL +         x::<T, T> -> T;   //[hir]~ ERROR parenthesized type parameters
   |

error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
##[error]  --> /checkout/tests/ui/unpretty/exhaustive.rs:304:9
   |
LL |         crate::() -> ()::expressions::() -> ()::expr_path;
   |         ^^^^^^^^^^^^^^^ only `Fn` traits may use parentheses

error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
##[error]  --> /checkout/tests/ui/unpretty/exhaustive.rs:304:26
   |
LL |         crate::() -> ()::expressions::() -> ()::expr_path;
   |                          ^^^^^^^^^^^^^^^^^^^^^ only `Fn` traits may use parentheses

error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
##[error]  --> /checkout/tests/ui/unpretty/exhaustive.rs:307:9
   |
LL |         core::()::marker::()::PhantomData;
   |         ^^^^^^^^ only `Fn` traits may use parentheses

error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
##[error]  --> /checkout/tests/ui/unpretty/exhaustive.rs:307:19
   |
LL |         core::()::marker::()::PhantomData;
   |                   ^^^^^^^^^^ only `Fn` traits may use parentheses

error: `yield` can only be used in `#[coroutine]` closures, or `gen` blocks
##[error]  --> /checkout/tests/ui/unpretty/exhaustive.rs:394:9
   |
LL |         yield;          //[hir]~ ERROR `yield` can only be used
   |         ^^^^^
   |
help: use `#[coroutine]` to make this closure a coroutine
   |
LL |     #[coroutine] fn expr_yield() {
   |     ++++++++++++

error[E0703]: invalid ABI: found `C++`
##[error]  --> /checkout/tests/ui/unpretty/exhaustive.rs:474:23
   |
LL |         unsafe extern "C++" {}  //[hir]~ ERROR invalid ABI
   |                       ^^^^^ invalid ABI
   |
   = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions

error: `..` patterns are not allowed here
##[error]  --> /checkout/tests/ui/unpretty/exhaustive.rs:681:13
   |
LL |         let ..;     //[hir]~ ERROR `..` patterns are not allowed here
   |             ^^
   |
   = note: only allowed in tuple, tuple struct, and slice patterns

error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
##[error]  --> /checkout/tests/ui/unpretty/exhaustive.rs:796:16
   |
LL |         let _: T() -> !;    //[hir]~ ERROR parenthesized type parameters
   |                ^^^^^^^^ only `Fn` traits may use parentheses

error[E0562]: `impl Trait` is not allowed in the type of variable bindings
##[error]  --> /checkout/tests/ui/unpretty/exhaustive.rs:810:16
   |
LL |         let _: impl Send;               //[hir]~ ERROR `impl Trait` is not allowed
   |                ^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods
   = note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
   = help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0562]: `impl Trait` is not allowed in the type of variable bindings
##[error]  --> /checkout/tests/ui/unpretty/exhaustive.rs:811:16
   |
LL |         let _: impl Send + 'static;     //[hir]~ ERROR `impl Trait` is not allowed
   |                ^^^^^^^^^^^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods
   = note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
   = help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0562]: `impl Trait` is not allowed in the type of variable bindings
##[error]  --> /checkout/tests/ui/unpretty/exhaustive.rs:812:16
   |
LL |         let _: impl 'static + Send;     //[hir]~ ERROR `impl Trait` is not allowed
   |                ^^^^^^^^^^^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods
   = note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
   = help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0562]: `impl Trait` is not allowed in the type of variable bindings
##[error]  --> /checkout/tests/ui/unpretty/exhaustive.rs:813:16
   |
LL |         let _: impl ?Sized;             //[hir]~ ERROR `impl Trait` is not allowed
   |                ^^^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods
   = note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
   = help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0562]: `impl Trait` is not allowed in the type of variable bindings
##[error]  --> /checkout/tests/ui/unpretty/exhaustive.rs:814:16
   |
LL |         let _: impl [const] Clone;       //[hir]~ ERROR `impl Trait` is not allowed
   |                ^^^^^^^^^^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods
   = note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
   = help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0562]: `impl Trait` is not allowed in the type of variable bindings
##[error]  --> /checkout/tests/ui/unpretty/exhaustive.rs:815:16
   |
LL |         let _: impl for<'a> Send;       //[hir]~ ERROR `impl Trait` is not allowed
   |                ^^^^^^^^^^^^^^^^^
   |
   = note: `impl Trait` is only allowed in arguments and return types of functions and methods
   = note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
   = help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error: aborting due to 20 previous errors

Some errors have detailed explanations: E0214, E0562, E0697, E0703, E0728.
For more information about an error, try `rustc --explain E0214`.

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 8, 2026

☀️ Try build successful (CI)
Build commit: 7150f8e (7150f8e7f0f11ff3adc96343e898332aba09d310, parent: be4794c78beca8a88f0a1ee583f3d4b5c321e5d8)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (7150f8e): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.6% [0.1%, 2.4%] 44
Regressions ❌
(secondary)
1.6% [0.2%, 19.8%] 31
Improvements ✅
(primary)
-1.3% [-1.7%, -0.9%] 2
Improvements ✅
(secondary)
-1.7% [-1.7%, -1.7%] 1
All ❌✅ (primary) 0.5% [-1.7%, 2.4%] 46

Max RSS (memory usage)

Results (primary 3.9%, secondary -3.7%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
3.9% [0.8%, 8.7%] 5
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.7% [-5.2%, -2.0%] 3
All ❌✅ (primary) 3.9% [0.8%, 8.7%] 5

Cycles

Results (primary 2.3%, secondary 5.3%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
2.3% [1.7%, 2.8%] 5
Regressions ❌
(secondary)
6.8% [2.4%, 22.2%] 6
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.4% [-3.4%, -3.4%] 1
All ❌✅ (primary) 2.3% [1.7%, 2.8%] 5

Binary size

Results (primary 0.7%, secondary 1.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
0.7% [0.0%, 2.4%] 112
Regressions ❌
(secondary)
1.2% [0.0%, 12.2%] 115
Improvements ✅
(primary)
-0.8% [-0.8%, -0.8%] 1
Improvements ✅
(secondary)
-0.8% [-0.8%, -0.8%] 1
All ❌✅ (primary) 0.7% [-0.8%, 2.4%] 113

Bootstrap: 474.258s -> 478.767s (0.95%)
Artifact size: 397.98 MiB -> 399.40 MiB (0.36%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Feb 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

perf-regression Performance regression. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants