From 9a5a11fb30fe79e781c72b96f39fef4a1a8a8a0b Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Thu, 27 Mar 2025 08:55:09 +0100 Subject: [PATCH] fix: Fix `format_args` lowering using wrong integer suffix --- crates/hir-def/src/expr_store/lower.rs | 3 ++- crates/hir-def/src/expr_store/tests.rs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/hir-def/src/expr_store/lower.rs b/crates/hir-def/src/expr_store/lower.rs index 86f31dcaf009..8059023f0bb8 100644 --- a/crates/hir-def/src/expr_store/lower.rs +++ b/crates/hir-def/src/expr_store/lower.rs @@ -2400,7 +2400,8 @@ impl ExprCollector<'_> { Some(FormatCount::Literal(n)) => { let args = self.alloc_expr_desugared(Expr::Literal(Literal::Uint( *n as u128, - Some(BuiltinUint::Usize), + // FIXME: Change this to Some(BuiltinUint::U16) once we drop support for toolchains < 1.88 + None, ))); let count_is = match LangItem::FormatCount.ty_rel_path( self.db, diff --git a/crates/hir-def/src/expr_store/tests.rs b/crates/hir-def/src/expr_store/tests.rs index a6fcfaa445e3..55b95eb87546 100644 --- a/crates/hir-def/src/expr_store/tests.rs +++ b/crates/hir-def/src/expr_store/tests.rs @@ -216,7 +216,7 @@ fn main() { 8u32, builtin#lang(Count::Implied), builtin#lang(Count::Is)( - 2usize, + 2, ), ), builtin#lang(Placeholder::new)( 1usize,