Skip to content

On return type impl Trait for block with no expr point at last semi#58204

Merged
bors merged 3 commits into
rust-lang:masterfrom
estebank:impl-trait-semi
Mar 9, 2019
Merged

On return type impl Trait for block with no expr point at last semi#58204
bors merged 3 commits into
rust-lang:masterfrom
estebank:impl-trait-semi

Conversation

@estebank

@estebank estebank commented Feb 5, 2019

Copy link
Copy Markdown
Contributor

Partial solution, doesn't actually validate that the last statement in the function body can satisfy the trait bound, but it's a good incremental improvement over the status quo.

error[E0277]: the trait bound `(): Bar` is not satisfied
  --> $DIR/impl-trait-return-trailing-semicolon.rs:3:13
   |
LL | fn foo() -> impl Bar {
   |             ^^^^^^^^ the trait `Bar` is not implemented for `()`
LL |     5;
   |      - consider removing this semicolon
   |
   = note: the return type of a function must have a statically known size

Partially addresses #54771.

@rust-highfive

Copy link
Copy Markdown
Contributor

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 Feb 5, 2019
@estebank

estebank commented Feb 6, 2019

Copy link
Copy Markdown
Contributor Author

cc @cramertj

@cramertj

cramertj commented Feb 7, 2019

Copy link
Copy Markdown
Member

Nice! This looks like a great improvement.

@estebank

estebank commented Feb 7, 2019

Copy link
Copy Markdown
Contributor Author

r? @zackmdavis

@rust-highfive rust-highfive assigned zackmdavis and unassigned eddyb Feb 7, 2019

@zackmdavis zackmdavis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

requested reference comment; otherwise, r=me

Comment thread src/librustc/traits/error_reporting.rs Outdated
@estebank

estebank commented Feb 8, 2019

Copy link
Copy Markdown
Contributor Author

@bors r=zackmdavis

@bors

bors commented Feb 8, 2019

Copy link
Copy Markdown
Collaborator

📌 Commit 0afda05 has been approved by zackmdavis

@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 Feb 8, 2019
Centril added a commit to Centril/rust that referenced this pull request Feb 13, 2019
On return type `impl Trait` for block with no expr point at last semi

Partial solution, doesn't actually validate that the last statement in the function body can satisfy the trait bound, but it's a good incremental improvement over the status quo.

```
error[E0277]: the trait bound `(): Bar` is not satisfied
  --> $DIR/impl-trait-return-trailing-semicolon.rs:3:13
   |
LL | fn foo() -> impl Bar {
   |             ^^^^^^^^ the trait `Bar` is not implemented for `()`
LL |     5;
   |      - consider removing this semicolon
   |
   = note: the return type of a function must have a statically known size
```

Partially addresses rust-lang#54771.
@Centril

Centril commented Feb 13, 2019

Copy link
Copy Markdown
Contributor

Failed in rollup (#58426 (comment)) due to combination with #58167. @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 Feb 13, 2019
@rust-highfive

This comment has been minimized.

@Centril

Centril commented Feb 23, 2019

Copy link
Copy Markdown
Contributor

Ping from triage @estebank, any thoughts on moving forward?

@estebank

estebank commented Mar 4, 2019

Copy link
Copy Markdown
Contributor Author

@Centril I'll fix this soon

@estebank estebank added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 4, 2019
@estebank

estebank commented Mar 5, 2019

Copy link
Copy Markdown
Contributor Author

@bors r=zackmdavis

@bors

bors commented Mar 5, 2019

Copy link
Copy Markdown
Collaborator

📌 Commit e6387b6 has been approved by zackmdavis

@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 Mar 5, 2019
@estebank

estebank commented Mar 7, 2019

Copy link
Copy Markdown
Contributor Author

@bors rollup

emilyalbini added a commit to emilyalbini/rust that referenced this pull request Mar 8, 2019
On return type `impl Trait` for block with no expr point at last semi

Partial solution, doesn't actually validate that the last statement in the function body can satisfy the trait bound, but it's a good incremental improvement over the status quo.

```
error[E0277]: the trait bound `(): Bar` is not satisfied
  --> $DIR/impl-trait-return-trailing-semicolon.rs:3:13
   |
LL | fn foo() -> impl Bar {
   |             ^^^^^^^^ the trait `Bar` is not implemented for `()`
LL |     5;
   |      - consider removing this semicolon
   |
   = note: the return type of a function must have a statically known size
```

Partially addresses rust-lang#54771.
bors added a commit that referenced this pull request Mar 9, 2019
Rollup of 24 pull requests

Successful merges:

 - #58080 (Add FreeBSD armv6 and armv7 targets)
 - #58204 (On return type `impl Trait` for block with no expr point at last semi)
 - #58269 (Add librustc and libsyntax to rust-src distribution.)
 - #58369 (Make the Entry API of HashMap<K, V> Sync and Send)
 - #58861 (Expand where negative supertrait specific error is shown)
 - #58877 (Suggest removal of `&` when borrowing macro and appropriate)
 - #58883 (Suggest appropriate code for unused field when destructuring pattern)
 - #58891 (Remove stray ` in the docs for the FromIterator implementation for Option)
 - #58893 (race condition in thread local storage example)
 - #58906 (Monomorphize generator field types for debuginfo)
 - #58911 (Regression test for #58435.)
 - #58912 (Regression test for #58813)
 - #58916 (Fix release note problems noticed after merging.)
 - #58918 (Regression test added for an async ICE.)
 - #58921 (Add an explicit test for issue #50582)
 - #58926 (Make the lifetime parameters of tcx consistent.)
 - #58931 (Elide invalid method receiver error when it contains TyErr)
 - #58940 (Remove JSBackend from config.toml)
 - #58950 (Add self to mailmap)
 - #58961 (On incorrect cfg literal/identifier, point at the right span)
 - #58963 (libstd: implement Error::source for io::Error)
 - #58970 (delay_span_bug in wfcheck's ty.lift_to_tcx unwrap)
 - #58984 (Teach `-Z treat-err-as-bug` to take a number of errors to emit)
 - #59007 (Add a test for invalid const arguments)

Failed merges:

 - #58959 (Add release notes for PR #56243)

r? @ghost
@bors bors merged commit e6387b6 into rust-lang:master Mar 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

7 participants