Skip to content

Conversation

@csmoe
Copy link
Contributor

@csmoe csmoe commented May 29, 2023

Closes #112056
r? @lcnr

Clashed with lcnr's fix almost at the same time, and their patch seems more reasonable.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 29, 2023
@csmoe csmoe closed this May 29, 2023
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-14 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
normalized stderr: error[E0521]: borrowed data escapes outside of closure --> $DIR/issue-112056.rs:11:17 | LL | fn create_self_reference<'a>(&'a mut self) { | ------------ `self` declared here, outside of the closure body ... LL | self.borrowed = borrow; error[E0597]: `self` does not live long enough --> $DIR/issue-112056.rs:11:17 | | LL | impl<'b> Spooky<'b> { | -- lifetime `'b` defined here LL | fn create_self_reference<'a>(&'a mut self) { LL | let mut closure = || { | -- value captured here ... LL | self.borrowed = borrow; | | | borrowed value does not live long enough | borrowed value does not live long enough | assignment requires that `self` is borrowed for `'b` LL | } LL | } | - `self` dropped here while still borrowed error: lifetime may not live long enough --> $DIR/issue-112056.rs:11:17 | | LL | impl<'b> Spooky<'b> { | -- lifetime `'b` defined here LL | fn create_self_reference<'a>(&'a mut self) { | -- lifetime `'a` defined here ... LL | self.borrowed = borrow; | ^^^^^^^^^^^^^^^^^^^^^^ assignment requires that `'a` must outlive `'b` | = help: consider adding the following bound: `'a: 'b` error: aborting due to 3 previous errors Some errors have detailed explanations: E0521, E0597. For more information about an error, try `rustc --explain E0521`. --- To only update this specific test, also pass `--test-args mir/issue-112056.rs` error: 1 errors occurred comparing output. status: exit status: 1 command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/mir/issue-112056.rs" "-Zthreads=1" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Zdeduplicate-diagnostics=no" "-Cstrip=debuginfo" "--remap-path-prefix=/checkout/tests/ui=fake-test-src-base" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/mir/issue-112056" "-A" "unused" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/mir/issue-112056/auxiliary" stdout: none error[E0521]: borrowed data escapes outside of closure --> fake-test-src-base/mir/issue-112056.rs:11:17 | | LL | fn create_self_reference<'a>(&'a mut self) { | ------------ `self` declared here, outside of the closure body ... LL | self.borrowed = borrow; error[E0597]: `self` does not live long enough --> fake-test-src-base/mir/issue-112056.rs:11:17 | | LL | impl<'b> Spooky<'b> { | -- lifetime `'b` defined here LL | fn create_self_reference<'a>(&'a mut self) { LL | let mut closure = || { | -- value captured here ... LL | self.borrowed = borrow; | | | borrowed value does not live long enough | borrowed value does not live long enough | assignment requires that `self` is borrowed for `'b` LL | } LL | } | - `self` dropped here while still borrowed error: lifetime may not live long enough --> fake-test-src-base/mir/issue-112056.rs:11:17 | | LL | impl<'b> Spooky<'b> { | -- lifetime `'b` defined here LL | fn create_self_reference<'a>(&'a mut self) { | -- lifetime `'a` defined here ... LL | self.borrowed = borrow; | ^^^^^^^^^^^^^^^^^^^^^^ assignment requires that `'a` must outlive `'b` | = help: consider adding the following bound: `'a: 'b` error: aborting due to 3 previous errors Some errors have detailed explanations: E0521, E0597. For more information about an error, try `rustc --explain E0521`. 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

4 participants