From: Marc Poulhiès Date: Thu, 3 Jul 2025 21:29:48 +0000 (+0200) Subject: gccrs: Fix narrowing of Loan (size_t) into LoanId (uint32) X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a887f69e96b7507173771526e20715c31c8f844f;p=thirdparty%2Fgcc.git gccrs: Fix narrowing of Loan (size_t) into LoanId (uint32) 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 --- 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)); }