Commit d1f567f
authored
Fix lifetime warning in Rust 1.70 (#352)
* Fix lifetime warning in Rust 1.70
Starting with rustc 1.70.0, the code in raw.rs:hash_get_multi produced the
following warnings:
this `CString` is deallocated at the end of the statement, bind it to a
variable to extend its lifetime
While it would work in practice due to the underlying implementation just
doing pointer juggling, this warning was correct: The CString created within
the macro `f` would be destroyed before the reference to the pointer taken
from it with `as_ptr` was used.
Resolved by binding the lifetime of the CStrings to that of the iterator
variable, which is alive until the function returns.
* Proper fix this time (hopefully)1 parent eefacd3 commit d1f567f
1 file changed
+6
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
473 | 473 | | |
474 | 474 | | |
475 | 475 | | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
476 | 481 | | |
477 | 482 | | |
478 | 483 | | |
| |||
491 | 496 | | |
492 | 497 | | |
493 | 498 | | |
494 | | - | |
495 | | - | |
496 | | - | |
| 499 | + | |
497 | 500 | | |
498 | 501 | | |
499 | 502 | | |
| |||
0 commit comments