feat[ignore]: Always include depth in errors from WalkDir#3458
Merged
Conversation
Include the depth in I/O errors from WalkDir as well, so that the consumer can handle the error differently depending on depth. For example, this would allow ignore broken symlinks that don't match certain depth criteria. Fixes: BurntSushi#3453
tmccombs
added a commit
to tmccombs/fd
that referenced
this pull request
Jul 1, 2026
use `ignore::Error::io_error()` to inspect the `std::io::Error` insted of pattern matching on `ignore::Error::Io`. This avoids relying on the implementation of ignore and how it organizes the error. In particular, this would allow us to handle if the IO error was wrapped in a `WithDepth`, as would be the case if BurntSushi/ripgrep#3458 was merged. This also allows us to remove some duplicate code.
BurntSushi
approved these changes
Jul 1, 2026
BurntSushi
left a comment
Owner
There was a problem hiding this comment.
OK let's see what happens!
Note that I would suggest writing your code in a way that doesn't care about the nesting order.
(I want to re-iterate how terrible of a design this is for an error. I don't know what I was thinking.)
Owner
|
This PR is on crates.io in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Include the depth in I/O errors from WalkDir as well, so that the consumer can handle the error differently depending on depth. For example, this would allow ignore broken symlinks that don't match certain depth criteria.
Fixes: #3453