File tree Expand file tree Collapse file tree 3 files changed +11
-16
lines changed
Expand file tree Collapse file tree 3 files changed +11
-16
lines changed Original file line number Diff line number Diff line change @@ -23,25 +23,19 @@ const unsafe fn unsafe_fn_one_arg(b: bool) -> bool { b }
2323const unsafe fn unsafe_fn_two_args (_ : bool , u : u8 ) -> u8 { u }
2424
2525const _ : () = unsafe_fn! (unsafe_fn_no_args );
26- const _ : bool = unsafe_fn! (unsafe_fn_one_arg => true );
27- const _ : u8 = unsafe_fn! (unsafe_fn_two_args => true , 0 );
28- fn main () {}
26+ const _ : bool = unsafe_fn! (unsafe_fn_one_arg => true );
27+ const _ : u8 = unsafe_fn! (unsafe_fn_two_args => true , 0 );
2928```
3029
3130## unsafe_method
3231
33- ### self by value
32+ ### self is Copy, by value
3433``` rust
3534use prudent :: unsafe_method;
3635const _ : u8 = unsafe_method! ( 1u8 => @ unchecked_add => 0 );
3736```
3837
39- ``` rust
40- let _todo = ();
41- // # use prudent::unsafe_method;
42- // const _: u8 = unsafe_method!(~allow_unsafe ~expect_unsafe 1u8, unchecked_add, 0);
43- ```
44-
38+ ### self is not Copy, by shared reference
4539``` rust
4640use prudent :: unsafe_method;
4741struct SNonCopy {}
@@ -53,7 +47,6 @@ impl SNonCopy {
5347
5448fn main () {
5549 let s = SNonCopy {};
56- // Works ALSO for non-Copy types
5750 unsafe_method! (s => @ unsafe_method_no_args );
5851 unsafe_method! (s => @ unsafe_method_one_arg => true );
5952 unsafe_method! (s => @ unsafe_method_two_args => true , false );
Original file line number Diff line number Diff line change 11//! "backend" functionality (anything else than linted macros)
2- //! - a few macros macros ; and
2+ //! - helper macro(s) ; and
33//! - any non-macro functionality.
44
55/// For casting/ensuring that a user-provided function is unsafe. Used by [crate::unsafe_fn].
@@ -269,8 +269,8 @@ pub const fn shared_to_mut<T>(_: &T) -> &'static mut T {
269269 unreachable ! ( )
270270}
271271
272- /// This is an "early" type check for [unsafe_val], so that the user knows to use [unsafe_val] with
273- /// [core::marker::Copy] types only.
272+ /// This is an "early" type check for [crate:: unsafe_val], so that the user knows to use
273+ /// [crate::unsafe_val] with [ core::marker::Copy] types only.
274274///
275275/// NOT a part of public API!
276276#[ doc( hidden) ]
Original file line number Diff line number Diff line change 66//! - macros inject code, so they are not as sandboxed/isolated as non-macro code.
77//! - Otherwise it's a pain to edit them/render them in VS Code. Yes, that matters.
88
9- #![ cfg_attr(
9+ /* #![cfg_attr(
1010 feature = "assert_unsafe_methods",
1111 doc(test(attr(feature(type_alias_impl_trait))))
12- ) ]
12+ )]*/
13+ #![ doc( test( attr( forbid( unexpected_cfgs) ) ) ) ]
14+ //
1315#![ allow( clippy:: useless_attribute) ]
1416#![ allow( clippy:: needless_doctest_main) ]
1517#![ cfg_attr( not( any( doc, test) ) , no_std) ]
You can’t perform that action at this time.
0 commit comments