File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed
Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -80,8 +80,16 @@ impl ABI {
8080 } )
8181 }
8282
83- // There is no way to not publicly expose an implementation of an external trait such as
84- // From<i32>. See RFC https://github.com/rust-lang/rfcs/pull/2529
83+ #[ cfg( test) ]
84+ fn is_known ( value : i32 ) -> bool {
85+ value > 0 && value < ABI :: COUNT as i32
86+ }
87+ }
88+
89+ /// Converting from an integer to an ABI should only be used for testing.
90+ /// Indeed, manually setting the ABI can lead to inconsistent and unexpected behaviors.
91+ /// Instead, just use the appropriate access rights, this library will handle the rest.
92+ impl From < i32 > for ABI {
8593 fn from ( value : i32 ) -> ABI {
8694 match value {
8795 // The only possible error values should be EOPNOTSUPP and ENOSYS, but let's interpret
@@ -95,11 +103,6 @@ impl ABI {
95103 _ => ABI :: V5 ,
96104 }
97105 }
98-
99- #[ cfg( test) ]
100- fn is_known ( value : i32 ) -> bool {
101- value > 0 && value < ABI :: COUNT as i32
102- }
103106}
104107
105108#[ test]
You can’t perform that action at this time.
0 commit comments