pop-os / system76-scheduler

Auto-configure CFS and process priorities for improved desktop responsiveness
Mozilla Public License 2.0
545 stars 33 forks source link

Update `generator` to 0.8 #116

Open moui0 opened 4 months ago

moui0 commented 4 months ago

generator has added support for more arch and platforms since 0.8. Updating the dependency allows the project to be built on more platforms.

Unfortunately, I have no idea how to update to version 0.8 without changing the existing API since generator::Gn::new_scoped only allowed to borrow 'static data: https://github.com/Xudong-Huang/generator-rs/issues/49

error[E0521]: borrowed data escapes outside of function
  --> config/src/lib.rs:50:5
   |
46 |   pub fn configuration_files<'a>(
   |                              -- lifetime `'a` defined here
47 |       paths: &'a [&str],
   |       ----- `paths` is a reference that is only valid in the function body
...
50 | /     generator::Gn::new_scoped(move |mut scope| {
51 | |         for directory in paths {
52 | |             if let Ok(dir) = std::fs::read_dir(directory) {
53 | |                 for entry in dir.filter_map(Result::ok) {
...  |
63 | |         generator::done!()
64 | |     })
   | |      ^
   | |      |
   | |______`paths` escapes the function body here
   |        argument requires that `'a` must outlive `'static`
   |
   = note: requirement occurs because of the type `generator::Scope<'_, '_, (), std::string::String>`, which makes the generic argument `'_` invariant
   = note: the struct `generator::Scope<'scope, 'a, A, T>` is invariant over the parameter `'scope`
   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance

error[E0521]: borrowed data escapes outside of function
  --> config/src/lib.rs:50:5
   |
47 |       paths: &'a [&str],
   |       -----       - let's call the lifetime of this reference `'1`
   |       |
   |       `paths` is a reference that is only valid in the function body
...
50 | /     generator::Gn::new_scoped(move |mut scope| {
51 | |         for directory in paths {
52 | |             if let Ok(dir) = std::fs::read_dir(directory) {
53 | |                 for entry in dir.filter_map(Result::ok) {
...  |
63 | |         generator::done!()
64 | |     })
   | |      ^
   | |      |
   | |______`paths` escapes the function body here
   |        argument requires that `'1` must outlive `'static`
   |
   = note: requirement occurs because of the type `generator::Scope<'_, '_, (), std::string::String>`, which makes the generic argument `'_` invariant
   = note: the struct `generator::Scope<'scope, 'a, A, T>` is invariant over the parameter `'scope`
   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance

help: replace `'a` with `'static`

For more information about this error, try `rustc --explain E0521`.
error: could not compile `system76-scheduler-config` (lib) due to 2 previous errors
error: Recipe `build-debug` failed on line 39 with exit code 101