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

Build issue #2

Open
vit1251 opened this issue May 16, 2023 · 2 comments
Open

Build issue #2

vit1251 opened this issue May 16, 2023 · 2 comments

Comments

@vit1251
Copy link

vit1251 commented May 16, 2023

error[E0597]: `version_regex` does not live long enough
  --> ~/.cargo/registry/src/github.com-1ecc6299db9ec823/os_info-1.3.3/src/linux/file_release.rs:36:13
   |
34 |               let version_regex = Regex::new(release_info.version_regex).unwrap();
   |                   ------------- binding `version_regex` declared here
35 |
36 | /             version_regex
37 | |                 .captures_iter(&file_content)
   | |                                             ^
   | |                                             |
   | |_____________________________________________borrowed value does not live long enough
   |                                               a temporary with access to the borrow is created here ...
...
41 |           } else {
   |           -
   |           |
   |           `version_regex` dropped here while still borrowed
   |           ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `regex::CaptureMatches<'_, '_>`
   |
   = note: the temporary is part of an expression at the end of a block;
           consider forcing this temporary to be dropped sooner, before the block's local variables are dropped
help: for example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block
   |
36 ~             let x = version_regex
37 |                 .captures_iter(&file_content)
38 |                 .next()
39 |                 .and_then(|c| c.get(1))
40 ~                 .map(|v| v.as_str().trim_end().to_owned()); x
   |

@Charles-Schleich
Copy link
Owner

Charles-Schleich commented May 19, 2023

Hello,

This looks like an issue inside os_info

I have bumped the deps, and can confirm that this is building using
rustc 1.69.0 (84c898d65 2023-04-16)

Let me know if you are still experiencing issues.

@vit1251
Copy link
Author

vit1251 commented May 23, 2023

@Charles-Schleich thanks. Why you does not use common Rust configure macro to determine target platform:

if cfg!(target_os = "macos") {
  ...
}

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

No branches or pull requests

2 participants