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

Add more info for common trait resolution and async/await errors #83689

Merged
merged 6 commits into from
Apr 8, 2021

Conversation

estebank
Copy link
Contributor

@estebank estebank commented Mar 30, 2021

  • Suggest Pin::new/Box::new/Arc::new/Box::pin in more cases
  • Point at impl and type defs introducing requirements on E0277

@rust-highfive
Copy link
Collaborator

r? @davidtwco

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

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 30, 2021
err.note(&format!("required because it appears within the type `{}`", ty));
let msg = format!("required because it appears within the type `{}`", ty);
match ty.kind() {
ty::Adt(def, _) => match self.tcx.item_name_from_hir(def.did) {
Copy link
Member

Choose a reason for hiding this comment

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

Why use item_name_from_hir instead of opt_item_name? Do you expect def to always be local?

Copy link
Member

Choose a reason for hiding this comment

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

Using item_name_from_hir isn't going to cause ICEs with non-local definitions, we'll only be missing the span in those cases. I assume the idea is that this span is only helpful and is actionable for locally defined types?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It feels to me that seeing where the requirement is included in another crate isn't as useful as when the requirement comes from the current crate, because people can't change them, but it might useful for extra context? 🤷‍♀️

I'll make the change and see what it actually looks like in the test suite.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just included this change. No effects in the tests (but might increase verbosity in the wild). Regardless, I can change it after real world usage if people complain.

@jyn514 jyn514 added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 30, 2021
@davidtwco
Copy link
Member

r=me after resolving @jyn514's comment

@estebank
Copy link
Contributor Author

@bors r=davidtwco

@bors
Copy link
Contributor

bors commented Mar 31, 2021

📌 Commit 06b82ab has been approved by davidtwco

@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 Mar 31, 2021
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Mar 31, 2021
…dtwco

Add more info for common trait resolution and async/await errors

* Suggest `Pin::new`/`Box::new`/`Arc::new`/`Box::pin` in more cases
* Point at `impl` and type defs introducing requirements on E0277
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Mar 31, 2021
…dtwco

Add more info for common trait resolution and async/await errors

* Suggest `Pin::new`/`Box::new`/`Arc::new`/`Box::pin` in more cases
* Point at `impl` and type defs introducing requirements on E0277
@bors
Copy link
Contributor

bors commented Apr 1, 2021

⌛ Testing commit 06b82ab with merge de6b40206b19b4a752e3637dd13fddda0a96741c...

@Dylan-DPC-zz
Copy link

Dylan-DPC-zz commented Apr 1, 2021

failed in rollup (forgot to r- it earlier)

@bors r-

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 1, 2021
@Dylan-DPC-zz
Copy link

@bors retry

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 1, 2021
@rust-log-analyzer

This comment has been minimized.

@estebank estebank force-pushed the cool-bears-hot-tip branch from 06b82ab to 64e6288 Compare April 7, 2021 15:31
@estebank
Copy link
Contributor Author

estebank commented Apr 7, 2021

@bors r=davidtwco

@bors
Copy link
Contributor

bors commented Apr 7, 2021

📌 Commit 64e6288 has been approved by davidtwco

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Apr 7, 2021
…dtwco

Add more info for common trait resolution and async/await errors

* Suggest `Pin::new`/`Box::new`/`Arc::new`/`Box::pin` in more cases
* Point at `impl` and type defs introducing requirements on E0277
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 8, 2021
Rollup of 5 pull requests

Successful merges:

 - rust-lang#82497 (Fix handling of `--output-format json` flag)
 - rust-lang#83689 (Add more info for common trait resolution and async/await errors)
 - rust-lang#83952 (Account for `ExprKind::Block` when suggesting .into() and deref)
 - rust-lang#83965 (Add Debug implementation for hir::intravisit::FnKind)
 - rust-lang#83974 (Fix outdated crate names in `rustc_interface::callbacks`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit a113240 into rust-lang:master Apr 8, 2021
@rustbot rustbot added this to the 1.53.0 milestone Apr 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

8 participants