-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
On return type
impl Trait
for block with no expr point at last semi
- Loading branch information
Showing
3 changed files
with
47 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
src/test/ui/suggestions/impl-trait-return-trailing-semicolon.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
trait Bar {} | ||
impl Bar for u8 {} | ||
fn foo() -> impl Bar { | ||
5; //~^ ERROR the trait bound `(): Bar` is not satisfied | ||
} | ||
|
||
fn main() {} |
13 changes: 13 additions & 0 deletions
13
src/test/ui/suggestions/impl-trait-return-trailing-semicolon.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
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; //~^ ERROR the trait bound `(): Bar` is not satisfied | ||
| - consider removing this semicolon | ||
| | ||
= note: the return type of a function must have a statically known size | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. |