diff options
| author | Mara Bos <m-ou.se@m-ou.se> | 2025-08-26 14:45:16 +0200 |
|---|---|---|
| committer | Mara Bos <m-ou.se@m-ou.se> | 2025-08-26 14:46:11 +0200 |
| commit | 5fb947f650ef123ab91bb3456161f50f481adf9b (patch) | |
| tree | d5389019f091626081c906558e0b958f0fc755c0 | |
| parent | 4356e83c77cb28113411fb8e2219127f708095b5 (diff) | |
| download | rust-5fb947f650ef123ab91bb3456161f50f481adf9b.tar.gz rust-5fb947f650ef123ab91bb3456161f50f481adf9b.zip | |
Add test.
| -rw-r--r-- | library/coretests/tests/fmt/mod.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/library/coretests/tests/fmt/mod.rs b/library/coretests/tests/fmt/mod.rs index 16f116d2590..11de632fb70 100644 --- a/library/coretests/tests/fmt/mod.rs +++ b/library/coretests/tests/fmt/mod.rs @@ -12,6 +12,12 @@ fn test_lifetime() { let a = format_args!("hello {a} {a:?}"); assert_eq!(a.to_string(), "hello hello hello hello hello hello hello"); + // Check that temporaries as arguments are extended. + let b = format_args!("{}", String::new()); + let c = format_args!("{}{}", String::new(), String::new()); + assert_eq!(b.to_string(), ""); + assert_eq!(c.to_string(), ""); + // Without arguments, it should also work in consts. const A: std::fmt::Arguments<'static> = format_args!("hello"); assert_eq!(A.to_string(), "hello"); |
