You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Latest nightly (rustc 1.64.0-nightly (62b272d25 2022-07-21)) introduces a new borrowcheck error in previously compiling mdbook0.4.20 #99591
As of rustc 1.64.0-nightly (62b272d25 2022-07-21), a new lifetime error has appeared when attempting to build mdbook0.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
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.
I think the error here is correct and #99413 is a valid fix. It's just a consequence of how the lifetimes in the handlebars crate are defined that cause the error.
@Jules-Bertholet changed the label to regression on stable: did you experience that it's still an issue? I've compiled mdbook (both on stable and nightly) and the reproducible at this comment now shows a better error, I believe.
Activity
ehuss commentedon Jul 22, 2022
Confirmed that it is caused by #99413. Here is a slightly smaller repro:
I think the error here is correct and #99413 is a valid fix. It's just a consequence of how the lifetimes in the handlebars crate are defined that cause the error.
danielhenrymantilla commentedon Jul 22, 2022
Until the fix to
mdbookis officially released, btw, for those running into this, the workaround is to use thegitdev, potentially as apatch:for those using
cargo install mdbook, instead, dofor those depending on
mdbookas a library, on theCargo.tomlfile of your workspace (where theCargo.lockfile lies / is generated), add:Jules-Bertholet commentedon Jun 10, 2023
@rustbot label -regression-untriaged +regression-from-stable-to-stable
apiraino commentedon Jun 21, 2023
@Jules-Bertholet changed the label to regression on stable: did you experience that it's still an issue? I've compiled
mdbook(both on stable and nightly) and the reproducible at this comment now shows a better error, I believe.ehuss commentedon Jun 21, 2023
I think this should be closed since it was an intentional soundness fix.