Skip to content

Commit e000fea

Browse files
committed
Don't automatically enable std and alloc features of dependencies
Part of #656.
1 parent 321d4cb commit e000fea

File tree

99 files changed

+204
-218
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+204
-218
lines changed

crates/block2/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ workspace = true
2222
default = ["std"]
2323

2424
# Currently not possible to turn off, put here for forwards compatibility.
25-
std = ["alloc", "objc2/std"]
26-
alloc = ["objc2/alloc"]
25+
std = ["alloc"]
26+
alloc = []
2727

2828
# Deprecated; this is the default on Apple platforms, and not applicable on other platforms.
2929
apple = []
@@ -53,7 +53,7 @@ objc2 = { path = "../objc2", version = "0.5.2", default-features = false }
5353
[dev-dependencies.objc2-foundation]
5454
path = "../../framework-crates/objc2-foundation"
5555
default-features = false
56-
features = ["NSError"]
56+
features = ["alloc", "NSError"]
5757

5858
[package.metadata.docs.rs]
5959
default-target = "aarch64-apple-darwin"

crates/dispatch2/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ targets = [
4141
default = ["std"]
4242

4343
# Currently not possible to turn off, put here for forwards compatibility.
44-
std = ["alloc", "bitflags/std", "block2?/std", "libc?/std", "objc2?/std"]
45-
alloc = ["block2?/alloc", "objc2?/alloc"]
44+
std = ["alloc"]
45+
alloc = []
4646
block2 = ["dep:block2"]
4747
libc = ["dep:libc"]
4848
objc2 = ["dep:objc2"]

crates/header-translator/src/default_cargo.toml

-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,5 @@ targets = [
2626

2727
[features]
2828
default = ["std"]
29-
30-
# Currently not possible to turn off, put here for forwards compatibility.
3129
std = ["alloc"]
3230
alloc = []

crates/header-translator/src/library.rs

-17
Original file line numberDiff line numberDiff line change
@@ -326,23 +326,6 @@ see that for related crates.", self.data.krate)?;
326326
dependency_table
327327
.entry(krate)
328328
.or_insert(Item::Value(Value::InlineTable(table)));
329-
330-
cargo_toml["features"]["std"]
331-
.as_array_mut()
332-
.unwrap()
333-
.push(Value::from(format!(
334-
"{krate}{}/std",
335-
if *required { "" } else { "?" },
336-
)));
337-
if *krate != "bitflags" && *krate != "libc" {
338-
cargo_toml["features"]["alloc"]
339-
.as_array_mut()
340-
.unwrap()
341-
.push(Value::from(format!(
342-
"{krate}{}/alloc",
343-
if *required { "" } else { "?" },
344-
)));
345-
}
346329
}
347330

348331
match fs::read_to_string(crate_dir.join("Cargo.modified.toml")) {

crates/objc2/Cargo.toml

+4-3
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ workspace = true
2525
default = ["std"]
2626

2727
# Currently not possible to turn off, put here for forwards compatibility.
28-
std = ["alloc", "objc2-encode/std", "block2/std", "objc2-foundation/std", "objc2-exception-helper?/std"]
29-
alloc = ["objc2-encode/alloc", "block2/alloc", "objc2-foundation/alloc", "objc2-exception-helper?/alloc"]
28+
std = ["alloc", "objc2-encode/std"]
29+
alloc = ["objc2-encode/alloc"]
3030

3131
# Enables `objc2::exception::throw` and `objc2::exception::catch`
3232
exception = ["dep:objc2-exception-helper"]
@@ -125,11 +125,12 @@ objc2-exception-helper = { path = "../objc2-exception-helper", version = "0.1.0"
125125
iai = { version = "0.1", git = "https://github.com/madsmtm/iai", branch = "callgrind" }
126126
static_assertions = "1.1.0"
127127
memoffset = "0.9.0"
128-
block2 = { path = "../block2", default-features = false }
128+
block2 = { path = "../block2" }
129129
objc2-core-foundation = { path = "../../framework-crates/objc2-core-foundation", default-features = false, features = [
130130
"CFCGTypes",
131131
] }
132132
objc2-foundation = { path = "../../framework-crates/objc2-foundation", default-features = false, features = [
133+
"std",
133134
"NSArray",
134135
"NSDate",
135136
"NSDictionary",

crates/objc2/src/topics/about_generated/CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
105105
* **BREAKING**: The feature flag guarding `SCSensitivityAnalysis` changed.
106106
* **BREAKING**: `-[NSSavePanel beginSheetForDirectory:file:modalForWindow:modalDelegate:didEndSelector:contextInfo:]`
107107
now takes an optional value as the file path.
108+
* **BREAKING**: No longer automatically enable `std` and `alloc` features of
109+
dependencies. If you want a certain framework crate to use `std` or `alloc`
110+
features, you cannot rely on a higher-level crate to enable that for you.
108111

109112
### Deprecated
110113
* Moved `MainThreadMarker` from `objc2-foundation` to `objc2`.

crates/test-assembly/crates/test_define_class/Cargo.toml

+10-10
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@ publish = false
88
path = "lib.rs"
99

1010
[dependencies]
11-
objc2 = { path = "../../../objc2", optional = true }
12-
objc2-foundation = { path = "../../../../framework-crates/objc2-foundation", optional = true }
11+
objc2 = { path = "../../../objc2" }
12+
objc2-foundation = { path = "../../../../framework-crates/objc2-foundation" }
1313

1414
[features]
15-
default = ["all", "objc2", "objc2-foundation"]
15+
default = ["all"]
1616
# Runtime
17-
gnustep-1-7 = ["objc2?/gnustep-1-7", "objc2-foundation?/gnustep-1-7"]
18-
gnustep-1-8 = ["gnustep-1-7", "objc2?/gnustep-1-8", "objc2-foundation?/gnustep-1-8"]
19-
gnustep-1-9 = ["gnustep-1-8", "objc2?/gnustep-1-9", "objc2-foundation?/gnustep-1-9"]
20-
gnustep-2-0 = ["gnustep-1-9", "objc2?/gnustep-2-0", "objc2-foundation?/gnustep-2-0"]
21-
gnustep-2-1 = ["gnustep-2-0", "objc2?/gnustep-2-1", "objc2-foundation?/gnustep-2-1"]
17+
gnustep-1-7 = ["objc2/gnustep-1-7", "objc2-foundation/gnustep-1-7"]
18+
gnustep-1-8 = ["gnustep-1-7", "objc2/gnustep-1-8", "objc2-foundation/gnustep-1-8"]
19+
gnustep-1-9 = ["gnustep-1-8", "objc2/gnustep-1-9", "objc2-foundation/gnustep-1-9"]
20+
gnustep-2-0 = ["gnustep-1-9", "objc2/gnustep-2-0", "objc2-foundation/gnustep-2-0"]
21+
gnustep-2-1 = ["gnustep-2-0", "objc2/gnustep-2-1", "objc2-foundation/gnustep-2-1"]
2222

23-
all = ["objc2-foundation?/block2", "objc2-foundation?/NSObject", "objc2-foundation?/NSZone"]
23+
all = ["objc2-foundation/block2", "objc2-foundation/NSObject", "objc2-foundation/NSZone"]
2424

2525
# Hack to prevent the feature flag from being enabled in the entire project
26-
assembly-features = ["all", "objc2?/unstable-static-sel-inlined", "objc2?/unstable-static-class-inlined"]
26+
assembly-features = ["all", "objc2/unstable-static-sel-inlined", "objc2/unstable-static-class-inlined"]
2727

2828
[package.metadata.release]
2929
release = false

crates/test-ui/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ gnustep-2-1 = ["gnustep-2-0", "block2/gnustep-2-1", "objc2/gnustep-2-1", "objc2-
3939
trybuild = { version = "1.0.72", optional = true }
4040
block2 = { path = "../block2" }
4141
objc2 = { path = "../objc2" }
42-
objc2-foundation = { path = "../../framework-crates/objc2-foundation" }
42+
objc2-foundation = { path = "../../framework-crates/objc2-foundation", default-features = false, features = ["std"] }
4343

4444
# To make CI work
4545
[target.'cfg(not(target_vendor = "apple"))'.dependencies]
4646
block2 = { path = "../block2", features = ["gnustep-1-7"] }
4747
objc2 = { path = "../objc2", features = ["gnustep-1-7"] }
48-
objc2-foundation = { path = "../../framework-crates/objc2-foundation", features = ["gnustep-1-7"] }
48+
objc2-foundation = { path = "../../framework-crates/objc2-foundation", default-features = false, features = ["std", "gnustep-1-7"] }
4949

5050
[[bin]]
5151
name = "test-ui"

crates/tests/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ unstable-objfw = ["block2/unstable-objfw", "objc2/unstable-objfw"]
3838
[dependencies]
3939
block2 = { path = "../block2" }
4040
objc2 = { path = "../objc2" }
41-
objc2-foundation = { path = "../../framework-crates/objc2-foundation" }
41+
objc2-foundation = { path = "../../framework-crates/objc2-foundation", default-features = false, features = ["std"] }
4242

4343
[build-dependencies]
4444
cc = "1.0"

framework-crates/objc2-accessibility/Cargo.toml

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework-crates/objc2-accounts/Cargo.toml

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework-crates/objc2-ad-services/Cargo.toml

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework-crates/objc2-ad-support/Cargo.toml

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework-crates/objc2-app-kit/Cargo.toml

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework-crates/objc2-app-tracking-transparency/Cargo.toml

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework-crates/objc2-audio-toolbox/Cargo.toml

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework-crates/objc2-authentication-services/Cargo.toml

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework-crates/objc2-automatic-assessment-configuration/Cargo.toml

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework-crates/objc2-automator/Cargo.toml

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework-crates/objc2-av-foundation/Cargo.toml

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework-crates/objc2-av-kit/Cargo.toml

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework-crates/objc2-avf-audio/Cargo.toml

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework-crates/objc2-background-assets/Cargo.toml

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework-crates/objc2-background-tasks/Cargo.toml

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework-crates/objc2-business-chat/Cargo.toml

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework-crates/objc2-call-kit/Cargo.toml

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework-crates/objc2-class-kit/Cargo.toml

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework-crates/objc2-cloud-kit/Cargo.toml

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework-crates/objc2-contacts-ui/Cargo.toml

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework-crates/objc2-contacts/Cargo.toml

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework-crates/objc2-core-audio-types/Cargo.toml

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)