We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
test
Error::name
1 parent e7ac5fa commit a4a41a6Copy full SHA for a4a41a6
rust/kernel/error.rs
@@ -161,7 +161,7 @@ impl Error {
161
}
162
163
/// Returns a string representing the error, if one exists.
164
- #[cfg(not(testlib))]
+ #[cfg(not(any(test, testlib)))]
165
pub fn name(&self) -> Option<&'static CStr> {
166
// SAFETY: Just an FFI call, there are no extra safety requirements.
167
let ptr = unsafe { bindings::errname(-self.0.get()) };
@@ -178,7 +178,7 @@ impl Error {
178
/// When `testlib` is configured, this always returns `None` to avoid the dependency on a
179
/// kernel function so that tests that use this (e.g., by calling [`Result::unwrap`]) can still
180
/// run in userspace.
181
- #[cfg(testlib)]
+ #[cfg(any(test, testlib))]
182
183
None
184
0 commit comments