Skip to content

Commit

Permalink
deps: remove ignore's dependency on crossbeam-utils
Browse files Browse the repository at this point in the history
Scoped threads are now part of std.
  • Loading branch information
BurntSushi committed Jan 5, 2023
1 parent 2f484d8 commit e95254a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion crates/ignore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ name = "ignore"
bench = false

[dependencies]
crossbeam-utils = "0.8.0"
globset = { version = "0.4.10", path = "../globset" }
lazy_static = "1.1"
log = "0.4.5"
Expand Down
7 changes: 3 additions & 4 deletions crates/ignore/src/walk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1282,7 +1282,7 @@ impl WalkParallel {
let quit_now = Arc::new(AtomicBool::new(false));
let num_pending =
Arc::new(AtomicUsize::new(stack.lock().unwrap().len()));
crossbeam_utils::thread::scope(|s| {
std::thread::scope(|s| {
let mut handles = vec![];
for _ in 0..threads {
let worker = Worker {
Expand All @@ -1296,13 +1296,12 @@ impl WalkParallel {
skip: self.skip.clone(),
filter: self.filter.clone(),
};
handles.push(s.spawn(|_| worker.run()));
handles.push(s.spawn(|| worker.run()));
}
for handle in handles {
handle.join().unwrap();
}
})
.unwrap(); // Pass along panics from threads
});
}

fn threads(&self) -> usize {
Expand Down

4 comments on commit e95254a

@OliverGavin
Copy link

@OliverGavin OliverGavin commented on e95254a Jan 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One of my dependencies is using this crate https://crates.io/crates/ignore/0.4.19

Just started getting this issue:

 Compiling ignore v0.4.19
error[E0658]: use of unstable library feature 'scoped_threads'
    --> /usr/local/cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/ignore-0.4.19/src/walk.rs:1285:9
     |
1285 |         std::thread::scope(|s| {
     |         ^^^^^^^^^^^^^^^^^^
     |
     = note: see issue #93203 <https://github.com/rust-lang/rust/issues/93203> for more information

error[E0658]: use of unstable library feature 'scoped_threads'
    --> /usr/local/cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/ignore-0.4.19/src/walk.rs:1299:32
     |
1299 |                 handles.push(s.spawn(|| worker.run()));
     |                                ^^^^^
     |
     = note: see issue #93203 <https://github.com/rust-lang/rust/issues/93203> for more information

error[E0658]: use of unstable library feature 'scoped_threads'
    --> /usr/local/cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/ignore-0.4.19/src/walk.rs:1302:24
     |
1302 |                 handle.join().unwrap();
     |                        ^^^^
     |
     = note: see issue #93203 <https://github.com/rust-lang/rust/issues/93203> for more information

For more information about this error, try `rustc --explain E0658`.
error: could not compile `ignore` due to 3 previous errors
warning: build failed, waiting for other jobs to finish...
error: failed to compile `cargo-chef v0.1.51`, intermediate artifacts can be found at `/tmp/cargo-installs7yTXF`
The command '/bin/sh -c cargo install cargo-chef' returned a non-zero code: 101

Is this crate intended to be unstable only on older rust versions?

@BurntSushi
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scoped threads were added to the standard library in Rust 1.63. You'll need to use at least that version to use the latest release of ignore.

The ignore crate doesn't enable any nightly features, so you can't use an older nightly Rust even if you wanted to.

@OliverGavin
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I was able to update to a newer rust version so i don't have any issues with this.

A lot of crates depend on this one - could a MSRV be set?

@BurntSushi
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has the same MSRV as ripgrep and ripgrep tracks latest Rust stable: https://github.com/BurntSushi/ripgrep/#building

Discussing policy in the comments of a commit message is not great. if you have a specific proposal to make, please open a new issue. Please describe the problem you're trying to solve and what justifies the extra maintenance resources (i.e., my free time) required to satisfy the request.

Please sign in to comment.