Skip to content

Commit 3a20ea7

Browse files
committed
Auto merge of #14397 - Ifropc:doc-clean, r=epage
doc: convert comments to rustdoc in workspace Converting workspace comments into docs and adding docs on members that were missing it. [Original discussion](#14326 (comment))
2 parents 5b8baa8 + 03962de commit 3a20ea7

File tree

1 file changed

+39
-34
lines changed

1 file changed

+39
-34
lines changed

src/cargo/core/workspace.rs

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -46,65 +46,70 @@ use pathdiff::diff_paths;
4646
/// package is loaded and/or learned about.
4747
#[derive(Debug)]
4848
pub struct Workspace<'gctx> {
49+
/// Cargo configuration information. See [`GlobalContext`].
4950
gctx: &'gctx GlobalContext,
5051

51-
// This path is a path to where the current cargo subcommand was invoked
52-
// from. That is the `--manifest-path` argument to Cargo, and
53-
// points to the "main crate" that we're going to worry about.
52+
/// This path is a path to where the current cargo subcommand was invoked
53+
/// from. That is the `--manifest-path` argument to Cargo, and
54+
/// points to the "main crate" that we're going to worry about.
5455
current_manifest: PathBuf,
5556

56-
// A list of packages found in this workspace. Always includes at least the
57-
// package mentioned by `current_manifest`.
57+
/// A list of packages found in this workspace. Always includes at least the
58+
/// package mentioned by `current_manifest`.
5859
packages: Packages<'gctx>,
5960

60-
// If this workspace includes more than one crate, this points to the root
61-
// of the workspace. This is `None` in the case that `[workspace]` is
62-
// missing, `package.workspace` is missing, and no `Cargo.toml` above
63-
// `current_manifest` was found on the filesystem with `[workspace]`.
61+
/// If this workspace includes more than one crate, this points to the root
62+
/// of the workspace. This is `None` in the case that `[workspace]` is
63+
/// missing, `package.workspace` is missing, and no `Cargo.toml` above
64+
/// `current_manifest` was found on the filesystem with `[workspace]`.
6465
root_manifest: Option<PathBuf>,
6566

66-
// Shared target directory for all the packages of this workspace.
67-
// `None` if the default path of `root/target` should be used.
67+
/// Shared target directory for all the packages of this workspace.
68+
/// `None` if the default path of `root/target` should be used.
6869
target_dir: Option<Filesystem>,
6970

70-
// List of members in this workspace with a listing of all their manifest
71-
// paths. The packages themselves can be looked up through the `packages`
72-
// set above.
71+
/// List of members in this workspace with a listing of all their manifest
72+
/// paths. The packages themselves can be looked up through the `packages`
73+
/// set above.
7374
members: Vec<PathBuf>,
75+
/// Set of ids of workspace members
7476
member_ids: HashSet<PackageId>,
7577

76-
// The subset of `members` that are used by the
77-
// `build`, `check`, `test`, and `bench` subcommands
78-
// when no package is selected with `--package` / `-p` and `--workspace`
79-
// is not used.
80-
//
81-
// This is set by the `default-members` config
82-
// in the `[workspace]` section.
83-
// When unset, this is the same as `members` for virtual workspaces
84-
// (`--workspace` is implied)
85-
// or only the root package for non-virtual workspaces.
78+
/// The subset of `members` that are used by the
79+
/// `build`, `check`, `test`, and `bench` subcommands
80+
/// when no package is selected with `--package` / `-p` and `--workspace`
81+
/// is not used.
82+
///
83+
/// This is set by the `default-members` config
84+
/// in the `[workspace]` section.
85+
/// When unset, this is the same as `members` for virtual workspaces
86+
/// (`--workspace` is implied)
87+
/// or only the root package for non-virtual workspaces.
8688
default_members: Vec<PathBuf>,
8789

88-
// `true` if this is a temporary workspace created for the purposes of the
89-
// `cargo install` or `cargo package` commands.
90+
/// `true` if this is a temporary workspace created for the purposes of the
91+
/// `cargo install` or `cargo package` commands.
9092
is_ephemeral: bool,
9193

92-
// `true` if this workspace should enforce optional dependencies even when
93-
// not needed; false if this workspace should only enforce dependencies
94-
// needed by the current configuration (such as in cargo install). In some
95-
// cases `false` also results in the non-enforcement of dev-dependencies.
94+
/// `true` if this workspace should enforce optional dependencies even when
95+
/// not needed; false if this workspace should only enforce dependencies
96+
/// needed by the current configuration (such as in cargo install). In some
97+
/// cases `false` also results in the non-enforcement of dev-dependencies.
9698
require_optional_deps: bool,
9799

98-
// A cache of loaded packages for particular paths which is disjoint from
99-
// `packages` up above, used in the `load` method down below.
100+
/// A cache of loaded packages for particular paths which is disjoint from
101+
/// `packages` up above, used in the `load` method down below.
100102
loaded_packages: RefCell<HashMap<PathBuf, Package>>,
101103

102-
// If `true`, then the resolver will ignore any existing `Cargo.lock`
103-
// file. This is set for `cargo install` without `--locked`.
104+
/// If `true`, then the resolver will ignore any existing `Cargo.lock`
105+
/// file. This is set for `cargo install` without `--locked`.
104106
ignore_lock: bool,
105107

106108
/// The resolver behavior specified with the `resolver` field.
107109
resolve_behavior: ResolveBehavior,
110+
/// If `true`, then workspace `rust_version` would be used in `cargo resolve`
111+
/// and other places that use rust version.
112+
/// This is set based on the resolver version, config settings, and CLI flags.
108113
resolve_honors_rust_version: bool,
109114

110115
/// Workspace-level custom metadata

0 commit comments

Comments
 (0)