diff options
| author | lcnr <rust@lcnr.de> | 2022-03-29 09:47:32 +0200 |
|---|---|---|
| committer | lcnr <rust@lcnr.de> | 2022-03-30 11:23:58 +0200 |
| commit | 00cf7af44aaecb5b91f58ec8f1737f6623f910d3 (patch) | |
| tree | 4a39ead9b4ea6270f70c1ae4b5cb94083f7b88db /src/test/ui/error-codes | |
| parent | ee62514b16b610870e001b14f15e7e71b15e54e7 (diff) | |
| download | rust-00cf7af44aaecb5b91f58ec8f1737f6623f910d3.tar.gz rust-00cf7af44aaecb5b91f58ec8f1737f6623f910d3.zip | |
rework error messages for incorrect inherent impls
Diffstat (limited to 'src/test/ui/error-codes')
| -rw-r--r-- | src/test/ui/error-codes/E0117.rs | 3 | ||||
| -rw-r--r-- | src/test/ui/error-codes/E0118.rs | 7 | ||||
| -rw-r--r-- | src/test/ui/error-codes/E0118.stderr | 11 | ||||
| -rw-r--r-- | src/test/ui/error-codes/E0120.rs | 3 |
4 files changed, 20 insertions, 4 deletions
diff --git a/src/test/ui/error-codes/E0117.rs b/src/test/ui/error-codes/E0117.rs index dbbac514801..22b48657385 100644 --- a/src/test/ui/error-codes/E0117.rs +++ b/src/test/ui/error-codes/E0117.rs @@ -1,5 +1,4 @@ impl Drop for u32 {} //~ ERROR E0117 //~| ERROR the `Drop` trait may only be implemented for structs, enums, and unions -fn main() { -} +fn main() {} diff --git a/src/test/ui/error-codes/E0118.rs b/src/test/ui/error-codes/E0118.rs new file mode 100644 index 00000000000..aaef8113b8a --- /dev/null +++ b/src/test/ui/error-codes/E0118.rs @@ -0,0 +1,7 @@ +impl fn(u8) { //~ ERROR E0118 + fn get_state(&self) -> String { + String::new() + } +} + +fn main() {} diff --git a/src/test/ui/error-codes/E0118.stderr b/src/test/ui/error-codes/E0118.stderr new file mode 100644 index 00000000000..296fb5d664a --- /dev/null +++ b/src/test/ui/error-codes/E0118.stderr @@ -0,0 +1,11 @@ +error[E0118]: no nominal type found for inherent implementation + --> $DIR/E0118.rs:1:6 + | +LL | impl fn(u8) { + | ^^^^^^ impl requires a nominal type + | + = note: either implement a trait on it or create a newtype to wrap it instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0118`. diff --git a/src/test/ui/error-codes/E0120.rs b/src/test/ui/error-codes/E0120.rs index 287a4088183..a0a301a06e2 100644 --- a/src/test/ui/error-codes/E0120.rs +++ b/src/test/ui/error-codes/E0120.rs @@ -5,5 +5,4 @@ impl Drop for dyn MyTrait { fn drop(&mut self) {} } -fn main() { -} +fn main() {} |
