diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-12-11 23:36:46 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-11 23:36:46 +0100 |
| commit | 4154e14f9ac586b4bb8c67db1d474b4d8c960e23 (patch) | |
| tree | b7ba9e369484a79c05e7086a42fd332bab3cf360 /src/test | |
| parent | aa7b5b32e3463fc21468073ca3a75e2c3617b179 (diff) | |
| parent | 5599f2ad09345b94487920b84029ad215c4dc743 (diff) | |
| download | rust-4154e14f9ac586b4bb8c67db1d474b4d8c960e23.tar.gz rust-4154e14f9ac586b4bb8c67db1d474b4d8c960e23.zip | |
Rollup merge of #105369 - chenyukang:yukang/fix-105226, r=TaKO8Ki
Detect spurious ; before assoc fn body Fixes #105226 r? ``@TaKO8Ki``
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/suggestions/issue-105226.rs | 22 | ||||
| -rw-r--r-- | src/test/ui/suggestions/issue-105226.stderr | 31 |
2 files changed, 53 insertions, 0 deletions
diff --git a/src/test/ui/suggestions/issue-105226.rs b/src/test/ui/suggestions/issue-105226.rs new file mode 100644 index 00000000000..f123dbf4cae --- /dev/null +++ b/src/test/ui/suggestions/issue-105226.rs @@ -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); +} diff --git a/src/test/ui/suggestions/issue-105226.stderr b/src/test/ui/suggestions/issue-105226.stderr new file mode 100644 index 00000000000..f16a8090103 --- /dev/null +++ b/src/test/ui/suggestions/issue-105226.stderr @@ -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 + |
