You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since we switched from warn-by-default to allow-by-default,
the need to set `pub` on dependencies with an unsupported MSRV is much
lower.
It'd help with people wanting to enable this now, especially for core
packages that are more likely to have lower MSRVs (but also less likely
to have dependencies).
So if we drop the requirement for allowing `pub` on old MSRVs, we can
re-visit using the name `public`.
-`Cargo.toml`: instead of `pub` (named after the [Rust keyword](https://doc.rust-lang.org/reference/visibility-and-privacy.html), we could name the field `public` (like [RFC 1977]) or name the field `visibility = "<public|private>"`
244
-
- The parallel with Rust seemed worth pursuing
239
+
-`Cargo.toml`: instead of `public` (like [RFC 1977]), we could name the field `pub` (named after the [Rust keyword](https://doc.rust-lang.org/reference/visibility-and-privacy.html) or name the field `visibility = "<public|private>"`
240
+
-`pub` has a nice parallel with Rust
241
+
-`pub`: Cargo doesn't use abbreviations as much as Rust (though some are used)
245
242
-`pub` could be seen as ambiguous with `publish`
243
+
-`public` already is reserved and requires a `cargo_features`, meaning using it requires an MSRV bump
246
244
- While `visibility` would offer greater flexibility, it is unclear if we need that flexibility and if the friction of any feature leveraging it would be worth it
247
-
- In the end, we went with `pub` because `public` would prevent our "no MSRV bump" approach because cargo versions exist with `public` being reserved
248
245
-`rustc`: Instead of `allow` by default for pre-2024 editions, we could warn by default
249
246
- More people would get the benefit of the feature now
250
247
- However, this would be extremely noisy and likely make people grumpy
251
-
-`Cargo.toml`: Instead of `pub = false` being the default and changing the warning level on an edition boundary, we could instead start with `pub = true` and change the default on an edition boundary.
252
-
- This would require `cargo fix` marking all dependencies as `pub = true`, while using the warning means we can limit it to only those dependencies that need it.
253
-
-`Cargo.toml`: Instead of `pub = false` being the default, we could have a "unchecked" / "unset" state
254
-
- This would require `cargo fix` marking all dependencies as `pub = true`, while using the warning means we can limit it to only those dependencies that need it.
255
-
-`Cargo.toml`: In the long term, we decided on the default being `pub = false` as that is the common case and gives us more information than supporting a `pub = "unchecked"` and having that be the long term solution.
256
-
-`cargo add`: instead of `--pub <bool>` it could be `--pub` / `--no-pub` like `--optional` or `--public` / `--private`
257
-
-`cargo add`: when adding a dependency, we could automatically add all of its `pub` dependencies.
258
-
- This was passed up as being too noisy, especially when dealing with facade crates, those that fully re-export their `pub = true` dependency
259
-
- We leave whether `pub` is in the Index as unspecified
248
+
- If we did this, we'd likely want to not require an MSRV bump so people can immediately silence the warning which would require using a key besides `public` (since its already reserved) and treating the field as an unused key when the `-Z` isn't enabled.
249
+
-`Cargo.toml`: Instead of `public = false` being the default and changing the warning level on an edition boundary, we could instead start with `public = true` and change the default on an edition boundary.
250
+
- This would require `cargo fix` marking all dependencies as `public = true`, while using the warning means we can limit it to only those dependencies that need it.
251
+
-`Cargo.toml`: Instead of `public = false` being the default, we could have a "unchecked" / "unset" state
252
+
- This would require `cargo fix` marking all dependencies as `public = true`, while using the warning means we can limit it to only those dependencies that need it.
253
+
-`Cargo.toml`: In the long term, we decided on the default being `public = false` as that is the common case and gives us more information than supporting a `public = "unchecked"` and having that be the long term solution.
254
+
-`cargo add`: instead of `--public <bool>` it could be `--public` / `--no-public` like `--optional` or `--public` / `--private`
255
+
-`cargo add`: when adding a dependency, we could automatically add all of its `public` dependencies.
256
+
- This was passed up as being too noisy, especially when dealing with facade crates, those that fully re-export their `public = true` dependency
257
+
- We leave whether `public` is in the Index as unspecified
260
258
- It isn't strictly needed now
261
259
- It would make `cargo add` easier
262
-
- If we rely on `pub` in the resolver, we might need it but we can always backfill it
260
+
- If we rely on `public` in the resolver, we might need it but we can always backfill it
263
261
- Parts of the implementation are already there from the original RFC
264
262
265
263
## Minimal version resolution
@@ -273,7 +271,7 @@ This should be handled independent of this RFC.
273
271
This is deferred to [Future possibilities](#future-possibilities)
274
272
- This has been the main hang-up for stabilization over the last 6 years since the RFC was approved
275
273
- For more on the complexity involved, see the thread starting at [this comment](https://github.com/rust-lang/rust/issues/44663#issuecomment-881965668)
276
-
- More thought is needed as we found that making a dependency `pub = true` can be a breaking change if the caller also depends on it but with a different semver incompatible version
274
+
- More thought is needed as we found that making a dependency `public = true` can be a breaking change if the caller also depends on it but with a different semver incompatible version
277
275
- More thought is needed on what happens if you have multiple versions of a package that are public (via renaming like `tokio_03` and `tokio_1`)
278
276
279
277
Related problems potentially blocked on this
@@ -347,7 +345,7 @@ How this will work:
347
345
If we want to go this route, some hurdles to overcome include:
348
346
- Difficulties in working with cargo's resolver as this has been the main hang-up for stabilization over the last 6 years since the [RFC 1977] was approved
349
347
- For more on the complexity involved, see the thread starting at [this comment](https://github.com/rust-lang/rust/issues/44663#issuecomment-881965668)
350
-
- More thought is needed as we found that making a dependency `pub = true` can be a breaking change if the caller also depends on it but with a different semver incompatible version
348
+
- More thought is needed as we found that making a dependency `public = true` can be a breaking change if the caller also depends on it but with a different semver incompatible version
351
349
- More thought is needed on what happens if you have multiple versions of a package that are public (via renaming like `tokio_03` and `tokio_1`)
352
350
353
351
### Caller-declared relations
@@ -378,7 +376,7 @@ version should resolve to (clap 3.4 vs clap 4.0), then it is an error.
378
376
379
377
Compared to the resolver doing this implicitly
380
378
- It is unclear if this would be any more difficult to implement in the resolver
381
-
- Changing a dependency from `pub = false` to `pub = true` is backwards compatible because it has no affect on existing callers.
379
+
- Changing a dependency from `public = false` to `public = true` is backwards compatible because it has no affect on existing callers.
382
380
- It is unclear how this would handle multiple versions of a package that are public
383
381
384
382
The downside is it feels like the declaration is backwards.
0 commit comments