Danilo Krummrich
2025-Oct-27 19:23 UTC
[PATCH v2 5/7] gpu: nova-core: add extra integer conversion functions and traits
On 10/27/25 8:09 PM, Joel Fernandes wrote:> Why not just implement `From` and `Into` for the types missing it then, with > adequate comments about why such conversions are Ok for the kernel, instead of > introducing a new trait? This is exactly what `From`/`Into` is for right?https://doc.rust-lang.org/reference/items/implementations.html#r-items.impl.trait.orphan-rule.intro
Danilo Krummrich
2025-Oct-27 19:28 UTC
[PATCH v2 5/7] gpu: nova-core: add extra integer conversion functions and traits
On 10/27/25 8:23 PM, Danilo Krummrich wrote:> On 10/27/25 8:09 PM, Joel Fernandes wrote: >> Why not just implement `From` and `Into` for the types missing it then, with >> adequate comments about why such conversions are Ok for the kernel, instead of >> introducing a new trait? This is exactly what `From`/`Into` is for right? > > https://doc.rust-lang.org/reference/items/implementations.html#r-items.impl.trait.orphan-rule.intro(Sorry, I didn't mean to send the link without additional comment.) We can't do this due to the orphan rule, but even if we could I think a separate trait indicating the reason for the conversions to be valid is a good thing. - Danilo