From 9f7ad5ee77d88cd70a1ba95c6a888a36b26271e2 Mon Sep 17 00:00:00 2001 From: dianne Date: Sun, 28 Sep 2025 23:48:32 -0700 Subject: [PATCH] add a test for shortening `super let` binding lifetimes --- .../extended-super-let-bindings.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 tests/ui/lifetimes/lint-macro-extended-temporary-scopes/extended-super-let-bindings.rs diff --git a/tests/ui/lifetimes/lint-macro-extended-temporary-scopes/extended-super-let-bindings.rs b/tests/ui/lifetimes/lint-macro-extended-temporary-scopes/extended-super-let-bindings.rs new file mode 100644 index 000000000000..950d1a4eaaa9 --- /dev/null +++ b/tests/ui/lifetimes/lint-macro-extended-temporary-scopes/extended-super-let-bindings.rs @@ -0,0 +1,11 @@ +//! Some temporaries are implemented as local variables bound with `super let`. These can be +//! lifetime-extended, and as such are subject to shortening after #145838. +//@ edition: 2024 +//@ check-pass + +fn main() { + // The `()` argument to the inner `format_args!` is promoted, but the lifetimes of the internal + // `super let` temporaries in its expansion shorten, making this an error in Rust 1.92. + println!("{:?}{}", (), { format_args!("{:?}", ()) }); + // TODO: warn +}