File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
branches/try/src/librustc_typeck Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change 1
1
---
2
2
refs/heads/master: edeb4f1c86cbf6af8ef9874d4b3af50f721ea1b8
3
3
refs/heads/snap-stage3: 1af31d4974e33027a68126fa5a5a3c2c6491824f
4
- refs/heads/try: 633fe4463940e6d6523ceb9c6267983170761d7e
4
+ refs/heads/try: 962b61f4f5d70a2063088ab318f80c2e5155a27d
5
5
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
6
6
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
7
7
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
Original file line number Diff line number Diff line change @@ -2791,11 +2791,21 @@ impl *mut Foo {}
2791
2791
// `#[lang = "mut_ptr"]` is allowed for the `*mut T` primitive
2792
2792
```
2793
2793
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:
2796
2796
2797
2797
```
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
+ }
2799
2809
```
2800
2810
"## ,
2801
2811
You can’t perform that action at this time.
0 commit comments