forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#105369 - chenyukang:yukang/fix-105226, r=Ta…
…KO8Ki Detect spurious ; before assoc fn body Fixes rust-lang#105226 r? `@TaKO8Ki`
- Loading branch information
Showing
3 changed files
with
62 additions
and
3 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
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,22 @@ | ||
use std::fmt; | ||
|
||
struct S { | ||
} | ||
|
||
impl S { | ||
fn hello<P>(&self, val: &P) where P: fmt::Display; { | ||
//~^ ERROR non-item in item list | ||
//~| ERROR associated function in `impl` without body | ||
println!("val: {}", val); | ||
} | ||
} | ||
|
||
impl S { | ||
fn hello_empty<P>(&self, val: &P) where P: fmt::Display; | ||
//~^ ERROR associated function in `impl` without body | ||
} | ||
|
||
fn main() { | ||
let s = S{}; | ||
s.hello(&32); | ||
} |
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,31 @@ | ||
error: non-item in item list | ||
--> $DIR/issue-105226.rs:7:56 | ||
| | ||
LL | impl S { | ||
| - item list starts here | ||
LL | fn hello<P>(&self, val: &P) where P: fmt::Display; { | ||
| - ^ non-item starts here | ||
| | | ||
| help: consider removing this semicolon | ||
... | ||
LL | } | ||
| - item list ends here | ||
|
||
error: associated function in `impl` without body | ||
--> $DIR/issue-105226.rs:7:5 | ||
| | ||
LL | fn hello<P>(&self, val: &P) where P: fmt::Display; { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | ||
| | | ||
| help: provide a definition for the function: `{ <body> }` | ||
|
||
error: associated function in `impl` without body | ||
--> $DIR/issue-105226.rs:15:5 | ||
| | ||
LL | fn hello_empty<P>(&self, val: &P) where P: fmt::Display; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | ||
| | | ||
| help: provide a definition for the function: `{ <body> }` | ||
|
||
error: aborting due to 3 previous errors | ||
|