Skip to content

Commit 87bc2d2

Browse files
committed
Polish
1 parent 650a10e commit 87bc2d2

File tree

1 file changed

+22
-26
lines changed

1 file changed

+22
-26
lines changed

posts/inside-rust/2024-05-07-this-development-cycle-in-cargo-1.79.md

+22-26
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,14 @@ However, rustc considers snake_case to be the canonical form and we decided that
102102
We can always add a second style later, if we so wished.
103103

104104
<!-- team meeting: 2024-04-16 -->
105-
Our test case for this functionality is deprecatoing implicit features in Edition 2024.
106-
We modeled this as a deprecation warning when implicit features exist in all current Editions
107-
while Edition 2024 would report the optional dependency as unused ([#13778](https://github.com/rust-lang/cargo/pull/13778)).
105+
Our test case for this functionality is deprecating implicit features in Edition 2024.
106+
We modeled this as a deprecation warning for implicit features in existing Editions
107+
while Edition 2024 will report the optional dependency as unused ([#13778](https://github.com/rust-lang/cargo/pull/13778)).
108108
We discussed how we wanted to model unused optional dependemncies.
109-
At a high level, the most direct way is we just change how we generate features based on the edition.
109+
At a high level, the most direct way is we change how we internally enumerate features to be based on the edition.
110110
However, this doesn't play well with registry packages.
111111
We resolve them off of the Index which doesn't have the full `Cargo.toml`, particularly the Edition,
112-
and prior versions of Cargo would read these Index entries and generate implicit features, breaking on upgrade without extra care.
112+
and prior versions of Cargo would read these Index entries and generate implicit features, breaking on upgrade of Cargo without extra care.
113113
Maybe we should work to support the Edition in the Index but we don't need to do that now.
114114
We ended up stripping unused optional dependencies from the published `Cargo.toml` and the Index.
115115
The way this was done also means they won't show up in `Cargo.lock` like unused `workspace.dependencies`.
@@ -134,9 +134,9 @@ We've continued to iterate on the MSRV resolver's behavior, including
134134
- Avoiding it for `cargo install` ([#13790](https://github.com/rust-lang/cargo/pull/13790))
135135

136136
As for controlling the resolver policy, we've implemented:
137-
- `--ignore-rust-version` disables it ([#13738](https://github.com/rust-lang/cargo/pull/13738))
137+
- `--ignore-rust-version` disables MSRV dependency resolution ([#13738](https://github.com/rust-lang/cargo/pull/13738))
138138
- We added `--ignore-rust-version` to `cargo update` and `cargo generate-lockfile` ([#13742](https://github.com/rust-lang/cargo/pull/13742))
139-
- We added a placeholder config field so it can be forced on or off ([#13769](https://github.com/rust-lang/cargo/pull/13769))
139+
- We added a placeholder config field so it can be forced on or off ([#13769](https://github.com/rust-lang/cargo/pull/13769)). We still need final names for this, see [#13540](https://github.com/rust-lang/cargo/issues/13540).
140140
- We added `package.resolver = "3"` ([#13776](https://github.com/rust-lang/cargo/pull/13776))
141141
- We made this the default resolver for Edition 2024 ([#13785](https://github.com/rust-lang/cargo/pull/13785))
142142

@@ -183,7 +183,7 @@ There was some recent discussion on an issue for how `cargo add` should render f
183183
([#10681](https://github.com/rust-lang/cargo/issues/10681)).
184184
epage figured `cargo info` could be a good place to try out their proposal
185185
([cargo-information#140](https://github.com/hi-rustin/cargo-information/pull/140)).
186-
A controversial aspect of this was to apply the same rendering to dependencies to distinguish between required, activated-optional, and deactivated-optional dependencies.
186+
A question aspect of this was to apply the same rendering to dependencies to distinguish between required, activated-optional, and deactivated-optional dependencies.
187187

188188
epage also made the auto-selection of what version to show a little smarter.
189189
Instead of showing the latest when a version is unspecified,
@@ -256,7 +256,7 @@ Its particularly an issue if the binary name starts with `cargo-` as that would
256256
However, this only really happens with non-standard `PATH`s on Linux and Mac (Windows is a separate case) or having too-generic of script names in your `PATH`.
257257
This lowered the priority for us.
258258

259-
We could possibly take advantage of `AT_EXECFN` so cargo can detect its being run as a `#!` interpreter and bypass the precedence rules.
259+
We could possibly take advantage of `AT_EXECFN` where supported so cargo can detect its being run as a `#!` interpreter and bypass the precedence rules.
260260

261261
Talking about this brought up a new concern: `cargo <script>` loads the config file based on `<script>`, rather than your current working directory.
262262
This is like `cargo install` and unlike all other cargo commands.
@@ -314,29 +314,27 @@ The core question to the discussion is "do we expect the benefits to be worth th
314314

315315
An additional use case that came up during the discussion was to combine this with [artifact dependencies](https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#artifact-dependencies) so you could have build scripts that were full packages that didn't require the overhead of publishing a full workspace.
316316

317-
This would create a footgun when it comes to workspaces.
317+
Nested packages would create a footgun when it comes to workspaces.
318318
If you have a nested package that is a [public dependency](https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#public-dependency) of multiple workspace members,
319319
you could start passing types between the packages.
320320
This will work locally because they all use the same instance of the nested package as a dependency.
321321
When you publish, each package will have its own instance of the nested package and the types will become incompatible.
322322

323-
In general, there was unease that this could encourage people to vendor dependencies more often in a way that is less traceable and allows the code to drift in uncontrolled ways while we want to have the workflow encourage people to work directly with upstream.
323+
In general, there was unease that nested packages could encourage people to vendor dependencies more often in a way that is less traceable and allows the code to drift in uncontrolled ways while we want to have the workflow encourage people to work directly with upstream.
324324

325325
As a side note, during the discussion, the idea came up for a new `pub(scope)` to allow access to private APIs within a [namespace](https://rust-lang.github.io/rfcs/3243-packages-as-optional-namespaces.html#motivation).
326326

327327
#### Workspace inheritance of deps
328328

329-
[LukeMathWalker](https://github.com/LukeMathWalker) recently announced [cargo autoinherit](https://mainmatter.com/blog/2024/03/18/cargo-autoinherit/) which will consolidate all of your dependency sources to
329+
[LukeMathWalker](https://github.com/LukeMathWalker) recently announced [cargo autoinherit](https://mainmatter.com/blog/2024/03/18/cargo-autoinherit/) which will consolidate your dependencies of workspace members sources to
330330
[`[workspace.dependencies]`](https://doc.rust-lang.org/cargo/reference/workspaces.html#the-dependencies-table).
331331

332332
While discussing the announcement,
333333
a [footgun came up with regards to `default-features`](https://www.reddit.com/r/rust/comments/1bjdnne/cargoautoinherit_dry_up_your_workspace/kvr6iq1/).
334334
If you set `default-features = true` in the workspace dependencies then `default-features = false` in your package dependencies is ignored
335335
([#12162](https://github.com/rust-lang/cargo/issues/12162)).
336-
This might not be too bad except `default-features = true` is the default when you say `dep = "1.0"`.
337-
You'd then have to explicitly re-enable `default-features when needed`
338-
339-
For example:
336+
This might not be too bad except `default-features = true` is the default including when using the `dep = "1.0"` syntax.
337+
You'd then have to explicitly re-enable `default-features` when needed, for example:
340338
```toml
341339
[workspace.dependencies]
342340
foo = { version = "1.0", default-features = false }
@@ -351,15 +349,15 @@ While discussing workspace inheritance for the
351349
one thought that epage had was that maybe dependency inheritance should focus exclusively on inheriting the source of the dependency and not anything else.
352350
When trying to not repeat oneself,
353351
it can be easy to go overboard and de-duplicate logic that reflects more of the current implementation, and not the requirements.
354-
As the implementation changes, you then have to shift things in and out of the shared or specific state.
352+
As the implementation changes, you then have to shift things in and out between the shared and specific state.
355353

356354
Applying that concept to `default-features`,
357355
maybe we should disallow it in workspace dependencies (on a new Edition),
358356
and have the package dependencies' `default-features` always win.
359357
As workspaces don't have an Edition, we could frame this from the package's perspective as it inherits a field, making it so the package's Edition applies.
360358

361-
Going to the full extreme of removing `default-features` and `features` from workspace dependencies might be controversial.
362-
For example, likely an application would want to share `serde`'s `derive` feature throughoutt the workspace.
359+
Going to the full extreme of removing `default-features` and `features` from workspace dependencies might be too large of departure from today.
360+
For example, likely a maintainer would find it convenient to share `serde`'s `derive` feature throughout their workspace.
363361
An incremental step could be to treat the lack of `default-features` in a workspace dependency as unset.
364362

365363
<!-- team meeting: 2024-03-26 -->
@@ -389,9 +387,7 @@ this will likely be stuck waiting on the 2027 Edition.
389387
## Misc
390388

391389
- Thank to [PaulDance](https://github.com/PaulDance), we are now publishing `cargo-test-support` and `cargo-test-macro` which can be useful for developing tools that integrate with cargo [#13418](https://github.com/rust-lang/cargo/pull/13418). The focus is on Cargo's needs, making the APIs and documentation a little rough for others to adopt.
392-
- Thanks for [linyihai](https://github.com/linyihai), we now have unstable support for `cargo update foo --precise <prerelease>`, last discussed in [1.76](https://blog.rust-lang.org/inside-rust/2024/01/03/this-development-cycle-in-cargo-1-76.html#rfc-3493-cargo-update---precise-prerelease).
393-
394-
https://github.com/rust-lang/cargo/pull/13626
390+
- Thanks for [linyihai](https://github.com/linyihai), we now have unstable support for `cargo update foo --precise <prerelease>` ([#13626](https://github.com/rust-lang/cargo/pull/13626)), last discussed in [1.76](https://blog.rust-lang.org/inside-rust/2024/01/03/this-development-cycle-in-cargo-1-76.html#rfc-3493-cargo-update---precise-prerelease).
395391

396392
## Focus areas without progress
397393

@@ -410,10 +406,10 @@ Ready-to-develop:
410406

411407
Needs design and/or experimentation:
412408
- [GC](https://github.com/rust-lang/cargo/issues/12633)
413-
- [cargo info](https://github.com/rust-lang/cargo/issues/948)
414409
- [Per-user artifact cache](https://github.com/rust-lang/cargo/issues/5931)
415410
- [Dependency resolution hooks](https://github.com/rust-lang/cargo/issues/7193)
416411
- [A way to report why crates were rebuilt](https://github.com/rust-lang/cargo/issues/2904)
412+
<!-- - [cargo info](https://github.com/rust-lang/cargo/issues/948) -->
417413

418414
Planning:
419415
- [Disabling of default features](https://github.com/rust-lang/cargo/issues/3126)
@@ -422,13 +418,13 @@ Planning:
422418
- [RFC #3487: visibility](https://github.com/rust-lang/rfcs/pull/3487) (visibility)
423419
- [RFC #3486: deprecation](https://github.com/rust-lang/rfcs/pull/3486)
424420
- [Unstable features](https://doc.rust-lang.org/cargo/reference/unstable.html#list-of-unstable-features)
425-
<!-- - [RFC #3452: Nested packages](https://github.com/rust-lang/rfcs/pull/3452) -->
426421
- [OS-native config/cache directories (ie XDG support)](https://github.com/rust-lang/cargo/issues/1734)
427422
- [Phase 1 Pre-RFC](https://internals.rust-lang.org/t/pre-rfc-split-cargo-home/19747)
428423
- [RFC #3371: CARGO_TARGET_BASE_DIR](https://github.com/rust-lang/rfcs/pull/3371)
429424
- [Pre-RFC: Global, mutually exclusive features](https://internals.rust-lang.org/t/pre-rfc-mutually-excusive-global-features/19618)
430-
- <!-- [RFC #3553: Cargo SBOM Fragment](https://github.com/rust-lang/rfcs/pull/3553) -->
431-
- <!-- Cargo script ([RFC #3502](https://github.com/rust-lang/rfcs/pull/3502), [RFC #3503](https://github.com/rust-lang/rfcs/pull/3503)) -->
425+
<!-- - [RFC #3452: Nested packages](https://github.com/rust-lang/rfcs/pull/3452) -->
426+
<!-- - [RFC #3553: Cargo SBOM Fragment](https://github.com/rust-lang/rfcs/pull/3553) -->
427+
<!-- - Cargo script ([RFC #3502](https://github.com/rust-lang/rfcs/pull/3502), [RFC #3503](https://github.com/rust-lang/rfcs/pull/3503)) -->
432428

433429
## How you can help
434430

0 commit comments

Comments
 (0)