[pbs-devel] [PATCH proxmox v2 08/12] auth-api: fix types `compilefail` test

Stefan Sterz s.sterz at proxmox.com
Wed Mar 6 13:36:05 CET 2024


due to missing `use` statements they failed, as they should, but for
the wrong reasons. also adapt a test case that presumably was meant
to test whether `TokennameRef` can be compared, but instead
duplicated the `UsernameRef` test case.

Signed-off-by: Stefan Sterz <s.sterz at proxmox.com>
---
 proxmox-auth-api/src/types.rs | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/proxmox-auth-api/src/types.rs b/proxmox-auth-api/src/types.rs
index 319ac4b..18b1793 100644
--- a/proxmox-auth-api/src/types.rs
+++ b/proxmox-auth-api/src/types.rs
@@ -137,6 +137,7 @@ pub const PROXMOX_AUTH_REALM_SCHEMA: Schema = PROXMOX_AUTH_REALM_STRING_SCHEMA.s
 /// `.as_str()`.
 ///
 /// ```compile_fail
+/// # use proxmox_auth_api::types::Username;
 /// fn test(a: Username, b: Username) -> bool {
 ///     a == b // illegal and does not compile
 /// }
@@ -346,21 +347,24 @@ pub struct TokennameRef(str);
 
 #[doc(hidden)]
 /// ```compile_fail
+/// # use proxmox_auth_api::types::Username;
 /// let a: Username = unsafe { std::mem::zeroed() };
 /// let b: Username = unsafe { std::mem::zeroed() };
 /// let _ = <Username as PartialEq>::eq(&a, &b);
 /// ```
 ///
 /// ```compile_fail
+/// # use proxmox_auth_api::types::UsernameRef;
 /// let a: &UsernameRef = unsafe { std::mem::zeroed() };
 /// let b: &UsernameRef = unsafe { std::mem::zeroed() };
 /// let _ = <&UsernameRef as PartialEq>::eq(a, b);
 /// ```
 ///
 /// ```compile_fail
-/// let a: &UsernameRef = unsafe { std::mem::zeroed() };
-/// let b: &UsernameRef = unsafe { std::mem::zeroed() };
-/// let _ = <&UsernameRef as PartialEq>::eq(&a, &b);
+/// # use proxmox_auth_api::types::TokennameRef;
+/// let a: &TokennameRef = unsafe { std::mem::zeroed() };
+/// let b: &TokennameRef = unsafe { std::mem::zeroed() };
+/// let _ = <&TokennameRef as PartialEq>::eq(&a, &b);
 /// ```
 struct _AssertNoEqImpl;
 
-- 
2.39.2





More information about the pbs-devel mailing list