Skip to content

Commit 5650709

Browse files
Add example for E0390
1 parent 73b369d commit 5650709

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/librustc_typeck/diagnostics.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2482,7 +2482,8 @@ impl Foo for Bar {
24822482
}
24832483
```
24842484
2485-
To fix this error, please verify you didn't misspell the method name. Example:
2485+
To fix this error, please verify that the method name wasn't misspelled and
2486+
verify that you are indeed implementing the correct trait items. Example:
24862487
24872488
```
24882489
struct Bar;
@@ -2519,9 +2520,8 @@ impl Foo for Bar {
25192520
}
25202521
```
25212522
2522-
To fix this error, please verify you didn't misspell the associated type name
2523-
and that your trait item implementation corresponds to the trait definition.
2524-
Example:
2523+
Please verify that the associated type name wasn't misspelled and your
2524+
implementation corresponds to the trait definition. Example:
25252525
25262526
```
25272527
struct Bar;
@@ -2722,8 +2722,8 @@ let x = 12f32; // error: binary operation `<<` cannot be applied to
27222722
x << 2;
27232723
```
27242724
2725-
To fix this error, please check this type implements this binary operation.
2726-
Example:
2725+
To fix this error, please check that this type implements this binary
2726+
operation. Example:
27272727
27282728
```
27292729
let x = 12u32; // the `u32` type does implement it:
@@ -2775,7 +2775,8 @@ For more information see the [opt-in builtin traits RFC](https://github.com/rust
27752775
"##,
27762776

27772777
E0390: r##"
2778-
You tried to implement on an `*mut T` type. Erroneous code example:
2778+
You tried to implement methods for a mutable raw pointer (*mut T). Erroneous
2779+
code example:
27792780
27802781
```
27812782
struct Foo {
@@ -2787,7 +2788,12 @@ impl *mut Foo {}
27872788
// `#[lang = "mut_ptr"]` is allowed for the `*mut T` primitive
27882789
```
27892790
2790-
To fix this, please follow the compiler recommendations.
2791+
This isn't allowed, perhaps you might get the desired effects by wrapping the
2792+
raw pointer in a struct. Example:
2793+
2794+
```
2795+
struct FooPtr(pub *mut Foo);
2796+
```
27912797
"##,
27922798

27932799
E0391: r##"

0 commit comments

Comments
 (0)