Change to `Ord::clamp` causes build errors by calling through upstream monomorphisations
Following rust-lang/rust#147754, chromium encounters the following build error:
```
error: `compiler_builtins` cannot call functions through upstream monomorphizations; encountered invalid call from `core::fmt::num::<impl core::fmt::Debug for i32>::fmt` to `core::fmt::num::imp::<impl core::fmt::Display for i32>::fmt`
--> ./../../third_party/rust-toolchain/lib/rustlib/src/rust/library/core/src/fmt/num.rs:79:0
::: ./../../third_party/rust-toolchain/lib/rustlib/src/rust/library/core/src/fmt/num.rs:97:1
|
= note: in this expansion of `impl_Debug!`
::: ./../../third_party/rust-toolchain/lib/rustlib/src/rust/library/core/src/fmt/num.rs:592:1
|
= note: in this macro invocation
```
The `clamp()` function is called twice in `libm/src/math/genric/scalbn.rs` (at lines [99](https://github.com/rust-lang/compiler-builtins/blob/fe052cc8b6e6eba8a9f5a034c5ad5e86375d4f6f/libm/src/math/generic/scalbn.rs#L99) and [106](https://github.com/rust-lang/compiler-builtins/blob/fe052cc8b6e6eba8a9f5a034c5ad5e86375d4f6f/libm/src/math/generic/scalbn.rs#L106)). I think the easiest fix would be to replace these calls with a locally defined `clamp()` that doesn't call `Debug::fmt`.
关闭于 2025-12-17 1 条评论