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

long error explanation for E0313 #103433

Closed
wants to merge 2 commits into from

Conversation

bindsdev
Copy link
Contributor

@bindsdev bindsdev commented Oct 23, 2022

part of #61137

@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 23, 2022
@rust-highfive
Copy link
Collaborator

r? @oli-obk

(rust-highfive has picked a reviewer for you, use r? to override)

@rustbot
Copy link
Collaborator

rustbot commented Oct 23, 2022

Some changes occurred in diagnostic error codes

cc @GuillaumeGomez

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 23, 2022
@bindsdev
Copy link
Contributor Author

r? @GuillaumeGomez

@GuillaumeGomez
Copy link
Member

Formatting looks good to me, thanks! I'll let someone else confirm the content of the explanation.

@bindsdev
Copy link
Contributor Author

Formatting looks good to me, thanks! I'll let someone else confirm the content of the explanation.

Great, thank you!

@rust-log-analyzer
Copy link
Collaborator

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

Click to see the possible cause of the failure (guessed by this bot)
Testing error-index stage2
doc tests for: /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md


command did not execute successfully: "/checkout/obj/build/bootstrap/debug/rustdoc" "-Wrustdoc::invalid_codeblock_attributes" "-Dwarnings" "-Znormalize-docs" "-Z" "unstable-options" "--test" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md" "--test-args" ""

stdout ----

running 1047 tests
---
---- /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md - Rust_Compiler_Error_Index::E0313 (line 5591) stdout ----
error: lifetime may not live long enough
 --> /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:5593:8
  |
4 |     || foo(bar);
  |     -- ^^^^^^^^ argument requires that `'1` must outlive `'static`
  |     |
  |     lifetime `'1` represents this closure's body
  |
  = note: closure implements `FnMut`, so references to captured variables can't escape the closure

error[E0597]: `bar` does not live long enough
  |
  |
4 |     || foo(bar);
  |     -- ----^^^-
  |     |  |   |
  |     |  |   borrowed value does not live long enough
  |     |  argument requires that `bar` is borrowed for `'static`
5 | }
5 | }
  |  - `bar` dropped here while still borrowed
error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0597`.
For more information about this error, try `rustc --explain E0597`.
Some expected error codes were not found: ["E0313"]
---- /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md - Rust_Compiler_Error_Index::E0313 (line 5622) stdout ----
error: lifetime may not live long enough
  |
  |
4 |     move || foo(bar);
  |     ------- ^^^^^^^^ argument requires that `'1` must outlive `'static`
  |     |
  |     lifetime `'1` represents this closure's body
  |
  = note: closure implements `FnMut`, so references to captured variables can't escape the closure
error: aborting due to previous error

Couldn't compile the test.

@bindsdev
Copy link
Contributor Author

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

Click to see the possible cause of the failure (guessed by this bot)

Testing error-index stage2
doc tests for: /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md


command did not execute successfully: "/checkout/obj/build/bootstrap/debug/rustdoc" "-Wrustdoc::invalid_codeblock_attributes" "-Dwarnings" "-Znormalize-docs" "-Z" "unstable-options" "--test" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md" "--test-args" ""

stdout ----

running 1047 tests
---
---- /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md - Rust_Compiler_Error_Index::E0313 (line 5591) stdout ----
error: lifetime may not live long enough
 --> /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:5593:8
  |
4 |     || foo(bar);
  |     -- ^^^^^^^^ argument requires that `'1` must outlive `'static`
  |     |
  |     lifetime `'1` represents this closure's body
  |
  = note: closure implements `FnMut`, so references to captured variables can't escape the closure

error[E0597]: `bar` does not live long enough
  |
  |
4 |     || foo(bar);
  |     -- ----^^^-
  |     |  |   |
  |     |  |   borrowed value does not live long enough
  |     |  argument requires that `bar` is borrowed for `'static`
5 | }
5 | }
  |  - `bar` dropped here while still borrowed
error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0597`.
For more information about this error, try `rustc --explain E0597`.
Some expected error codes were not found: ["E0313"]
---- /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md - Rust_Compiler_Error_Index::E0313 (line 5622) stdout ----
error: lifetime may not live long enough
  |
  |
4 |     move || foo(bar);
  |     ------- ^^^^^^^^ argument requires that `'1` must outlive `'static`
  |     |
  |     lifetime `'1` represents this closure's body
  |
  = note: closure implements `FnMut`, so references to captured variables can't escape the closure
error: aborting due to previous error

Couldn't compile the test.

@GuillaumeGomez it seems like, according to the error log, that E0313 error code wasn't produced and E0597 instead was produced. Does this mean E0313 is not produced by the compiler anymore? How could I fix this or is this error out of my control with the code I write?

@GuillaumeGomez
Copy link
Member

It's still produced by the compiler here. The difficult part of writing error explanation is to be able to actually trigger the error. In this case, you have the full control of the erroneous code example you write. ;)

@apiraino
Copy link
Contributor

Hello, checking status. If I read it correctly this is waiting on #103742? I'll tentatively switch review status to signal this.

Feel free to request a review when it's appropriate with @rustbot ready, thanks!

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 29, 2022
@bindsdev
Copy link
Contributor Author

Hello, checking status. If I read it correctly this is waiting on #103742? I'll tentatively switch review status to signal this.

Feel free to request a review when it's appropriate with @rustbot ready, thanks!

@rustbot author

Correct. I explained my situation here to other contributors and maintainers on the Rust community Discord server and they suggested that deprecation of the error code might be the proper solution. The issue you referenced explains a bit more. If deprecation is decided upon, then this PR will no longer have significance.

@bors
Copy link
Contributor

bors commented Dec 20, 2022

☔ The latest upstream changes (presumably #105940) made this pull request unmergeable. Please resolve the merge conflicts.

@Ezrashaw
Copy link
Contributor

Ezrashaw commented Jan 8, 2023

@akabinds I believe that this can now be closed, E0313 has been removed.

JohnTitor pushed a commit to JohnTitor/rust that referenced this pull request Jan 8, 2023
…errors

remove unreachable error code `E0313`

Fixes rust-lang#103742
Makes rust-lang#103433 redundant

Implements removal of `E0313`. I agree with the linked issue that this error code is unreachable but if someone could confirm that would be great, are crater runs done for this sort of thing?

Also removed a redundant `// ignore-tidy-filelength` that I found while reading code.

cc `@GuillaumeGomez` rust-lang#61137
JohnTitor pushed a commit to JohnTitor/rust that referenced this pull request Jan 8, 2023
…errors

remove unreachable error code `E0313`

Fixes rust-lang#103742
Makes rust-lang#103433 redundant

Implements removal of `E0313`. I agree with the linked issue that this error code is unreachable but if someone could confirm that would be great, are crater runs done for this sort of thing?

Also removed a redundant `// ignore-tidy-filelength` that I found while reading code.

cc ``@GuillaumeGomez`` rust-lang#61137
@bindsdev
Copy link
Contributor Author

bindsdev commented Jan 8, 2023

@akabinds I believe that this can now be closed, E0313 has been removed.

Great. Thank you!

@bindsdev bindsdev closed this Jan 8, 2023
@bindsdev bindsdev deleted the ec0313-long-explanation branch January 17, 2023 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants