Skip to content

Commit 0ff317b

Browse files
committed
Always use proper macro imports, even in error conditions
1 parent 95a28c5 commit 0ff317b

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

crates/objc2/src/macros/__attribute_helpers.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ macro_rules! __extract_custom_attributes_inner {
115115
($out_macro:path)
116116
$($macro_args:tt)*
117117
} => {
118-
compile_error!("must specify the desired selector using `#[method(...)]` or `#[method_id(...)]`");
118+
$crate::__macro_helpers::compile_error!("must specify the desired selector using `#[method(...)]` or `#[method_id(...)]`");
119119
};
120120

121121
// Base case
@@ -183,7 +183,7 @@ macro_rules! __extract_custom_attributes_inner {
183183
($out_macro:path)
184184
$($macro_args:tt)*
185185
} => {
186-
compile_error!("cannot specify the `method`/`method_id` attribute twice");
186+
$crate::__macro_helpers::compile_error!("cannot specify the `method`/`method_id` attribute twice");
187187
};
188188

189189
// `method_id` attribute with retain semantics
@@ -254,7 +254,7 @@ macro_rules! __extract_custom_attributes_inner {
254254
($out_macro:path)
255255
$($macro_args:tt)*
256256
} => {
257-
compile_error!("cannot specify the `method`/`method_id` attribute twice");
257+
$crate::__macro_helpers::compile_error!("cannot specify the `method`/`method_id` attribute twice");
258258
};
259259

260260
// `optional` attribute
@@ -298,7 +298,7 @@ macro_rules! __extract_custom_attributes_inner {
298298
($out_macro:path)
299299
$($macro_args:tt)*
300300
} => {
301-
compile_error!("cannot specify the `optional` attribute twice");
301+
$crate::__macro_helpers::compile_error!("cannot specify the `optional` attribute twice");
302302
};
303303

304304
// Other attributes

crates/objc2/src/macros/__msg_send_parse.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ macro_rules! __msg_send_parse {
9090
$crate::__comma_between_args!(
9191
@($(
9292
", ",
93-
stringify!($selector),
93+
$crate::__macro_helpers::stringify!($selector),
9494
": ",
95-
stringify!($argument),
95+
$crate::__macro_helpers::stringify!($argument),
9696
)+)
9797
$($macro_args)*
9898
);
@@ -124,7 +124,7 @@ macro_rules! __comma_between_args {
124124
@($($args:tt)*)
125125
@($macro_name:literal)
126126
) => {
127-
#[deprecated = concat!(
127+
#[deprecated = $crate::__macro_helpers::concat!(
128128
"using ", $macro_name, "! without a comma between arguments is ",
129129
"technically not valid macro syntax, and may break in a future ",
130130
"version of Rust. You should use the following instead:\n",
@@ -141,7 +141,7 @@ macro_rules! __comma_between_args {
141141
) => {
142142
$crate::__comma_between_args! {
143143
@__output
144-
@(stringify!(super($obj)), $($args)*)
144+
@($crate::__macro_helpers::stringify!(super($obj)), $($args)*)
145145
@("msg_send")
146146
}
147147
};
@@ -152,7 +152,7 @@ macro_rules! __comma_between_args {
152152
) => {
153153
$crate::__comma_between_args! {
154154
@__output
155-
@(stringify!(super($obj, $superclass)), $($args)*)
155+
@($crate::__macro_helpers::stringify!(super($obj, $superclass)), $($args)*)
156156
@("msg_send")
157157
}
158158
};
@@ -163,7 +163,7 @@ macro_rules! __comma_between_args {
163163
) => {
164164
$crate::__comma_between_args! {
165165
@__output
166-
@(stringify!($obj), $($args)*)
166+
@($crate::__macro_helpers::stringify!($obj), $($args)*)
167167
@("msg_send")
168168
}
169169
};
@@ -176,7 +176,7 @@ macro_rules! __comma_between_args {
176176
) => {
177177
$crate::__comma_between_args! {
178178
@__output
179-
@(stringify!($obj), $($args)*)
179+
@($crate::__macro_helpers::stringify!($obj), $($args)*)
180180
@("msg_send_id")
181181
}
182182
};

crates/objc2/src/macros/declare_class.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,7 +1159,7 @@ macro_rules! __declare_class_method_out_inner {
11591159
} => {
11601160
$($m_checked)*
11611161
$($qualifiers)* extern "C" fn $name() {
1162-
compile_error!("`#[method_id(...)]` must have a return type")
1162+
$crate::__macro_helpers::compile_error!("`#[method_id(...)]` must have a return type")
11631163
}
11641164
};
11651165
}
@@ -1294,39 +1294,39 @@ macro_rules! __declare_class_register_out {
12941294
($($m_optional:tt)*)
12951295
($($m_checked:tt)*)
12961296
} => {
1297-
compile_error!("`#[optional]` is only supported in `extern_protocol!`")
1297+
$crate::__macro_helpers::compile_error!("`#[optional]` is only supported in `extern_protocol!`")
12981298
};
12991299
}
13001300

13011301
#[doc(hidden)]
13021302
#[macro_export]
13031303
macro_rules! __get_method_id_sel {
13041304
(alloc) => {
1305-
compile_error!(concat!(
1305+
$crate::__macro_helpers::compile_error!($crate::__macro_helpers::concat!(
13061306
"`#[method_id(alloc)]` is not supported. ",
13071307
"Use `#[method(alloc)]` and do the memory management yourself",
13081308
))
13091309
};
13101310
(retain) => {
1311-
compile_error!(concat!(
1311+
$crate::__macro_helpers::compile_error!($crate::__macro_helpers::concat!(
13121312
"`#[method_id(retain)]` is not supported. ",
13131313
"Use `#[method(retain)]` and do the memory management yourself",
13141314
))
13151315
};
13161316
(release) => {
1317-
compile_error!(concat!(
1317+
$crate::__macro_helpers::compile_error!($crate::__macro_helpers::concat!(
13181318
"`#[method_id(release)]` is not supported. ",
13191319
"Use `#[method(release)]` and do the memory management yourself",
13201320
))
13211321
};
13221322
(autorelease) => {
1323-
compile_error!(concat!(
1323+
$crate::__macro_helpers::compile_error!($crate::__macro_helpers::concat!(
13241324
"`#[method_id(autorelease)]` is not supported. ",
13251325
"Use `#[method(autorelease)]` and do the memory management yourself",
13261326
))
13271327
};
13281328
(dealloc) => {
1329-
compile_error!(concat!(
1329+
$crate::__macro_helpers::compile_error!($crate::__macro_helpers::concat!(
13301330
"`#[method_id(dealloc)]` is not supported. ",
13311331
"Add an instance variable with a `Drop` impl to the class instead",
13321332
))

crates/objc2/src/macros/extern_methods.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ macro_rules! __extern_methods_method_out {
378378
} => {
379379
$($m_checked)*
380380
$($function_start)* {
381-
compile_error!("`#[optional]` is only supported in `extern_protocol!`")
381+
$crate::__macro_helpers::compile_error!("`#[optional]` is only supported in `extern_protocol!`")
382382
}
383383
};
384384
}

0 commit comments

Comments
 (0)