Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

address issues from by latest regex update #671

Merged

Conversation

bmc-msft
Copy link
Contributor

This PR addresses an issue exposed when updating to the latest regex version.

Prior to this PR, the latest regex would give the following error:

error[E0597]: `re` does not live long enough
   --> onefuzz/src/libfuzzer.rs:214:15
    |
214 |         match re.captures_iter(&output_text).next() {
    |               ^^----------------------------
    |               |
    |               borrowed value does not live long enough
    |               a temporary with access to the borrow is created here ...
...
228 |     }
    |     -
    |     |
    |     `re` 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
    |
214 |         let x = match re.captures_iter(&output_text).next() {
215 |             Some(captures) => {
216 |                 let added_files_count = captures.get(1).unwrap().as_str().parse::<i32>().unwrap();
217 |                 let added_feature_count = captures.get(2).unwrap().as_str().parse::<i32>().unwrap();
218 |                 Ok(LibFuzzerMergeOutput {
219 |                     added_files_count,
  ...

@bmc-msft bmc-msft mentioned this pull request Mar 12, 2021
src/agent/onefuzz/src/libfuzzer.rs Outdated Show resolved Hide resolved
@ghost
Copy link

ghost commented Mar 12, 2021

Hello @bmc-msft!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

Do note that I've been instructed to only help merge pull requests of this repository that have been opened for at least 18 hours, a condition that will be fulfilled in about 12 hours 46 minutes. No worries though, I will be back when the time is right! 😉

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@bmc-msft bmc-msft merged commit 32cc2e7 into microsoft:main Mar 12, 2021
@bmc-msft bmc-msft deleted the update-third-party-rust-2021-03-12-01 branch March 12, 2021 20:16
@ghost ghost locked as resolved and limited conversation to collaborators Apr 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants