diff options
author | Alan Somers <asomers@gmail.com> | 2021-07-24 14:43:02 -0600 |
---|---|---|
committer | Alan Somers <asomers@gmail.com> | 2021-07-24 14:44:11 -0600 |
commit | 358adafa279ff3e6898ed49f4a2140144f121e9c (patch) | |
tree | d58fefacd019389f5131ea6a3c11b502fdcee276 /src/sys/ptrace | |
parent | 7033d470d000a35236f157258c13dd50bc64725a (diff) | |
download | nix-358adafa279ff3e6898ed49f4a2140144f121e9c.zip |
Mark most C-derived enums as non_exhaustive
Since libc may add new variants at any time, Nix's consumers should not
use exhaustive match patterns.
Fixes #1182
Diffstat (limited to 'src/sys/ptrace')
-rw-r--r-- | src/sys/ptrace/bsd.rs | 1 | ||||
-rw-r--r-- | src/sys/ptrace/linux.rs | 2 |
2 files changed, 3 insertions, 0 deletions
diff --git a/src/sys/ptrace/bsd.rs b/src/sys/ptrace/bsd.rs index 141dfbc4..a62881ef 100644 --- a/src/sys/ptrace/bsd.rs +++ b/src/sys/ptrace/bsd.rs @@ -24,6 +24,7 @@ cfg_if! { libc_enum! { #[repr(i32)] /// Ptrace Request enum defining the action to be taken. + #[non_exhaustive] pub enum Request { PT_TRACE_ME, PT_READ_I, diff --git a/src/sys/ptrace/linux.rs b/src/sys/ptrace/linux.rs index 4ac43936..74a23e03 100644 --- a/src/sys/ptrace/linux.rs +++ b/src/sys/ptrace/linux.rs @@ -33,6 +33,7 @@ libc_enum!{ #[cfg_attr(not(any(target_env = "musl", target_os = "android")), repr(u32))] #[cfg_attr(any(target_env = "musl", target_os = "android"), repr(i32))] /// Ptrace Request enum defining the action to be taken. + #[non_exhaustive] pub enum Request { PTRACE_TRACEME, PTRACE_PEEKTEXT, @@ -123,6 +124,7 @@ libc_enum!{ /// Using the ptrace options the tracer can configure the tracee to stop /// at certain events. This enum is used to define those events as defined /// in `man ptrace`. + #[non_exhaustive] pub enum Event { /// Event that stops before a return from fork or clone. PTRACE_EVENT_FORK, |