Skip to content

Commit 3f8b366

Browse files
Renamed: allow_unsafe_expect_unsafe_is_correct -> max_one_active_of_allow_unsafe_expect_unsafe; fn -> method
1 parent d3d68a0 commit 3f8b366

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

src/backend.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ macro_rules! expecting_unsafe_fn_path {
295295
/// passed to [unsafe_method].
296296
#[doc(hidden)]
297297
#[macro_export]
298-
macro_rules! allow_unsafe_expect_unsafe_is_correct {
298+
macro_rules! max_one_active_of_allow_unsafe_expect_unsafe {
299299
(
300300
~allow_unsafe $( { $_allow_unsafe_empty_indicator:tt } )?
301301
~expect_unsafe $( { $_expect_unsafe_empty_indicator:tt } )?

src/frontend_linted.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -227,23 +227,24 @@ macro_rules! internal_prudent_unsafe_method {
227227
(
228228
$( ~allow_unsafe $( { $allow_unsafe_empty_indicator:tt } )? )?
229229
$( ~expect_unsafe $( { $expect_unsafe_empty_indicator:tt } )? )?
230-
$self:expr =>@ $fn:ident
230+
$self:expr =>@ $method:ident
231231
) => {
232232
internal_prudent_unsafe_method!(
233233
$( ~allow_unsafe $( { $allow_unsafe_empty_indicator } )? )?
234234
$( ~expect_unsafe $( { $expect_unsafe_empty_indicator } )? )?
235-
$self =>@ $fn =>
235+
$self =>@ $method =>
236236
)
237237
};
238238
(
239239
$( ~allow_unsafe $( { $allow_unsafe_empty_indicator:tt } )? )?
240240
$( ~expect_unsafe $( { $expect_unsafe_empty_indicator:tt } )? )?
241-
$self:expr =>@ $fn:ident => $( $arg:expr ),*
241+
$self:expr =>@ $method:ident => $( $arg:expr ),*
242242
) => {
243243
// See unsafe_fn for why here we enclose in (...) and not in {...}.
244244
(
245245
if false {
246-
::prudent::allow_unsafe_expect_unsafe_is_correct!{
246+
// no module needed in the following macro path, since allow_unsafe_expect_unsafe_is_correct has #[macro_export]
247+
::prudent::max_one_active_of_allow_unsafe_expect_unsafe!{
247248
$( ~allow_unsafe $( { $allow_unsafe_empty_indicator } )? )?
248249
$( ~expect_unsafe $( { $expect_unsafe_empty_indicator } )? )?
249250
}
@@ -280,10 +281,13 @@ macro_rules! internal_prudent_unsafe_method {
280281
#[allow(unused_mut)]
281282
#[allow(invalid_value)] // for &str and other types where zeroed() issues invalid_value warning.
282283
let mut owned_receiver = ::core::mem::replace(mref, unsafe{ ::core::mem::zeroed() });
283-
// Detect code where unsafe_fn! or unsafe_method! is not needed at all. That is,
284-
// where a function/method used to be `unsafe`, but it stopped being so.
284+
// Detect code where unsafe_method! is not needed at all. Maybe the method used
285+
// to be `unsafe`, but not anymore.
285286
#[deny(unused_unsafe)]
286-
let _ = unsafe { owned_receiver. $fn( $( $arg ),* ) };
287+
let _ = unsafe { owned_receiver. $method( $( $arg ),* ) };
288+
//@TODO here call the method with tuple tree-stored evaluated args.
289+
//
290+
//THEN simplify internal_prudent_unsafe_method_internal_check_args_etc -> internal_prudent_unsafe_method_internal_build_accessors_check_args_call
287291
} else {
288292
// @TODO eliminate
289293
$(
@@ -296,7 +300,7 @@ macro_rules! internal_prudent_unsafe_method {
296300
internal_prudent_unsafe_method_internal_check_args_etc!(
297301
$( ~allow_unsafe $( { $allow_unsafe_empty_indicator } )? )?
298302
$( ~expect_unsafe $( { $expect_unsafe_empty_indicator } )? )?
299-
$self, $fn $(, $arg )*
303+
$self, $method $(, $arg )*
300304
)
301305
}
302306
)

src/frontend_unlinted.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ macro_rules! internal_prudent_unsafe_method {
239239
// See unsafe_fn for why here we enclose in (...) and not in {...}.
240240
(
241241
if false {
242-
::prudent::allow_unsafe_expect_unsafe_is_correct!{
242+
::prudent::max_one_active_of_allow_unsafe_expect_unsafe!{
243243
$( ~allow_unsafe $( { $allow_unsafe_empty_indicator } )? )?
244244
$( ~expect_unsafe $( { $expect_unsafe_empty_indicator } )? )?
245245
}

0 commit comments

Comments
 (0)