Skip to content

Commit ea79264

Browse files
committed
Add diagnostics for E0392
1 parent d4432b3 commit ea79264

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

src/librustc_typeck/diagnostics.rs

+35-1
Original file line numberDiff line numberDiff line change
@@ -2109,6 +2109,41 @@ E0380: r##"
21092109
Default impls are only allowed for traits with no methods or associated items.
21102110
For more information see the [opt-in builtin traits RFC](https://github.com/rust
21112111
-lang/rfcs/blob/master/text/0019-opt-in-builtin-traits.md).
2112+
"##,
2113+
2114+
E0392: r##"
2115+
This error indicates that a type parameter has been declared but not actually
2116+
used.
2117+
2118+
Here is an example that demonstrates the error:
2119+
2120+
```
2121+
enum Foo<T> {
2122+
Bar
2123+
}
2124+
```
2125+
2126+
The first way to fix this error is by removing the type parameter, as
2127+
shown below:
2128+
2129+
```
2130+
enum Foo {
2131+
Bar
2132+
}
2133+
```
2134+
2135+
The second method is to actually make use of the type parameter:
2136+
2137+
```
2138+
enum Foo<T> {
2139+
Bar(T)
2140+
}
2141+
```
2142+
2143+
See the 'Type Parameters' section of the reference for more details
2144+
on this topic:
2145+
2146+
http://doc.rust-lang.org/reference.html#type-parameters-1
21122147
"##
21132148

21142149
}
@@ -2211,7 +2246,6 @@ register_diagnostics! {
22112246
E0390, // only a single inherent implementation marked with
22122247
// `#[lang = \"{}\"]` is allowed for the `{}` primitive
22132248
E0391, // unsupported cyclic reference between types/traits detected
2214-
E0392, // parameter `{}` is never used
22152249
E0393, // the type parameter `{}` must be explicitly specified in an object
22162250
// type because its default value `{}` references the type `Self`"
22172251
E0399, // trait items need to be implemented because the associated

0 commit comments

Comments
 (0)