@@ -201,7 +201,7 @@ pub trait Program<'t>: Pattern<'t, Error = Infallible> {
201201 /// # Examples
202202 ///
203203 /// Text variance can be used to determine if a pattern can be trivially represented by an
204- /// equivalent path using platform file system APIs.
204+ /// equivalent native path using platform file system APIs.
205205 ///
206206 /// ```rust
207207 /// use std::path::Path;
@@ -220,22 +220,24 @@ pub trait Program<'t>: Pattern<'t, Error = Infallible> {
220220 /// A glob expression that begins with a separator `/` has a root, but less trivial patterns
221221 /// like `/**` and `</root:1,>` can also root an expression. Some `Program` types may have
222222 /// indeterminate roots and may match both candidate paths with and without a root. In this
223- /// case, this functions returns [`Sometimes`] (indeterminate) .
223+ /// case, this functions returns [`Sometimes`].
224224 ///
225225 /// [`Sometimes`]: crate::query::When::Sometimes
226226 fn has_root ( & self ) -> When ;
227227
228- /// Returns `true` if the pattern is exhaustive .
228+ /// Describes when the pattern matches candidate paths exhaustively .
229229 ///
230230 /// A glob expression is exhaustive if, given a matched candidate path, it necessarily matches
231- /// any and all sub-trees of that path. For example, glob expressions that end with a tree
232- /// wildcard like `.local/**` are exhaustive, but so are less trivial expressions like `<<?>/>`
233- /// and `<doc/<*/:3,>>`. This can be an important property when determining what directory
234- /// trees to read or which files and directories to select with a pattern.
231+ /// any and all sub-trees of that path. For example, given the pattern `.local/**` and the
232+ /// matched path `.local/bin`, any and all paths beneath `.local/bin` also match the pattern.
235233 ///
236- /// Note that this applies to the **pattern** and **not** to a particular match. It is possible
237- /// for a particular match against a **non**exhaustive pattern to be exhaustive.
238- fn is_exhaustive ( & self ) -> bool ;
234+ /// Patterns that end with tree wildcards are more obviously exhaustive, but less trivial
235+ /// patterns like `<<?>/>`, `<doc/<*/:3,>>`, and `{a/**,b/**}` can also be exhaustive. Patterns
236+ /// with alternations may only be exhaustive for some matched paths. In this case, this
237+ /// function returns [`Sometimes`].
238+ ///
239+ /// [`Sometimes`]: crate::query::When::Sometimes
240+ fn is_exhaustive ( & self ) -> When ;
239241}
240242
241243/// General errors concerning [`Program`]s.
@@ -758,7 +760,7 @@ impl<'t> Program<'t> for Glob<'t> {
758760 self . tree . as_ref ( ) . as_token ( ) . has_root ( )
759761 }
760762
761- fn is_exhaustive ( & self ) -> bool {
763+ fn is_exhaustive ( & self ) -> When {
762764 self . tree . as_ref ( ) . as_token ( ) . is_exhaustive ( )
763765 }
764766}
@@ -817,7 +819,7 @@ impl<'t> Program<'t> for Any<'t> {
817819 self . tree . as_ref ( ) . as_token ( ) . has_root ( )
818820 }
819821
820- fn is_exhaustive ( & self ) -> bool {
822+ fn is_exhaustive ( & self ) -> When {
821823 self . tree . as_ref ( ) . as_token ( ) . is_exhaustive ( )
822824 }
823825}
0 commit comments