From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- .../rustc_error_codes/src/error_codes/E0193.md | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 compiler/rustc_error_codes/src/error_codes/E0193.md (limited to 'compiler/rustc_error_codes/src/error_codes/E0193.md') diff --git a/compiler/rustc_error_codes/src/error_codes/E0193.md b/compiler/rustc_error_codes/src/error_codes/E0193.md new file mode 100644 index 000000000..e29a949ff --- /dev/null +++ b/compiler/rustc_error_codes/src/error_codes/E0193.md @@ -0,0 +1,44 @@ +#### Note: this error code is no longer emitted by the compiler. + +`where` clauses must use generic type parameters: it does not make sense to use +them otherwise. An example causing this error: + +``` +trait Foo { + fn bar(&self); +} + +#[derive(Copy,Clone)] +struct Wrapper { + Wrapped: T +} + +impl Foo for Wrapper where Wrapper: Clone { + fn bar(&self) { } +} +``` + +This use of a `where` clause is strange - a more common usage would look +something like the following: + +``` +trait Foo { + fn bar(&self); +} + +#[derive(Copy,Clone)] +struct Wrapper { + Wrapped: T +} +impl Foo for Wrapper where Wrapper: Clone { + fn bar(&self) { } +} +``` + +Here, we're saying that the implementation exists on Wrapper only when the +wrapped type `T` implements `Clone`. The `where` clause is important because +some types will not implement `Clone`, and thus will not get this method. + +In our erroneous example, however, we're referencing a single concrete type. +Since we know for certain that `Wrapper` implements `Clone`, there's no +reason to also specify it in a `where` clause. -- cgit v1.2.3