Skip to content

Commit f9490f8

Browse files
committed
Make unstable-darwin-objc augment the other unstable features
Instead of overriding.
1 parent b22781c commit f9490f8

File tree

3 files changed

+21
-20
lines changed

3 files changed

+21
-20
lines changed

crates/objc2/Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,20 +72,22 @@ disable-encoding-assertions = []
7272
# no longer required.
7373
verify = []
7474

75-
# Make the `sel!` macro look up the selector statically.
75+
# Make the `sel!`/`class!` macro look up the item statically.
7676
#
7777
# The plan is to enable this by default, but right now we are uncertain of
7878
# its stability, and it might need significant changes before being fully
7979
# ready!
8080
#
8181
# Please test it, and report any issues you may find:
8282
# https://github.com/madsmtm/objc2/issues/new
83-
unstable-darwin-objc = []
8483
unstable-static-sel = ["dep:objc2-proc-macros"]
8584
unstable-static-sel-inlined = ["unstable-static-sel"]
8685
unstable-static-class = ["dep:objc2-proc-macros"]
8786
unstable-static-class-inlined = ["unstable-static-class"]
8887

88+
# Augment the above with the nightly `darwin_objc` feature.
89+
unstable-darwin-objc = []
90+
8991
# Uses nightly features to make autorelease pools fully sound
9092
unstable-autoreleasesafe = []
9193

crates/objc2/src/__macros/class.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ use crate::runtime::AnyClass;
2727
///
2828
/// # Features
2929
///
30-
/// If the experimental `"unstable-static-class"` or `"unstable-darwin-objc"`
31-
/// features are enabled, this will emit special statics that will be replaced
32-
/// by dyld when the program starts up.
30+
/// If the experimental `"unstable-static-class"` feature is enabled, this
31+
/// will emit special statics that will be replaced by dyld when the program
32+
/// starts up.
3333
///
3434
/// Errors that were previously runtime panics may now turn into linker errors
3535
/// if you try to use a class which is not available. Additionally, you may
@@ -78,10 +78,7 @@ macro_rules! class {
7878

7979
#[doc(hidden)]
8080
#[macro_export]
81-
#[cfg(not(any(
82-
feature = "unstable-darwin-objc",
83-
feature = "unstable-static-class"
84-
)))]
81+
#[cfg(not(feature = "unstable-static-class"))]
8582
macro_rules! __class_inner {
8683
($name:expr, $_hash:expr) => {{
8784
static CACHED_CLASS: $crate::__macros::CachedClass = $crate::__macros::CachedClass::new();
@@ -95,8 +92,9 @@ macro_rules! __class_inner {
9592
#[doc(hidden)]
9693
#[macro_export]
9794
#[cfg(all(
95+
feature = "unstable-static-class",
9896
feature = "unstable-darwin-objc",
99-
not(feature = "unstable-static-class")
97+
not(feature = "gnustep-1-7"),
10098
))]
10199
macro_rules! __class_inner {
102100
($name:expr, $_hash:expr) => {{
@@ -194,6 +192,7 @@ macro_rules! __statics_class {
194192
#[macro_export]
195193
#[cfg(all(
196194
feature = "unstable-static-class",
195+
not(feature = "unstable-darwin-objc"),
197196
not(feature = "gnustep-1-7"),
198197
not(feature = "unstable-static-class-inlined")
199198
))]
@@ -218,6 +217,7 @@ macro_rules! __class_inner {
218217
#[macro_export]
219218
#[cfg(all(
220219
feature = "unstable-static-class",
220+
not(feature = "unstable-darwin-objc"),
221221
not(feature = "gnustep-1-7"),
222222
feature = "unstable-static-class-inlined"
223223
))]

crates/objc2/src/__macros/sel.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,6 @@ use crate::runtime::Sel;
6767
///
6868
/// See [rust-lang/rust#145496] for the tracking issue for the feature.
6969
///
70-
/// `"unstable-static-sel"` and `"unstable-static-sel-inlined"` take
71-
/// precedence over `"unstable-darwin-objc"`.
72-
///
7370
/// [rust-lang/rust#53929]: https://github.com/rust-lang/rust/issues/53929
7471
/// [rust-lang/rust#145496]: https://github.com/rust-lang/rust/issues/145496
7572
///
@@ -241,7 +238,7 @@ macro_rules! __sel_data {
241238

242239
#[doc(hidden)]
243240
#[macro_export]
244-
#[cfg(not(any(feature = "unstable-darwin-objc", feature = "unstable-static-sel")))]
241+
#[cfg(not(feature = "unstable-static-sel"))]
245242
macro_rules! __sel_inner {
246243
($data:expr, $_hash:expr) => {{
247244
static CACHED_SEL: $crate::__macros::CachedSel = $crate::__macros::CachedSel::new();
@@ -254,10 +251,7 @@ macro_rules! __sel_inner {
254251

255252
#[doc(hidden)]
256253
#[macro_export]
257-
#[cfg(all(
258-
feature = "unstable-darwin-objc",
259-
not(feature = "unstable-static-sel")
260-
))]
254+
#[cfg(all(feature = "unstable-static-sel", feature = "unstable-darwin-objc"))]
261255
macro_rules! __sel_inner {
262256
($data:expr, $_hash:expr) => {{
263257
let ptr = $crate::__macros::core_darwin_objc::selector!($data);
@@ -353,7 +347,8 @@ macro_rules! __statics_sel {
353347
#[macro_export]
354348
#[cfg(all(
355349
feature = "unstable-static-sel",
356-
not(feature = "unstable-static-sel-inlined")
350+
not(feature = "unstable-darwin-objc"),
351+
not(feature = "unstable-static-sel-inlined"),
357352
))]
358353
macro_rules! __sel_inner {
359354
($data:expr, $hash:expr) => {{
@@ -385,7 +380,11 @@ macro_rules! __sel_inner {
385380

386381
#[doc(hidden)]
387382
#[macro_export]
388-
#[cfg(feature = "unstable-static-sel-inlined")]
383+
#[cfg(all(
384+
feature = "unstable-static-sel",
385+
not(feature = "unstable-darwin-objc"),
386+
feature = "unstable-static-sel-inlined",
387+
))]
389388
macro_rules! __sel_inner {
390389
($data:expr, $hash:expr) => {{
391390
$crate::__statics_sel! {

0 commit comments

Comments
 (0)