Skip to content

Commit fef60c0

Browse files
committed
add long diagnostics for E0194
1 parent c756526 commit fef60c0

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/librustc_typeck/diagnostics.rs

+16-1
Original file line numberDiff line numberDiff line change
@@ -1840,6 +1840,22 @@ Since we know for certain that Wrapper<u32> implements Clone, there's no reason
18401840
to also specify it in a `where` clause.
18411841
"##,
18421842

1843+
E0194: r##"
1844+
A type parameter was declared which shadows an existing one. An example of this
1845+
error:
1846+
1847+
```
1848+
trait Foo<T> {
1849+
fn do_something(&self) -> T;
1850+
fn do_something_else<T: Clone>(&self, bar: T);
1851+
}
1852+
```
1853+
1854+
In this example, the trait `Foo` and the trait method `do_something_else` both
1855+
define a type parameter `T`. This is not allowed: if the method wishes to
1856+
define a type parameter, it must use a different name for it.
1857+
"##,
1858+
18431859
E0195: r##"
18441860
Your method's lifetime parameters do not match the trait declaration.
18451861
Erroneous code example:
@@ -2595,7 +2611,6 @@ register_diagnostics! {
25952611
E0188, // can not cast a immutable reference to a mutable pointer
25962612
E0189, // deprecated: can only cast a boxed pointer to a boxed object
25972613
E0190, // deprecated: can only cast a &-pointer to an &-object
2598-
E0194,
25992614
E0196, // cannot determine a type for this closure
26002615
E0203, // type parameter has more than one relaxed default bound,
26012616
// and only one is supported

0 commit comments

Comments
 (0)