Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
mitchmindtree opened this issue Jul 22, 2022 · 3 comments

Comments

@mitchmindtree
Copy link
Contributor

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.

mitchmindtree added a commit to mitchmindtree/mdBook that referenced this issue Jul 22, 2022
Surprisingly, this fixes the error filed at rust-lang#1860!

This seems suspicious, perhaps indicative of a bug in Rust's non-lexical
lifetime handling?

The lifetimes in the `handlebars::Renderable::render` method signature
are quite complicated, and its unclear to me whether or not Rust is
catching some new safety edge-case that wasn't previously handled
correctly...

Possibly related to `drop` order, which I *think* is related to the
order of binding statements?
@mitchmindtree
Copy link
Contributor Author

I've opened #1861 that appears to fix this.

I've also opened an issue upstream rust-lang/rust#99591.

@andrewdavidmackenzie
Copy link
Contributor

Just ran into this too, on linux (Ubuntu) only it seems

ehuss added a commit that referenced this issue Jul 22, 2022
…orkaround

Workaround rust nightly borrowcheck error (#1860)
@ehuss
Copy link
Contributor

ehuss commented Jul 22, 2022

Closing fixed by #1860.

@ehuss ehuss closed this as completed Jul 22, 2022
bsilver8192 added a commit to bsilver8192/autocxx that referenced this issue Jul 25, 2022
Grabbing the fix for rust-lang/mdBook#1860,
which is Rust nightly fixing a soundness bug that had a weird
interaction with an mdbook dependency that broke its build.
rubenmoor pushed a commit to rubenmoor/mdBook that referenced this issue Aug 5, 2022
Surprisingly, this fixes the error filed at rust-lang#1860!

This seems suspicious, perhaps indicative of a bug in Rust's non-lexical
lifetime handling?

The lifetimes in the `handlebars::Renderable::render` method signature
are quite complicated, and its unclear to me whether or not Rust is
catching some new safety edge-case that wasn't previously handled
correctly...

Possibly related to `drop` order, which I *think* is related to the
order of binding statements?
steffahn pushed a commit to steffahn/mdBook that referenced this issue Aug 17, 2022
Original commit message:

Workaround rust nightly borrowcheck error (rust-lang#1860)

Surprisingly, this fixes the error filed at rust-lang#1860!

This seems suspicious, perhaps indicative of a bug in Rust's non-lexical
lifetime handling?

The lifetimes in the `handlebars::Renderable::render` method signature
are quite complicated, and its unclear to me whether or not Rust is
catching some new safety edge-case that wasn't previously handled
correctly...

Possibly related to `drop` order, which I *think* is related to the
order of binding statements?
steffahn pushed a commit to steffahn/mdBook that referenced this issue Aug 17, 2022
Surprisingly, this fixes the error filed at rust-lang#1860!

This seems suspicious, perhaps indicative of a bug in Rust's non-lexical
lifetime handling?

The lifetimes in the `handlebars::Renderable::render` method signature
are quite complicated, and its unclear to me whether or not Rust is
catching some new safety edge-case that wasn't previously handled
correctly...

Possibly related to `drop` order, which I *think* is related to the
order of binding statements?
wez added a commit to wez/wezterm that referenced this issue Sep 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants