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

estebank commented Jan 24, 2020

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.
estebank added 3 commits Jan 23, 2020
No longer suggest `Box::new(if foo { Type1 } else { Type2 })`, instead
suggesting `if foo { Box::new(Type1) } else { Box::new(Type2) }`.
@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Jan 24, 2020

r? @eddyb

(rust_highfive has picked a reviewer for you, use r? to override)

@estebank

This comment has been minimized.

Copy link
Contributor Author

estebank commented Jan 24, 2020

@oli-obk

This comment has been minimized.

Copy link
Contributor

oli-obk commented Jan 24, 2020

@rust-highfive rust-highfive assigned oli-obk and unassigned eddyb Jan 24, 2020
src/librustc_errors/emitter.rs Outdated Show resolved Hide resolved
@oli-obk

This comment has been minimized.

Copy link
Contributor

oli-obk commented Jan 24, 2020

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 24, 2020

📌 Commit 600e385 has been approved by oli-obk

Dylan-DPC added a commit to Dylan-DPC/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.
bors added a commit that referenced this pull request Jan 25, 2020
Rollup of 6 pull requests

Successful merges:

 - #68485 (add a test for #60976)
 - #68498 (Add some type-alias-impl-trait regression tests)
 - #68512 (Local is copy)
 - #68514 (Use Self instead of self return type)
 - #68522 (Further improve `impl Trait`/`dyn Trait` suggestions)
 - #68530 (Do not ICE on multipart suggestions touching multiple files)

Failed merges:

r? @ghost
@oli-obk

This comment has been minimized.

Copy link
Contributor

oli-obk commented Jan 25, 2020

@bors r-

@estebank

This comment has been minimized.

Copy link
Contributor Author

estebank commented Jan 25, 2020

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

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 25, 2020

📌 Commit 16709f0 has been approved by oli-obk

@bors

This comment has been minimized.

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

This comment has been minimized.

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 label Jan 26, 2020
@bors bors merged commit 16709f0 into rust-lang:master Jan 26, 2020
5 checks passed
5 checks passed
homu Test successful
Details
pr Build #20200125.42 succeeded
Details
pr (Linux mingw-check) Linux mingw-check succeeded
Details
pr (Linux x86_64-gnu-llvm-7) Linux x86_64-gnu-llvm-7 succeeded
Details
pr (Linux x86_64-gnu-tools) Linux x86_64-gnu-tools succeeded
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

6 participants
You can’t perform that action at this time.