Skip to content

Commit f17fd7b

Browse files
committed
Add some doc comments regarding PathSet.
1 parent c2b920f commit f17fd7b

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

src/bootstrap/builder.rs

+25-3
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,21 @@ struct StepDescription {
9797
name: &'static str,
9898
}
9999

100+
/// Collection of paths used to match a task rule.
100101
#[derive(Debug, Clone, PartialOrd, Ord, PartialEq, Eq)]
101102
pub enum PathSet {
103+
/// A collection of individual paths.
104+
///
105+
/// These are generally matched as a path suffix. For example, a
106+
/// command-line value of `libstd` will match if `src/libstd` is in the
107+
/// set.
102108
Set(BTreeSet<PathBuf>),
109+
/// A "suite" of paths.
110+
///
111+
/// These can match as a path suffix (like `Set`), or as a prefix. For
112+
/// example, a command-line value of `src/test/ui/abi/variadic-ffi.rs`
113+
/// will match `src/test/ui`. A command-line value of `ui` would also
114+
/// match `src/test/ui`.
103115
Suite(PathBuf),
104116
}
105117

@@ -249,9 +261,15 @@ impl<'a> ShouldRun<'a> {
249261
self
250262
}
251263

252-
// Unlike `krate` this will create just one pathset. As such, it probably shouldn't actually
253-
// ever be used, but as we transition to having all rules properly handle passing krate(...) by
254-
// actually doing something different for every crate passed.
264+
/// Indicates it should run if the command-line selects the given crate or
265+
/// any of its (local) dependencies.
266+
///
267+
/// Compared to `krate`, this treats the dependencies as aliases for the
268+
/// same job. Generally it is preferred to use `krate`, and treat each
269+
/// individual path separately. For example `./x.py test src/liballoc`
270+
/// (which uses `krate`) will test just `liballoc`. However, `./x.py check
271+
/// src/liballoc` (which uses `all_krates`) will check all of `libtest`.
272+
/// `all_krates` should probably be removed at some point.
255273
pub fn all_krates(mut self, name: &str) -> Self {
256274
let mut set = BTreeSet::new();
257275
for krate in self.builder.in_tree_crates(name) {
@@ -262,6 +280,10 @@ impl<'a> ShouldRun<'a> {
262280
self
263281
}
264282

283+
/// Indicates it should run if the command-line selects the given crate or
284+
/// any of its (local) dependencies.
285+
///
286+
/// `make_run` will be called separately for each matching command-line path.
265287
pub fn krate(mut self, name: &str) -> Self {
266288
for krate in self.builder.in_tree_crates(name) {
267289
let path = krate.local_path(self.builder);

0 commit comments

Comments
 (0)