Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update generator to 0.8 #116

Closed
moui0 opened this issue Jun 10, 2024 · 0 comments · Fixed by #120
Closed

Update generator to 0.8 #116

moui0 opened this issue Jun 10, 2024 · 0 comments · Fixed by #120

Comments

@moui0
Copy link

moui0 commented Jun 10, 2024

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: Xudong-Huang/generator-rs#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

hack3ric added a commit to hack3ric/system76-scheduler that referenced this issue Nov 19, 2024
Fixes pop-os#116. Since currently config::configuration_files is only used with 'static, we change all of its lifetime to 'static.

Ref: Xudong-Huang/generator-rs#49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant