April 20, 2023·4 min read·engineeringrustcargodiagnosticsbuilds

Rust 1.69 makes Cargo's existing repair tools easier to discover

Cargo now points from fixable warnings to the command that can apply their suggestions. Rust 1.69 also stops emitting build-script debug information by default, with profile overrides for debugging.

A tool can support automatic repairs for years while users continue to fix each warning manually. Rust 1.69 changes how Cargo advertises that support. When compilation produces warnings with automatic fixes, Cargo now suggests the appropriate repair command. The April 20 announcement describes a discoverability change to existing machinery, rather than the introduction of automatic fixing itself.

The release also changes a default cost in the build process. Cargo no longer emits debug information for build scripts by default. Both changes concern routine work around compilation. One makes an available operation easier to find, while the other avoids generating information that a successful build-script run usually does not require.

I am impressed by Rust's semantics, but the working experience also depends on how tools explain the next action. A compiler warning is more useful when the user can see that a supported mechanical repair exists. The suggestion belongs near the diagnostic that created the need for it.

The new behavior points to an existing command

The announcement dates cargo fix to Rust 1.29. Since then, the number of warnings it can fix has grown, and automatic repair has also become available for some Clippy warnings. Rust 1.69 draws attention to those capabilities when it detects applicable suggestions.

The example in the release post is an unused import. Cargo's warning summary adds a command identifying the binary target and the number of available suggestions. This connects the diagnostic to an operation with a defined scope. A user need not infer from the warning text whether the tool has enough information to make the edit.

The command shown by Cargo can be more specific than the user needs for a workspace-wide cleanup. The announcement says a plain cargo fix applies fixes to all default workspace members. Extra target arguments are useful when the intended scope is one crate. That distinction makes the suggested command understandable instead of treating its full spelling as mandatory ceremony.

Clippy warnings use cargo clippy --fix for the corresponding operation. Cargo therefore points to the tool that owns the available repair. The release does not claim that every warning has a safe automatic transformation. Its new suggestion appears for warnings it recognizes as automatically fixable.

Discoverability is part of a diagnostic's usefulness

A warning can explain what is wrong without explaining which work the tooling can perform. These are separate pieces of information. The user needs to understand the issue, but also benefits from knowing whether changing it requires a manual edit or a supported repair command.

That is especially useful when the repair is routine. An unused import does not ordinarily require a redesign of the program. Presenting the available fix near the warning allows attention to remain on changes that require judgment. The diagnostic still describes the source problem, while the command supplies a way to perform the mechanical part.

My preference is for this explicit suggestion over assuming that every developer already knows the full command set. An operation's existence in documentation does not guarantee that it is visible when needed. Cargo can use its knowledge of the warning to expose the relevant capability at the point of use.

Build-script debug information becomes opt-in by profile

The second change reduces compilation work by omitting debug information for build scripts unless explicitly requested. According to the announcement, successful script execution has no visible effect from this change. The tradeoff appears when investigating a failure, because build-script backtraces contain less information.

This separates the ordinary build requirement from the information useful during debugging. The script still needs to compile and execute. Debug metadata is additional output whose cost can be avoided until someone needs to inspect execution in more detail. The release describes the aim as improving compilation speed without assigning a universal percentage gain.

Projects can restore debug information through build overrides in Cargo.toml. The announcement supplies overrides for both development and release profiles.

[profile.dev.build-override]
debug = true

[profile.release.build-override]
debug = true

These settings make the diagnostic choice explicit in the relevant profiles. A failure investigation can request richer information for the build script without treating its ordinary successful execution as needing that metadata every time. The versioned release notes also identify the broader build-dependency debug-information default change.

The configuration matters because build-time code and application code have different roles. Debugging the final executable does not automatically mean that every tool compiled along the way needs the same information. Cargo's build override gives that distinction a concrete representation in project configuration.

Rust 1.69 consequently improves two parts of the compilation workflow without asking for a new application abstraction. Fixable warnings advertise their repair path, and build-script debugging has an explicit way to restore the metadata the new default omits. The commands and profile settings describe which operation is intended and where its effect applies.