Skip to content

Make obligation cause code suggestions verbose #142045

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

Merged
merged 1 commit into from
Jun 7, 2025

Conversation

estebank
Copy link
Contributor

@estebank estebank commented Jun 4, 2025

error[E0277]: `()` is not a future
  --> $DIR/unnecessary-await.rs:28:10
   |
LL |     e!().await;
   |          ^^^^^ `()` is not a future
   |
   = help: the trait `Future` is not implemented for `()`
   = note: () must be a future or must implement `IntoFuture` to be awaited
   = note: required for `()` to implement `IntoFuture`
help: remove the `.await`
   |
LL -     e!().await;
LL +     e!();
   |
error[E0277]: the trait bound `String: Copy` is not satisfied
  --> $DIR/const-fn-in-vec.rs:1:47
   |
LL | static _MAYBE_STRINGS: [Option<String>; 5] = [None; 5];
   |                                               ^^^^ the trait `Copy` is not implemented for `String`
   |
   = note: required for `Option<String>` to implement `Copy`
   = note: the `Copy` trait is required because this value will be copied for each element of the array
help: create an inline `const` block
   |
LL | static _MAYBE_STRINGS: [Option<String>; 5] = [const { None }; 5];
   |                                               +++++++      +

Part of #141973

@rustbot
Copy link
Collaborator

rustbot commented Jun 4, 2025

r? @wesleywiser

rustbot has assigned @wesleywiser.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 4, 2025
@estebank estebank force-pushed the obligation-cause-code-suggestion branch from 6b4364a to 3ca4732 Compare June 4, 2025 21:40
@estebank estebank changed the title Obligation cause code suggestion Make obligation cause code suggestions verbose Jun 4, 2025
Copy link
Member

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls convert the semicolon removal suggestion to hidden, then r=me

|
= help: the trait `std::fmt::Display` is not implemented for `()`
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
help: remove this semicolon
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be hidden. I don't think showing the user how to remove a semicolon is particularly useful 😅

```
error[E0277]: `()` is not a future
  --> $DIR/unnecessary-await.rs:28:10
   |
LL |     e!().await;
   |          ^^^^^ `()` is not a future
   |
   = help: the trait `Future` is not implemented for `()`
   = note: () must be a future or must implement `IntoFuture` to be awaited
   = note: required for `()` to implement `IntoFuture`
help: remove the `.await`
   |
LL -     e!().await;
LL +     e!();
   |
```
```
error[E0277]: the trait bound `String: Copy` is not satisfied
  --> $DIR/const-fn-in-vec.rs:1:47
   |
LL | static _MAYBE_STRINGS: [Option<String>; 5] = [None; 5];
   |                                               ^^^^ the trait `Copy` is not implemented for `String`
   |
   = note: required for `Option<String>` to implement `Copy`
   = note: the `Copy` trait is required because this value will be copied for each element of the array
help: create an inline `const` block
   |
LL | static _MAYBE_STRINGS: [Option<String>; 5] = [const { None }; 5];
   |                                               +++++++      +
```
@estebank estebank force-pushed the obligation-cause-code-suggestion branch from 3ca4732 to ac980ca Compare June 6, 2025 20:12
@estebank
Copy link
Contributor Author

estebank commented Jun 6, 2025

@bors r=compiler-errors

@bors
Copy link
Collaborator

bors commented Jun 6, 2025

📌 Commit ac980ca has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 6, 2025
@compiler-errors
Copy link
Member

@bors rollup

jhpratt added a commit to jhpratt/rust that referenced this pull request Jun 7, 2025
…gestion, r=compiler-errors

Make obligation cause code suggestions verbose

```
error[E0277]: `()` is not a future
  --> $DIR/unnecessary-await.rs:28:10
   |
LL |     e!().await;
   |          ^^^^^ `()` is not a future
   |
   = help: the trait `Future` is not implemented for `()`
   = note: () must be a future or must implement `IntoFuture` to be awaited
   = note: required for `()` to implement `IntoFuture`
help: remove the `.await`
   |
LL -     e!().await;
LL +     e!();
   |
```
```
error[E0277]: the trait bound `String: Copy` is not satisfied
  --> $DIR/const-fn-in-vec.rs:1:47
   |
LL | static _MAYBE_STRINGS: [Option<String>; 5] = [None; 5];
   |                                               ^^^^ the trait `Copy` is not implemented for `String`
   |
   = note: required for `Option<String>` to implement `Copy`
   = note: the `Copy` trait is required because this value will be copied for each element of the array
help: create an inline `const` block
   |
LL | static _MAYBE_STRINGS: [Option<String>; 5] = [const { None }; 5];
   |                                               +++++++      +
```

Part of rust-lang#141973
bors added a commit that referenced this pull request Jun 7, 2025
Rollup of 8 pull requests

Successful merges:

 - #137992 (Stabilise `os_string_pathbuf_leak`)
 - #141558 (Limit the size of cgu names when using the `-Zhuman-readable-cgu-name…)
 - #141797 (compiler: set Apple frame pointers by architecture)
 - #141857 (coretests: move float tests from num to floats module and use a more flexible macro to generate them)
 - #142045 (Make obligation cause code suggestions verbose)
 - #142076 (Check documentation of bootstrap in PR CI)
 - #142110 (Add solaris targets to build-manifest)
 - #142131 (Make cast suggestions verbose)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit cf7ffa1 into rust-lang:master Jun 7, 2025
10 checks passed
@rustbot rustbot added this to the 1.89.0 milestone Jun 7, 2025
rust-timer added a commit that referenced this pull request Jun 7, 2025
Rollup merge of #142045 - estebank:obligation-cause-code-suggestion, r=compiler-errors

Make obligation cause code suggestions verbose

```
error[E0277]: `()` is not a future
  --> $DIR/unnecessary-await.rs:28:10
   |
LL |     e!().await;
   |          ^^^^^ `()` is not a future
   |
   = help: the trait `Future` is not implemented for `()`
   = note: () must be a future or must implement `IntoFuture` to be awaited
   = note: required for `()` to implement `IntoFuture`
help: remove the `.await`
   |
LL -     e!().await;
LL +     e!();
   |
```
```
error[E0277]: the trait bound `String: Copy` is not satisfied
  --> $DIR/const-fn-in-vec.rs:1:47
   |
LL | static _MAYBE_STRINGS: [Option<String>; 5] = [None; 5];
   |                                               ^^^^ the trait `Copy` is not implemented for `String`
   |
   = note: required for `Option<String>` to implement `Copy`
   = note: the `Copy` trait is required because this value will be copied for each element of the array
help: create an inline `const` block
   |
LL | static _MAYBE_STRINGS: [Option<String>; 5] = [const { None }; 5];
   |                                               +++++++      +
```

Part of #141973
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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) 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.

5 participants