(
cx: &CodegenCx<'tcx>,
const_: Const<'tcx>,
)
| 859 | // type_from_variant_discriminant(cx, substs.const_at(6)); |
| 860 | |
| 861 | fn const_int_value<'tcx, P: FromPrimitive>( |
| 862 | cx: &CodegenCx<'tcx>, |
| 863 | const_: Const<'tcx>, |
| 864 | ) -> Result<P, ErrorGuaranteed> { |
| 865 | assert!(const_.ty().is_integral()); |
| 866 | let value = const_.eval_bits(cx.tcx, ParamEnv::reveal_all(), const_.ty()); |
| 867 | match P::from_u128(value) { |
| 868 | Some(v) => Ok(v), |
| 869 | None => Err(cx |
| 870 | .tcx |
| 871 | .sess |
| 872 | .err(format!("Invalid value for Image const generic: {value}"))), |
| 873 | } |
| 874 | } |
| 875 | |
| 876 | let dim = const_int_value(cx, substs.const_at(1))?; |
| 877 | let depth = const_int_value(cx, substs.const_at(2))?; |
no test coverage detected