Skip to content

Fix 'dangling_pointers_from_temporaries' warning in test#3491

Merged
stevenengler merged 1 commit intoshadow:mainfrom
stevenengler:test-rust-1.84
Jan 13, 2025
Merged

Fix 'dangling_pointers_from_temporaries' warning in test#3491
stevenengler merged 1 commit intoshadow:mainfrom
stevenengler:test-rust-1.84

Conversation

@stevenengler
Copy link
Copy Markdown
Contributor

This is a new warning in rust 1.84.

There are two warnings of the form:

warning: a dangling pointer will be produced because the temporary `Vec<*const i8>` will be dropped
    --> test/clone/test_fork.rs:1825:55
     |
1825 |                         in("rsi") execv_argvec(&args).as_ptr(),
     |                                   ------------------- ^^^^^^ this pointer will immediately be invalid
     |                                   |
     |                                   this `Vec<*const i8>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
     |
     = note: pointers do not have a lifetime; when calling `as_ptr` the `Vec<*const i8>` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
     = help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
     = note: `#[warn(dangling_pointers_from_temporaries)]` on by default

@stevenengler stevenengler self-assigned this Jan 13, 2025
@github-actions github-actions bot added the Component: Testing Unit and integration tests and frameworks label Jan 13, 2025
@stevenengler stevenengler changed the title Fix 'dangling_pointers_from_temporaries' warning Fix 'dangling_pointers_from_temporaries' warning in test Jan 13, 2025
@github-actions github-actions bot added the Component: Documentation In-repository documentation, under docs/ label Jan 13, 2025
This is a new warning in rust 1.84.

There are two warnings of the form:

```text
warning: a dangling pointer will be produced because the temporary `Vec<*const i8>` will be dropped
    --> test/clone/test_fork.rs:1825:55
     |
1825 |                         in("rsi") execv_argvec(&args).as_ptr(),
     |                                   ------------------- ^^^^^^ this pointer will immediately be invalid
     |                                   |
     |                                   this `Vec<*const i8>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
     |
     = note: pointers do not have a lifetime; when calling `as_ptr` the `Vec<*const i8>` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
     = help: for more information, see <https://doc.rust-lang.org/reference/destructors.html>
     = note: `#[warn(dangling_pointers_from_temporaries)]` on by default
```
@stevenengler stevenengler merged commit 916f80e into shadow:main Jan 13, 2025
@stevenengler stevenengler deleted the test-rust-1.84 branch January 13, 2025 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: Documentation In-repository documentation, under docs/ Component: Testing Unit and integration tests and frameworks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants