Closed as not planned
Description
As of rustc 1.64.0-nightly (62b272d25 2022-07-21)
, a new lifetime error has appeared when attempting to build mdbook
0.4.20
.
Error
error[E0597]: `local_ctx` does not live long enough
--> src/renderer/html_handlebars/helpers/navigation.rs:154:25
|
154 | t.render(r, &local_ctx, &mut local_rc, out)
| ^^^^^^^^^^ borrowed value does not live long enough
155 | })?;
| -
| |
| `local_ctx` dropped here while still borrowed
| borrow might be used here, when `local_rc` is dropped and runs the destructor for type `handlebars::RenderContext<'_, '_>`
|
= note: values in a scope are dropped in the opposite order they are defined
For more information about this error, try `rustc --explain E0597`.
error: could not compile `mdbook` due to previous error
Version it worked on
rustc 1.64.0-nightly (d68e7eb 2022-07-20)
Version with regression
rustc 1.64.0-nightly (62b272d 2022-07-21)
Details
You can find more details at the downstream mdbook
issue rust-lang/mdBook#1860.
Curiously, the new error can be fixed by re-ordering some seemingly inocuous statements - see this PR rust-lang/mdBook#1861.
Perhaps this is indicative of an error in non-lexical-lifetime handling on the latest nightly? Or alternatively, this could be the result of fixing a soundness / safety issue related to the interop between lifetimes and drop order?
This error was originally discovered in an unrelated CI pass failing in the following PR: FuelLabs/sway#2359.