Re: [PATCH v14 2/3] rust: leds: add Mode trait
Markus Probst <[email protected]>
| Newsgroups | dev.linux.lists.sashiko |
|---|---|
| Message-ID | <[email protected]> |
On Mon, 2026-04-27 at 21:30 +0000, [email protected] wrote: > Sashiko AI review found 1 potential issue(s): > - [Low] The implementation `impl private::Sealed for Normal {}` in `rust/kernel/led/normal.rs` will fail to compile because the `private` module is not in scope. > -- > > commit 0a077c143ea17884a2c82d921e01b9d926d2e29a > Author: Markus Probst <[email protected]> > > rust: leds: add Mode trait > > Add the led::Mode trait to allow for other types of led class devices > in led::LedOps. > > > diff --git a/rust/kernel/led/normal.rs b/rust/kernel/led/normal.rs > > index bd239f186c64..dda247145f25 100644 > > --- a/rust/kernel/led/normal.rs > > +++ b/rust/kernel/led/normal.rs > > @@ -6,11 +6,19 @@ > > > > use super::*; > > > > +/// The led mode for the `struct led_classdev`. Leds with this mode can only have a fixed color. > > +pub enum Normal {} > > + > > +impl Mode for Normal { > > + type Device<T: LedOps<Mode = Self>> = Device<T>; > > +} > > +impl private::Sealed for Normal {} > > Will this fail to compile? > > In Rust, glob imports like use super::*; only bring public items into scope. > Since mod private in rust/kernel/led.rs is a private module, it is not > imported into the child module led/normal.rs. > > Using the unqualified path private::Sealed will cause a compilation error > about an undeclared crate or module private. > > Will a similar compilation error happen in the subsequent commit for > MultiColor in multicolor.rs? It does compile.
signature.asc
(application/pgp-signature, 870 B)
-----BEGIN PGP SIGNATURE----- iQJPBAABCAA5FiEEgnQYxPSsWOdyMMRzNHYf+OetQ9IFAmnyFeUbFIAAAAAABAAO bWFudTIsMi41KzEuMTIsMiwyAAoJEDR2H/jnrUPSQ8EQALvAaTgS+8RcRQMSBrW5 z64gwM0cI28pVJhpCaRfCDuRGHVobQQS+1BvO7mUHXovTsitJfFtXhHJoGobYxlH n7DSFhdd3CCOFy3DQHb6pI507pnfMgKqR6j/vv9/ndN+j7nZDn3q2wDzlBIaV54P suXYk9llV0NWRHMXIdFjXmoMz5RWuwNwxsPJbg0a196IFu+Y0Exc7GLHq74oY82P bHQlKPkhMVIpyqdDf6T5AH0BpOIqp3JVm/keZJTyDg28VdcQNkJcWyJxTOeq1MrS udSpQEhdCv806GQoc5v8fuIMJoe2I6M4RStt5Ag8eje+Rn08bjZ2pF5KmxYHGA7g pfKFFt8JFa2aDpF/AT+3yAyA/PTziM9IycIm5NM5gZQy1w91K/sZAXBxuipyDdNT hcljx/rH8/FBD9zBNrMHEI4aSx5L0Ih0nwtaL3iScv0g3jujZx7tMEiJrbDmx8PK v0z/7GMFVjPfRsIs8gTT4RiVfOW9nnkh+FhBDqMHvj2yTdV+IKwYare7PSFrQqpF LIf9jlGGQYIglEgFqTyO8KBKjKey7/nDZ2XkMv8fLh4mhcpGwvzvjX0Oe/Iwwuss ig97n+R6HiJP5A6ElryYlsnN4IMiVnZ88z5ROprOIOZxWqCd6zuLXMhC56AiQ6c4 KVpK1YTFU3XRBDSh3hqUfdSI =8rUm -----END PGP SIGNATURE-----