Skip to content

Commit ed42a0d

Browse files
committed
Auto merge of #11869 - epage:impl, r=weihanglo
docs(contrib): Pull impl info out of architecture This is a follow up to #11809. Personally, I found mixing this stuff with architecture less than ideal as it buried the more practical information among details that might not have been as important. With us moving architecture information into doc comments, this provides us an opportunity to rectify this. Not a fan of the name of this chapter but its a start. I've left in the old architecture chapter as there is still content to find a home for (resolver).
2 parents d0a73a5 + fceff19 commit ed42a0d

File tree

9 files changed

+66
-49
lines changed

9 files changed

+66
-49
lines changed

src/doc/contrib/src/SUMMARY.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@
77
- [Release process](./process/release.md)
88
- [Unstable features](./process/unstable.md)
99
- [Design Principles](./design.md)
10+
- [Implementing a Change](./implementation/index.md)
11+
- [Architecture](./implementation/architecture.md)
12+
- [New subcommands](./implementation/subcommands.md)
13+
- [Console Output](./implementation/console.md)
14+
- [Filesystem](./implementation/filesystem.md)
15+
- [Debugging](./implementation/debugging.md)
1016
- [Architecture](./architecture/index.md)
1117
- [Codebase Overview](./architecture/codebase.md)
12-
- [SubCommands](./architecture/subcommands.md)
13-
- [Console Output](./architecture/console.md)
1418
- [Packages and Resolution](./architecture/packages.md)
1519
- [Compilation](./architecture/compilation.md)
1620
- [Files](./architecture/files.md)
Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,3 @@
11
# Files
22

33
See [nightly docs](https://doc.rust-lang.org/nightly/nightly-rustc/cargo/index.html)
4-
5-
## Filesystems
6-
7-
Cargo tends to get run on a very wide array of file systems. Different file
8-
systems can have a wide range of capabilities, and Cargo should strive to do
9-
its best to handle them. Some examples of issues to deal with:
10-
11-
* Not all file systems support locking. Cargo tries to detect if locking is
12-
supported, and if not, will ignore lock errors. This isn't ideal, but it is
13-
difficult to deal with.
14-
* The [`fs::canonicalize`] function doesn't work on all file systems
15-
(particularly some Windows file systems). If that function is used, there
16-
should be a fallback if it fails. This function will also return `\\?\`
17-
style paths on Windows, which can have some issues (such as some tools not
18-
supporting them, or having issues with relative paths).
19-
* Timestamps can be unreliable. The [`fingerprint`] module has a deeper
20-
discussion of this. One example is that Docker cache layers will erase the
21-
fractional part of the time stamp.
22-
* Symlinks are not always supported, particularly on Windows.
23-
24-
[`fingerprint`]: https://github.com/rust-lang/cargo/blob/master/src/cargo/core/compiler/fingerprint.rs
25-
[`fs::canonicalize`]: https://doc.rust-lang.org/std/fs/fn.canonicalize.html
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Filesystem
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Architecture Overview
2+
3+
See the
4+
[nightly docs](https://doc.rust-lang.org/nightly/nightly-rustc/cargo/index.html)
5+
for an overview of `cargo`s architecture and links out to further details.

src/doc/contrib/src/architecture/console.md renamed to src/doc/contrib/src/implementation/console.md

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -55,28 +55,4 @@ Some guidelines for Cargo's output:
5555
and use multiple sentences. This should probably be improved sometime in the
5656
future to be more structured.
5757

58-
## Debug logging
59-
60-
Cargo uses the [`env_logger`] crate to display debug log messages. The
61-
`CARGO_LOG` environment variable can be set to enable debug logging, with a
62-
value such as `trace`, `debug`, or `warn`. It also supports filtering for
63-
specific modules. Feel free to use the standard [`log`] macros to help with
64-
diagnosing problems.
65-
66-
```sh
67-
# Outputs all logs with levels debug and higher
68-
CARGO_LOG=debug cargo generate-lockfile
69-
70-
# Don't forget that you can filter by module as well
71-
CARGO_LOG=cargo::core::resolver=trace cargo generate-lockfile
72-
73-
# This will print lots of info about the download process. `trace` prints even more.
74-
CARGO_HTTP_DEBUG=true CARGO_LOG=cargo::ops::registry=debug cargo fetch
75-
76-
# This is an important command for diagnosing fingerprint issues.
77-
CARGO_LOG=cargo::core::compiler::fingerprint=trace cargo build
78-
```
79-
80-
[`env_logger`]: https://docs.rs/env_logger
81-
[`log`]: https://docs.rs/log
8258
[`anyhow`]: https://docs.rs/anyhow
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Debugging
2+
3+
## Logging
4+
5+
Cargo uses the [`env_logger`] crate to display debug log messages. The
6+
`CARGO_LOG` environment variable can be set to enable debug logging, with a
7+
value such as `trace`, `debug`, or `warn`. It also supports filtering for
8+
specific modules. Feel free to use the standard [`log`] macros to help with
9+
diagnosing problems.
10+
11+
```sh
12+
# Outputs all logs with levels debug and higher
13+
CARGO_LOG=debug cargo generate-lockfile
14+
15+
# Don't forget that you can filter by module as well
16+
CARGO_LOG=cargo::core::resolver=trace cargo generate-lockfile
17+
18+
# This will print lots of info about the download process. `trace` prints even more.
19+
CARGO_HTTP_DEBUG=true CARGO_LOG=cargo::ops::registry=debug cargo fetch
20+
21+
# This is an important command for diagnosing fingerprint issues.
22+
CARGO_LOG=cargo::core::compiler::fingerprint=trace cargo build
23+
```
24+
25+
[`env_logger`]: https://docs.rs/env_logger
26+
[`log`]: https://docs.rs/log
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Filesystem
2+
3+
Cargo tends to get run on a very wide array of file systems. Different file
4+
systems can have a wide range of capabilities, and Cargo should strive to do
5+
its best to handle them. Some examples of issues to deal with:
6+
7+
* Not all file systems support locking. Cargo tries to detect if locking is
8+
supported, and if not, will ignore lock errors. This isn't ideal, but it is
9+
difficult to deal with.
10+
* The [`fs::canonicalize`] function doesn't work on all file systems
11+
(particularly some Windows file systems). If that function is used, there
12+
should be a fallback if it fails. This function will also return `\\?\`
13+
style paths on Windows, which can have some issues (such as some tools not
14+
supporting them, or having issues with relative paths).
15+
* Timestamps can be unreliable. The [`fingerprint`] module has a deeper
16+
discussion of this. One example is that Docker cache layers will erase the
17+
fractional part of the time stamp.
18+
* Symlinks are not always supported, particularly on Windows.
19+
20+
[`fingerprint`]: https://github.com/rust-lang/cargo/blob/master/src/cargo/core/compiler/fingerprint.rs
21+
[`fs::canonicalize`]: https://doc.rust-lang.org/std/fs/fn.canonicalize.html
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Implementing a Change
2+
3+
This chapter gives an overview of what you need to know in making a change to cargo.
4+
5+
If you feel something is missing that would help you, feel free to ask on
6+
[Zulip](https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo).

src/doc/contrib/src/architecture/subcommands.md renamed to src/doc/contrib/src/implementation/subcommands.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SubCommands
1+
# New Subcommands
22

33
Cargo is a single binary composed of a set of [`clap`] subcommands. All
44
subcommands live in [`src/bin/cargo/commands`] directory.

0 commit comments

Comments
 (0)