Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 5 additions & 6 deletions crates/resolver-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@

## The aim

This crate aims to test the resolution of Cargo's resolver. It implements a [SAT solver](https://en.wikipedia.org/wiki/SAT_solver) to compare with resolution of Cargo's resolver.
This ensures that Cargo's dependency resolution is proven valid by lowering to [SAT problem](https://en.wikipedia.org/wiki/Boolean_satisfiability_problem).
This crate aims to test the resolution of Cargo's resolver. It implements a [SAT solver](https://en.wikipedia.org/wiki/SAT_solver) to compare with resolution of Cargo's resolver.
This ensures that Cargo's dependency resolution is proven valid by lowering to [SAT problem](https://en.wikipedia.org/wiki/Boolean_satisfiability_problem).

> This crate is maintained by the Cargo team, primarily for use by Cargo
> and not intended for external use (except as a transitive dependency). This
> crate may make major changes to its APIs or be deprecated without warning.

## About the test

The Cargo's resolver is very sensitive to what order it tries to evaluate constraints. This makes it incredibly difficult
to be sure that a handful of tests actually covers all the important permutations of decision-making. The tests not only needs
to hit all the corner cases, it needs to try all of the orders of evaluation. So we use fuzz testing to cover more permutations.

The Cargo's resolver is very sensitive to what order it tries to evaluate constraints. This makes it incredibly difficult
to be sure that a handful of tests actually covers all the important permutations of decision-making. The tests not only needs
to hit all the corner cases, it needs to try all of the orders of evaluation. So we use fuzz testing to cover more permutations.
2 changes: 1 addition & 1 deletion credential/cargo-credential-1password/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cargo-credential-1password"
version = "0.4.6"
version = "0.4.7"
rust-version.workspace = true
edition.workspace = true
license.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion credential/cargo-credential-1password/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Finally, run `cargo login` to save your registry token in 1password.

`cargo-credential-1password` supports the following command-line arguments:

* `--account`: The account name to use. For a list of available accounts,
* `--account`: The account name to use. For a list of available accounts,
run `op account list`.
* `--vault`: The vault name to use. For a list of available vaults,
run `op vault list`.
Expand Down
322 changes: 161 additions & 161 deletions doc/book/src/CHANGELOG.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions doc/book/src/appendix/glossary.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,9 @@ The meaning of the term *target* depends on the context:
layout] of the source files.
- **Target Directory** --- Cargo places built artifacts in the *target* directory.
By default this is a directory named `target` at the [*workspace*](#workspace) root,
or the package root if not using a workspace. The directory may be changed with
or the package root if not using a workspace. The directory may be changed with
the `--target-dir` command-line option, the `CARGO_TARGET_DIR` [environment variable],
or the `build.target-dir` [config option].
or the `build.target-dir` [config option].
For more information see the [build cache] documentation.
- **Target Architecture** --- The OS and machine architecture for the built
artifacts are typically referred to as a *target*.
Expand Down
2 changes: 1 addition & 1 deletion doc/book/src/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ but others were accidentally forgotten.

The [`--offline`](commands/cargo.html#option-cargo---offline) or
[`--frozen`](commands/cargo.html#option-cargo---frozen) flags tell Cargo to not
touch the network. It returns an error in case it would access the network.
touch the network. It returns an error in case it would access the network.
You can use [`cargo fetch`] in one project to download
dependencies before going offline, and then use those same dependencies in
another project. Refer to [configuration value][offline config]) to set via
Expand Down
4 changes: 2 additions & 2 deletions doc/book/src/guide/continuous-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:
push:
pull_request:

env:
env:
CARGO_TERM_COLOR: always

jobs:
Expand All @@ -33,7 +33,7 @@ jobs:
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- run: cargo build --verbose
- run: cargo test --verbose

```

This will test all three release channels (note a failure in any toolchain version will fail the entire job). You can also click `"Actions" > "new workflow"` in the GitHub UI and select Rust to add the [default configuration](https://github.com/actions/starter-workflows/blob/main/ci/rust.yml) to your repo. See [GitHub Actions documentation](https://docs.github.com/en/actions) for more information.
Expand Down
6 changes: 3 additions & 3 deletions doc/book/src/reference/build-scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ one detailed below.
* [`cargo::rustc-cfg=KEY[="VALUE"]`](#rustc-cfg) --- Enables compile-time `cfg`
settings.
* [`cargo::rustc-check-cfg=CHECK_CFG`](#rustc-check-cfg) -- Register custom `cfg`s as
expected for compile-time checking of configs.
expected for compile-time checking of configs.
* [`cargo::rustc-env=VAR=VALUE`](#rustc-env) --- Sets an environment variable.
- [`cargo::error=MESSAGE`](#cargo-error) --- Displays an error on the terminal.
* [`cargo::warning=MESSAGE`](#cargo-warning) --- Displays a warning on the
Expand Down Expand Up @@ -467,11 +467,11 @@ key-value pairs. This metadata is set with the `cargo::metadata=KEY=VALUE`
instruction.

The metadata is passed to the build scripts of **dependent** packages. For
example, if the package `foo` depends on `bar`, which links `baz`, then if
example, if the package `foo` depends on `bar`, which links `baz`, then if
`bar` generates `key=value` as part of its build script metadata, then the
build script of `foo` will have the environment variables `DEP_BAZ_KEY=value`
(note that the value of the `links` key is used and the case change for `key`).
See the ["Using another `sys` crate"][using-another-sys] for an example of
See the ["Using another `sys` crate"][using-another-sys] for an example of
how this can be used.

Note that metadata is only passed to immediate dependents, not transitive
Expand Down
4 changes: 2 additions & 2 deletions doc/book/src/reference/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -1341,7 +1341,7 @@ If none of `branch`, `tag`, or `rev` is set, defaults to the `master` branch.
### `[target]`

The `[target]` table is used for specifying settings for specific platform
targets. It consists of a sub-table which is either a [platform triple][target triple]
targets. It consists of a sub-table which is either a [platform triple][target triple]
or a [`cfg()` expression]. The given values will be used if the target platform
matches either the `<triple>` value or the `<cfg>` expression.

Expand Down Expand Up @@ -1404,7 +1404,7 @@ the `<triple>` will take precedence. It is an error if more than one
* Default: none
* Environment: `CARGO_TARGET_<triple>_RUSTFLAGS`

Passes a set of custom flags to the compiler for this [`<triple>`].
Passes a set of custom flags to the compiler for this [`<triple>`].
The value may be an array of strings or a space-separated string.

See [`build.rustflags`](#buildrustflags) for more details on the different
Expand Down
2 changes: 1 addition & 1 deletion doc/book/src/reference/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ enabled:
* `--all-features`: Activates all features of all packages selected on the command line.
* `--no-default-features`: Does not activate the [`default`
feature](#the-default-feature) of the selected packages.

**NOTE**: check the individual subcommand documentation for details. Not all flags are available for all subcommands.

[workspace]: workspaces.md
Expand Down
8 changes: 4 additions & 4 deletions doc/book/src/reference/profiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -412,11 +412,11 @@ The profile used depends on the command, the command-line flags like
You can switch to a different profile using the `--profile=NAME` option which will used the given profile.
The `--release` flag is equivalent to `--profile=release`.

The selected profile applies to all Cargo targets,
The selected profile applies to all Cargo targets,
including [library](./cargo-targets.md#library),
[binary](./cargo-targets.md#binaries),
[example](./cargo-targets.md#examples),
[test](./cargo-targets.md#tests),
[binary](./cargo-targets.md#binaries),
[example](./cargo-targets.md#examples),
[test](./cargo-targets.md#tests),
and [benchmark](./cargo-targets.md#benchmarks).

The profile for specific packages can be specified with
Expand Down
2 changes: 1 addition & 1 deletion doc/book/src/reference/source-replacement.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Registry sources can use [either git or sparse HTTP protocol][protocols]:
# Git protocol
registry = "ssh://git@example.com/path/to/index.git"

# Sparse HTTP protocol
# Sparse HTTP protocol
registry = "sparse+https://example.com/path/to/index"

# HTTPS git protocol
Expand Down
12 changes: 6 additions & 6 deletions doc/book/src/reference/specifying-dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ This is different from [SemVer] which considers all pre-1.0.0 packages to be inc

### Caret requirements

**Caret requirements** are the default version requirement strategy.
**Caret requirements** are the default version requirement strategy.
This version strategy allows [SemVer] compatible updates.
They are specified as version requirements with a leading caret (`^`).

Expand Down Expand Up @@ -216,7 +216,7 @@ regex = { git = "https://github.com/rust-lang/regex.git" }
```

Cargo fetches the `git` repository at that location and traverses the file tree to find
`Cargo.toml` file for the requested crate anywhere inside the `git` repository.
`Cargo.toml` file for the requested crate anywhere inside the `git` repository.
For example, `regex-lite` and `regex-syntax` are members of `rust-lang/regex` repo
and can be referred to by the repo's root URL (`https://github.com/rust-lang/regex.git`)
regardless of where in the file tree they reside.
Expand All @@ -243,9 +243,9 @@ regex = { git = "https://github.com/rust-lang/regex.git", branch = "next" }

Anything that is not a branch or a tag falls under `rev` key. This can be a commit
hash like `rev = "4c59b707"`, or a named reference exposed by the remote
repository such as `rev = "refs/pull/493/head"`.
repository such as `rev = "refs/pull/493/head"`.

What references are available for the `rev` key varies by where the repo is hosted.
What references are available for the `rev` key varies by where the repo is hosted.
GitHub exposes a reference to the most recent commit of every pull request as in the example above.
Other git hosts may provide something equivalent under a different naming scheme.

Expand Down Expand Up @@ -283,7 +283,7 @@ The `version` key always implies that the package is available in a registry,
regardless of the presence of `git` or `path` keys.

The `version` key does _not_ affect which commit is used when Cargo retrieves the `git` dependency,
but Cargo checks the version information in the dependency's `Cargo.toml` file
but Cargo checks the version information in the dependency's `Cargo.toml` file
against the `version` key and raises an error if the check fails.

In this example, Cargo retrieves the HEAD commit of the branch called `next` from Git and checks if the crate's version
Expand All @@ -294,7 +294,7 @@ is compatible with `version = "1.10.3"`:
regex = { version = "1.10.3", git = "https://github.com/rust-lang/regex.git", branch = "next" }
```

`version`, `git`, and `path` keys are considered separate locations for resolving the dependency.
`version`, `git`, and `path` keys are considered separate locations for resolving the dependency.
See [Multiple locations](#multiple-locations) section below for detailed explanations.

> **Note**: [crates.io] does not allow packages to be published with
Expand Down
6 changes: 3 additions & 3 deletions doc/book/src/reference/timings.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ filename, if you want to look at older runs.

## Reading the graphs

There are two tables and two graphs in the output.
There are two tables and two graphs in the output.

The first table displays the build information of the project, including the
number of units built, the maximum number of concurrency, build time, and the
The first table displays the build information of the project, including the
number of units built, the maximum number of concurrency, build time, and the
version information of the currently used compiler.

![build-info](../images/build-info.png)
Expand Down
10 changes: 5 additions & 5 deletions doc/book/src/reference/unstable.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ Each new feature described below should explain how to use it.
* [unit-graph](#unit-graph) --- Emits JSON for Cargo's internal graph structure.
* [`cargo rustc --print`](#rustc---print) --- Calls rustc with `--print` to display information from rustc.
* [Build analysis](#build-analysis) --- Record and persist detailed build metrics across runs, with new commands to query past builds.
* [`rustc-unicode`](#rustc-unicode) --- Enables `rustc`'s unicode error format in Cargo's error messages
* [`rustc-unicode`](#rustc-unicode) --- Enables `rustc`'s unicode error format in Cargo's error messages
* Configuration
* [`cargo config`](#cargo-config) --- Adds a new subcommand for viewing config files.
* Registries
Expand Down Expand Up @@ -310,7 +310,7 @@ version = "0.0.1"
build = ["foo.rs", "bar.rs"]
```

**Accessing Output Directories**: Output directory of each build script can be accessed by using `<script-name>_OUT_DIR`
**Accessing Output Directories**: Output directory of each build script can be accessed by using `<script-name>_OUT_DIR`
where the `<script-name>` is the file-stem of the build script, exactly as-is.
For example, `bar_OUT_DIR` for script at `foo/bar.rs`. (Only set during compilation, can be accessed via `env!` macro)

Expand Down Expand Up @@ -465,7 +465,7 @@ that are uplifted into the target or artifact directories.
{
// Index in to the crates array.
"index": 1,
// Dependency kind:
// Dependency kind:
// Normal: A dependency linked to the artifact produced by this crate.
// Build: A compile-time dependency used to build this crate (build-script or proc-macro).
"kind": "normal"
Expand Down Expand Up @@ -1843,7 +1843,7 @@ When in doubt, you can discuss this in [#14520](https://github.com/rust-lang/car

- zsh:
Add `source <(CARGO_COMPLETE=zsh cargo +nightly)` to your `.zshrc`.

- fish:
Add `source (CARGO_COMPLETE=fish cargo +nightly | psub)` to `$XDG_CONFIG_HOME/fish/completions/cargo.fish`

Expand Down Expand Up @@ -1973,7 +1973,7 @@ The `-Zbuild-analysis` feature records and persists detailed build metrics on di
with new commands to query past builds.

When enabled,
Cargo writes build logs in JSONL format to the `$CARGO_HOME/log/` directory
Cargo writes build logs in JSONL format to the `$CARGO_HOME/log/` directory
Each cargo invocation produces a log file named with a unique session ID.
These logs contain timing information, rebuild reasons, and other build metadata
that can be analyzed with the `cargo report` subcommands.
Expand Down
2 changes: 1 addition & 1 deletion doc/book/src/reference/workspaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ By having a workspace without a root package,
- Commands run in the workspace root will run against all workspace
members by default, see [`default-members`](#the-default-members-field).

## The `members` and `exclude` fields
## The `members` and `exclude` fields

The `members` and `exclude` fields define which packages are members of
the workspace:
Expand Down
2 changes: 1 addition & 1 deletion doc/contrib/src/process/unstable.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ This can also serve as a place for the final documentation to live until its sta

[unstable chapter]: https://github.com/rust-lang/cargo/blob/master/doc/book/src/reference/unstable.md

## Pre-Stabilization
## Pre-Stabilization

Once an unstable feature is "complete", the search for users to test
and give feedback begins:
Expand Down
2 changes: 1 addition & 1 deletion doc/contrib/src/tests/writing.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Note: You will commonly need to call `unordered()` before passing your snapshot
#### Testing Nightly Features

If you are testing a Cargo feature that only works on "nightly" Cargo, then
you need to call `masquerade_as_nightly_cargo` on the process builder and pass
you need to call `masquerade_as_nightly_cargo` on the process builder and pass
the name of the feature as the reason, like this:

```rust,ignore
Expand Down
36 changes: 18 additions & 18 deletions src/util/frontmatter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -461,12 +461,12 @@ content: "fn main() {}\n"
#[test]
fn split_infostring_whitespace() {
assert_source(
r#"--- cargo
[dependencies]
time="0.1.25"
---
fn main() {}
"#,
"--- cargo \n\

@weihanglo weihanglo Aug 13, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did this change because the trailing --- cargo after infostring? Can we remove only that trailing instead?

View changes since the review

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@weihanglo That would change what this test is testing; given the name of the test, I think it's trying to test whitespace here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did this need to happen? rustfmt handles trailing whitespace so we shouldn't need to police it and it is annoying to work with source in this style. Every time I see code like this, I switch it away from it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Json was looking from an editor's angle. I am fine with either, though I agree with Ed that the old style is way readable.

[dependencies]\n\
time=\"0.1.25\"\n\
---\n\
fn main() {}\n\
",
str![[r#"
shebang: None
info: "cargo"
Expand Down Expand Up @@ -514,18 +514,18 @@ content: "fn main() {}"
#[test]
fn split_leading_newlines() {
assert_source(
r#"#!/usr/bin/env cargo



---
[dependencies]
time="0.1.25"
---


fn main() {}
"#,
"#!/usr/bin/env cargo\n\
\n\
Comment thread
joshtriplett marked this conversation as resolved.
\n\
\n\
---\n\
[dependencies]\n\
time=\"0.1.25\"\n\
---\n\
\n\
\n\
fn main() {}\n\
",
str![[r##"
shebang: "#!/usr/bin/env cargo\n"
info: None
Expand Down