@@ -46,65 +46,70 @@ use pathdiff::diff_paths;
46
46
/// package is loaded and/or learned about.
47
47
#[ derive( Debug ) ]
48
48
pub struct Workspace < ' gctx > {
49
+ /// Cargo configuration information. See [`GlobalContext`].
49
50
gctx : & ' gctx GlobalContext ,
50
51
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.
54
55
current_manifest : PathBuf ,
55
56
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`.
58
59
packages : Packages < ' gctx > ,
59
60
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]`.
64
65
root_manifest : Option < PathBuf > ,
65
66
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.
68
69
target_dir : Option < Filesystem > ,
69
70
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.
73
74
members : Vec < PathBuf > ,
75
+ /// Set of ids of workspace members
74
76
member_ids : HashSet < PackageId > ,
75
77
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.
86
88
default_members : Vec < PathBuf > ,
87
89
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.
90
92
is_ephemeral : bool ,
91
93
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.
96
98
require_optional_deps : bool ,
97
99
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.
100
102
loaded_packages : RefCell < HashMap < PathBuf , Package > > ,
101
103
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`.
104
106
ignore_lock : bool ,
105
107
106
108
/// The resolver behavior specified with the `resolver` field.
107
109
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.
108
113
resolve_honors_rust_version : bool ,
109
114
110
115
/// Workspace-level custom metadata
0 commit comments