pub fn locations(&self) -> impl Iterator<Item = &dyn LocatedError> {
        let locations: Vec<_> = match self.kind {
            BuildErrorKind::Parse(ref error) => error
                .locations()
                .iter()
                .map(|location| location as &dyn LocatedError)
                .collect(),
            BuildErrorKind::Rule(ref error) => error
                .locations()
                .iter()
                .map(|location| location as &dyn LocatedError)
                .collect(),
            _ => vec![],
        };
        locations.into_iter()
    }
Gets [`LocatedError`]s detailing the errors within a glob expression.

This function returns an [`Iterator`] over the [`LocatedError`]s that
detail where and why an error occurred when the error has associated
[`Span`]s within a glob expression. For errors with no such
associated information, the [`Iterator`] yields no items, such as
compilation errors.

# Examples

[`LocatedError`]s can be used to provide information to users about
which parts of a glob expression are associated with an error.

```rust
use wax::Glob;

// This glob expression violates rules. The error handling code prints details about the
// alternative where the violation occurred.
let expression = "**/{foo,**/bar,baz}";
match Glob::new(expression) {
Ok(glob) => {
// ...
},
Err(error) => {
eprintln!("{}", error);
for error in error.locations() {
let (start, n) = error.span();
let fragment = &expression[start..][..n];
eprintln!("in sub-expression `{}`: {}", fragment, error);
}
},
}
```

[`Glob`]: crate::Glob
[`Glob::partition`]: crate::Glob::partition
[`Iterator`]: std::iter::Iterator
[`LocatedError`]: crate::LocatedError
[`Span`]: crate::Span
crates/turborepo-wax/src/lib.rs