]> git.ipfire.org Git - thirdparty/gcc.git/commit
rust: Silence a clang warning in borrow-checker-diagnostics
authorMartin Jambor <mjambor@suse.cz>
Mon, 23 Jun 2025 21:52:20 +0000 (23:52 +0200)
committerMartin Jambor <jamborm@gcc.gnu.org>
Thu, 26 Jun 2025 14:35:52 +0000 (16:35 +0200)
commit1e69c5655894ab3cbeb4431a5b3daff211d3c4e1
treedc4792bae4a3e480af7e049a534a4c0e9ba9aca4
parent4b3cefed1a08344495fedec4982d85168bd8173f
rust: Silence a clang warning in borrow-checker-diagnostics

When compiling
gcc/rust/checks/errors/borrowck/rust-borrow-checker-diagnostics.cc
with clang, it emits the following warning:

  gcc/rust/checks/errors/borrowck/rust-borrow-checker-diagnostics.cc:145:46: warning: non-constant-expression cannot be narrowed from type 'Polonius::Loan' (aka 'unsigned long') to 'uint32_t' (aka 'unsigned int') in initializer list [-Wc++11-narrowing]

I'd hope that for indexing that is never really a problem,
nevertheless if narrowing is taking place, I guess it can be argued it
should be made explicit.

gcc/rust/ChangeLog:

2025-06-23  Martin Jambor  <mjambor@suse.cz>

* checks/errors/borrowck/rust-borrow-checker-diagnostics.cc
(BorrowCheckerDiagnostics::get_loan): Type cast loan to uint32_t.
gcc/rust/checks/errors/borrowck/rust-borrow-checker-diagnostics.cc