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

Further improve impl Trait/dyn Trait suggestions #68522

Merged
merged 6 commits into from
Jan 26, 2020

Conversation

estebank
Copy link
Contributor

After reading Returning Trait Objects by Bryce Fisher-Fleig, I noticed that #68195 had a few bugs due to not ignoring ty::Error.

  • Account for ty::Error.
  • Account for if/else and match blocks when pointing at return types and referencing their types.
  • Increase the multiline suggestion output from 6 lines to 20.

No longer suggest `Box::new(if foo { Type1 } else { Type2 })`, instead
suggesting `if foo { Box::new(Type1) } else { Box::new(Type2) }`.
@rust-highfive
Copy link
Collaborator

r? @eddyb

(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 Jan 24, 2020
@estebank
Copy link
Contributor Author

CC @oli-obk

@oli-obk
Copy link
Contributor

oli-obk commented Jan 24, 2020

r? @oli-obk

@rust-highfive rust-highfive assigned oli-obk and unassigned eddyb Jan 24, 2020
@oli-obk
Copy link
Contributor

oli-obk commented Jan 24, 2020

@bors r+

@bors
Copy link
Contributor

bors commented Jan 24, 2020

📌 Commit 600e385 has been approved by oli-obk

@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 Jan 24, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Jan 25, 2020
Further improve `impl Trait`/`dyn Trait` suggestions

After reading [_Returning Trait Objects_ by Bryce Fisher-Fleig](https://bryce.fisher-fleig.org/blog/returning-trait-objects/), [I noticed that](https://www.reddit.com/r/rust/comments/esueur/returning_trait_objects/ffczl4k/) rust-lang#68195 had a few bugs due to not ignoring `ty::Error`.

- Account for `ty::Error`.
- Account for `if`/`else` and `match` blocks when pointing at return types and referencing their types.
- Increase the multiline suggestion output from 6 lines to 20.
@oli-obk
Copy link
Contributor

oli-obk commented Jan 25, 2020

@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 Jan 25, 2020
@estebank
Copy link
Contributor Author

@bors r=oli-obk
reverted the suggestion output change

@bors
Copy link
Contributor

bors commented Jan 25, 2020

📌 Commit 16709f0 has been approved by oli-obk

@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 Jan 25, 2020
@bors
Copy link
Contributor

bors commented Jan 26, 2020

⌛ Testing commit 16709f0 with merge 3d8778d...

bors added a commit that referenced this pull request Jan 26, 2020
Further improve `impl Trait`/`dyn Trait` suggestions

After reading [_Returning Trait Objects_ by Bryce Fisher-Fleig](https://bryce.fisher-fleig.org/blog/returning-trait-objects/), [I noticed that](https://www.reddit.com/r/rust/comments/esueur/returning_trait_objects/ffczl4k/) #68195 had a few bugs due to not ignoring `ty::Error`.

- Account for `ty::Error`.
- Account for `if`/`else` and `match` blocks when pointing at return types and referencing their types.
- Increase the multiline suggestion output from 6 lines to 20.
@bors
Copy link
Contributor

bors commented Jan 26, 2020

☀️ Test successful - checks-azure
Approved by: oli-obk
Pushing 3d8778d to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jan 26, 2020
@bors bors merged commit 16709f0 into rust-lang:master Jan 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants