You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We currently use type aliases, but that doesn't really add any type safety. Group ids, process ids and user ids can freely be interchanged because their definitions in libc are the same. If we use newtype wrappers (i.e. struct UserId(libc::uid_t) instead of type UserId = libc::uid_t), we can actually make a few more ensurances that they come from the right source. We should make construction of these newtypes very much explicit because of that (i.e. no From). That should prevent accidental conversion into one of the newtype definitions where it was not meant.
The text was updated successfully, but these errors were encountered:
About lazy_static; can't we achieve the same thing with the now-standard "once cell" features? rust-lang-nursery/lazy-static.rs#214 (I recall once having used it to provide backwards compatibility to rustc 1.65 during early sudo-rs development).
Our MSRV is currently 1.70 (and I think we can easily be persuaded to up it as far as 1.75), so once_cell is available.
We currently use type aliases, but that doesn't really add any type safety. Group ids, process ids and user ids can freely be interchanged because their definitions in libc are the same. If we use newtype wrappers (i.e.
struct UserId(libc::uid_t)
instead oftype UserId = libc::uid_t
), we can actually make a few more ensurances that they come from the right source. We should make construction of these newtypes very much explicit because of that (i.e. noFrom
). That should prevent accidental conversion into one of the newtype definitions where it was not meant.The text was updated successfully, but these errors were encountered: