]> git.proxmox.com Git - rustc.git/blob - compiler/rustc_error_codes/src/error_codes/E0390.md
New upstream version 1.48.0~beta.8+dfsg1
[rustc.git] / compiler / rustc_error_codes / src / error_codes / E0390.md
1 A method was implemented on a primitive type.
2
3 Erroneous code example:
4
5 ```compile_fail,E0390
6 struct Foo {
7 x: i32
8 }
9
10 impl *mut Foo {}
11 // error: only a single inherent implementation marked with
12 // `#[lang = "mut_ptr"]` is allowed for the `*mut T` primitive
13 ```
14
15 This isn't allowed, but using a trait to implement a method is a good solution.
16 Example:
17
18 ```
19 struct Foo {
20 x: i32
21 }
22
23 trait Bar {
24 fn bar();
25 }
26
27 impl Bar for *mut Foo {
28 fn bar() {} // ok!
29 }
30 ```