@@ -1803,6 +1803,43 @@ information see the [opt-in builtin traits RFC](https://github.com/rust-lang/
1803
1803
rfcs/blob/master/text/0019-opt-in-builtin-traits.md).
1804
1804
"## ,
1805
1805
1806
+ E0193 : r##"
1807
+ `where` clauses must use generic type parameters: it does not make sense to use
1808
+ them otherwise. An example causing this error:
1809
+
1810
+ ```
1811
+ trait Foo {
1812
+ fn bar(&self);
1813
+ }
1814
+
1815
+ #[derive(Copy,Clone)]
1816
+ struct Wrapper<T> {
1817
+ Wrapped: T
1818
+ }
1819
+
1820
+ impl Foo for Wrapper<u32> where Wrapper<u32>: Clone {
1821
+ fn bar(&self) { }
1822
+ }
1823
+ ```
1824
+
1825
+ This use of a `where` clause is strange - a more common usage would look
1826
+ something like the following:
1827
+
1828
+ ```
1829
+ impl <T> Foo for Wrapper<T> where Wrapper<T>: Clone {
1830
+ fn bar(&self) { }
1831
+ }
1832
+ ```
1833
+
1834
+ Here, we're saying that the implementation exists on Wrapper only when the
1835
+ wrapped type `T` implements `Clone`. The `where` clause is important because
1836
+ some types will not implement `Clone`, and thus will not get this method.
1837
+
1838
+ In our erroneous example, however, we're referencing a single concrete type.
1839
+ Since we know for certain that Wrapper<u32> implements Clone, there's no reason
1840
+ to also specify it in a `where` clause.
1841
+ "## ,
1842
+
1806
1843
E0195 : r##"
1807
1844
Your method's lifetime parameters do not match the trait declaration.
1808
1845
Erroneous code example:
@@ -2558,8 +2595,6 @@ register_diagnostics! {
2558
2595
E0188 , // can not cast a immutable reference to a mutable pointer
2559
2596
E0189 , // deprecated: can only cast a boxed pointer to a boxed object
2560
2597
E0190 , // deprecated: can only cast a &-pointer to an &-object
2561
- E0193 , // cannot bound type where clause bounds may only be attached to types
2562
- // involving type parameters
2563
2598
E0194 ,
2564
2599
E0196 , // cannot determine a type for this closure
2565
2600
E0203 , // type parameter has more than one relaxed default bound,
0 commit comments