]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_error_codes/src/error_codes/E0403.md
Rollup merge of #92310 - ehuss:rustdoc-ice, r=estebank
[rust.git] / compiler / rustc_error_codes / src / error_codes / E0403.md
1 Some type parameters have the same name.
2
3 Erroneous code example:
4
5 ```compile_fail,E0403
6 fn f<T, T>(s: T, u: T) {} // error: the name `T` is already used for a generic
7                           //        parameter in this item's generic parameters
8 ```
9
10 Please verify that none of the type parameters are misspelled, and rename any
11 clashing parameters. Example:
12
13 ```
14 fn f<T, Y>(s: T, u: Y) {} // ok!
15 ```
16
17 Type parameters in an associated item also cannot shadow parameters from the
18 containing item:
19
20 ```compile_fail,E0403
21 trait Foo<T> {
22     fn do_something(&self) -> T;
23     fn do_something_else<T: Clone>(&self, bar: T);
24 }
25 ```