Skip to content

"local_ctx does not live long enough" compilation error on rustc 1.64.0-nightly (62b272d25 2022-07-21) #1860

Closed
@mitchmindtree

Description

@mitchmindtree

First noticed downstream in one of our CI passes here, it appears the latest nightly has trouble building mdbook.

This includes all versions at least from 0.4.19 through to the current HEAD of master.

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

The issue appears to have been introduced in the latest nightly (rustc 1.64.0-nightly (62b272d25 2022-07-21)) as the previous nightly (rustc 1.64.0-nightly (d68e7ebc3 2022-07-20)) builds successfully.

Yet to dig in to what's going on here, but just thought I'd open an issue to track this first.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions