nak/nouveau: silence errors about never used methods

When building nvk for Android the rust compiler emits the following
errors:

-----------------------------------------------------------------------
error: methods `get_pred_src`, `get_u32_bnot_src`, `get_carry_src`, `set_pred_dst`, and `set_carry_dst` are never used
    --> ../src/nouveau/compiler/nak/ir.rs:1371:12
     |
1370 | impl OpFoldData<'_> {
     | ------------------- methods in this implementation
1371 |     pub fn get_pred_src(&self, op: &impl SrcsAsSlice, src: &Src) -> bool {
     |            ^^^^^^^^^^^^
...
1404 |     pub fn get_u32_bnot_src(&self, op: &impl SrcsAsSlice, src: &Src) -> u32 {
     |            ^^^^^^^^^^^^^^^^
...
1413 |     pub fn get_carry_src(&self, op: &impl SrcsAsSlice, src: &Src) -> bool {
     |            ^^^^^^^^^^^^^
...
1446 |     pub fn set_pred_dst(&mut self, op: &impl DstsAsSlice, dst: &Dst, b: bool) {
     |            ^^^^^^^^^^^^
...
1450 |     pub fn set_carry_dst(&mut self, op: &impl DstsAsSlice, dst: &Dst, b: bool) {
     |            ^^^^^^^^^^^^^
     |
     = note: `-D dead-code` implied by `-D warnings`
     = help: to override `-D warnings` add `#[allow(dead_code)]`

error: method `eval` is never used
    --> ../src/nouveau/compiler/nak/ir.rs:1523:12
     |
1522 | impl PredSetOp {
     | -------------- method in this implementation
1523 |     pub fn eval(&self, a: bool, b: bool) -> bool {
     |            ^^^^

error: method `to_mask` is never used
    --> ../src/nouveau/compiler/nak/ir.rs:5625:12
     |
5614 | impl SuClampRound {
     | ----------------- method in this implementation
...
5625 |     pub fn to_mask(&self) -> u32 {
     |            ^^^^^^^

error: method `cast` is never used
    --> ../src/nouveau/compiler/nak/ir.rs:6041:8
     |
6006 | impl IMadSpSrcType {
     | ------------------ method in this implementation
...
6041 |     fn cast(&self, v: u32) -> i64 {
     |        ^^^^
-----------------------------------------------------------------------

Add `#[allow(dead_code)]` to silence the errors, as suggested by the
compiler.

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Mel Henning <mhenning@darkrefraction.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36849>
This commit is contained in:
Antonio Ospite 2025-08-11 11:39:16 +02:00 committed by Marge Bot
parent a3b4a26d58
commit 5c019bdee5

View file

@ -1404,6 +1404,7 @@ pub struct OpFoldData<'a> {
}
impl OpFoldData<'_> {
#[allow(dead_code)]
pub fn get_pred_src(&self, op: &impl SrcsAsSlice, src: &Src) -> bool {
let i = op.src_idx(src);
let b = match src.src_ref {
@ -1437,6 +1438,7 @@ impl OpFoldData<'_> {
}
}
#[allow(dead_code)]
pub fn get_u32_bnot_src(&self, op: &impl SrcsAsSlice, src: &Src) -> u32 {
let x = self.get_u32_src(op, src);
if src.src_mod.is_bnot() {
@ -1446,6 +1448,7 @@ impl OpFoldData<'_> {
}
}
#[allow(dead_code)]
pub fn get_carry_src(&self, op: &impl SrcsAsSlice, src: &Src) -> bool {
assert!(src.src_ref.as_ssa().is_some());
let i = op.src_idx(src);
@ -1479,10 +1482,12 @@ impl OpFoldData<'_> {
}
}
#[allow(dead_code)]
pub fn set_pred_dst(&mut self, op: &impl DstsAsSlice, dst: &Dst, b: bool) {
self.dsts[op.dst_idx(dst)] = FoldData::Pred(b);
}
#[allow(dead_code)]
pub fn set_carry_dst(&mut self, op: &impl DstsAsSlice, dst: &Dst, b: bool) {
self.dsts[op.dst_idx(dst)] = FoldData::Carry(b);
}
@ -1556,6 +1561,7 @@ pub enum PredSetOp {
}
impl PredSetOp {
#[allow(dead_code)]
pub fn eval(&self, a: bool, b: bool) -> bool {
match self {
PredSetOp::And => a & b,
@ -5658,6 +5664,7 @@ impl SuClampRound {
}
}
#[allow(dead_code)]
pub fn to_mask(&self) -> u32 {
!(self.to_int() as u32 - 1)
}
@ -6074,6 +6081,7 @@ impl IMadSpSrcType {
}
}
#[allow(dead_code)]
fn cast(&self, v: u32) -> i64 {
use IMadSpSrcType::*;
match self {