We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 633fe44 commit 962b61fCopy full SHA for 962b61f
src/librustc_typeck/diagnostics.rs
@@ -2791,11 +2791,21 @@ impl *mut Foo {}
2791
// `#[lang = "mut_ptr"]` is allowed for the `*mut T` primitive
2792
```
2793
2794
-This isn't allowed, perhaps you might get the desired effects by wrapping the
2795
-raw pointer in a struct. Example:
+This isn't allowed, but using a trait to implement a method is a good solution.
+Example:
2796
2797
2798
-struct FooPtr(pub *mut Foo);
+struct Foo {
2799
+ x: i32
2800
+}
2801
+
2802
+trait Bar {
2803
+ fn bar();
2804
2805
2806
+impl Bar for *mut Foo {
2807
+ fn bar() {} // ok!
2808
2809
2810
"##,
2811
0 commit comments