]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Fix narrowing of Loan (size_t) into LoanId (uint32)
authorMarc Poulhiès <dkm@kataplop.net>
Thu, 3 Jul 2025 21:29:48 +0000 (23:29 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 5 Aug 2025 14:36:54 +0000 (16:36 +0200)
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 <dkm@kataplop.net>
gcc/rust/checks/errors/borrowck/rust-bir-place.h

index 14f1dd660b0e68d8e18cce865b444411d4bccafd..c4631c7b2f16e47fb5c9f2bedd86479935b4d2d8 100644 (file)
@@ -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)); }