From a887f69e96b7507173771526e20715c31c8f844f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marc=20Poulhi=C3=A8s?= Date: Thu, 3 Jul 2025 23:29:48 +0200 Subject: [PATCH] gccrs: Fix narrowing of Loan (size_t) into LoanId (uint32) MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Fix narrowing: -../../gcc/rust/checks/errors/borrowck/rust-borrow-checker-diagnostics.cc:145:46: warning: narrowing conversion of ‘loan’ from ‘Rust::Polonius::Loan’ {aka ‘long unsigned int’} to ‘uint32_t’ {aka ‘unsigned int’} [-Wnarrowing] gcc/rust/ChangeLog: * checks/errors/borrowck/rust-bir-place.h (LoanId::value): Make it size_t to match Loan's base type. Signed-off-by: Marc Poulhiès --- gcc/rust/checks/errors/borrowck/rust-bir-place.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/rust/checks/errors/borrowck/rust-bir-place.h b/gcc/rust/checks/errors/borrowck/rust-bir-place.h index 14f1dd660b0..c4631c7b2f1 100644 --- a/gcc/rust/checks/errors/borrowck/rust-bir-place.h +++ b/gcc/rust/checks/errors/borrowck/rust-bir-place.h @@ -53,7 +53,7 @@ using Variance = TyTy::VarianceAnalysis::Variance; /** A unique identifier for a loan in the BIR. */ struct LoanId { - uint32_t value; + size_t value; // some overloads for comparision bool operator== (const LoanId &rhs) const { return value == rhs.value; } bool operator!= (const LoanId &rhs) const { return !(operator== (rhs)); } -- 2.47.2