@@ -94,7 +94,7 @@ error: `days` does not live long enough
94
94
error: aborting due to previous error
95
95
```
96
96
97
- Implementing Drop lets the Inspector execute some arbitrary code during its
97
+ Implementing ` Drop ` lets the ` Inspector ` execute some arbitrary code during its
98
98
death. This means it can potentially observe that types that are supposed to
99
99
live as long as it does actually were destroyed first.
100
100
@@ -168,7 +168,7 @@ checker during the analysis of `fn main`, saying that `days` does not
168
168
live long enough.
169
169
170
170
The reason is that the borrow checking analysis of ` main ` does not
171
- know about the internals of each Inspector's Drop implementation. As
171
+ know about the internals of each ` Inspector ` 's ` Drop ` implementation. As
172
172
far as the borrow checker knows while it is analyzing ` main ` , the body
173
173
of an inspector's destructor might access that borrowed data.
174
174
@@ -185,17 +185,16 @@ borrowed data in a value to outlive that value, which is certainly sound.
185
185
186
186
Future versions of the language may make the analysis more precise, to
187
187
reduce the number of cases where sound code is rejected as unsafe.
188
- This would help address cases such as the two Inspectors above that
188
+ This would help address cases such as the two ` Inspector ` s above that
189
189
know not to inspect during destruction.
190
190
191
191
In the meantime, there is an unstable attribute that one can use to
192
192
assert (unsafely) that a generic type's destructor is * guaranteed* to
193
193
not access any expired data, even if its type gives it the capability
194
194
to do so.
195
195
196
- That attribute is called ` may_dangle ` and was introduced in [ RFC 1327]
197
- (https://github.com/rust-lang/rfcs/blob/master/text/1327-dropck-param-eyepatch.md ).
198
- To deploy it on the Inspector example from above, we would write:
196
+ That attribute is called ` may_dangle ` and was introduced in [ RFC 1327] [ rfc1327 ] .
197
+ To deploy it on the ` Inspector ` example from above, we would write:
199
198
200
199
``` rust,ignore
201
200
struct Inspector<'a>(&'a u8, &'static str);
@@ -287,3 +286,4 @@ worry at all about doing the right thing for the drop checker. However there
287
286
is one special case that you need to worry about, which we will look at in
288
287
the next section.
289
288
289
+ [ rfc1327 ] : https://github.com/rust-lang/rfcs/blob/master/text/1327-dropck-param-eyepatch.md
0 commit comments