Skip to content

Commit 2f84cef

Browse files
---
yaml --- r: 232655 b: refs/heads/try c: 962b61f h: refs/heads/master i: 232653: 6a4c23e 232651: 71da5b4 232647: bda57d8 232639: 935e43a v: v3
1 parent 3169237 commit 2f84cef

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: edeb4f1c86cbf6af8ef9874d4b3af50f721ea1b8
33
refs/heads/snap-stage3: 1af31d4974e33027a68126fa5a5a3c2c6491824f
4-
refs/heads/try: 633fe4463940e6d6523ceb9c6267983170761d7e
4+
refs/heads/try: 962b61f4f5d70a2063088ab318f80c2e5155a27d
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/src/librustc_typeck/diagnostics.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2791,11 +2791,21 @@ impl *mut Foo {}
27912791
// `#[lang = "mut_ptr"]` is allowed for the `*mut T` primitive
27922792
```
27932793
2794-
This isn't allowed, perhaps you might get the desired effects by wrapping the
2795-
raw pointer in a struct. Example:
2794+
This isn't allowed, but using a trait to implement a method is a good solution.
2795+
Example:
27962796
27972797
```
2798-
struct FooPtr(pub *mut Foo);
2798+
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+
}
27992809
```
28002810
"##,
28012811

0 commit comments

Comments
 (0)