File tree Expand file tree Collapse file tree 3 files changed +13
-7
lines changed
Expand file tree Collapse file tree 3 files changed +13
-7
lines changed Original file line number Diff line number Diff line change 11{
22 "markdownlint.config" : {
33 "first-line-heading" : false ,
4- "blanks-around-headings" : false
4+ "blanks-around-headings" : false ,
5+ "blanks-around-lists" : false
56 }
67}
Original file line number Diff line number Diff line change @@ -38,10 +38,14 @@ const fn return_fn_returning_bool() -> fn() -> bool {
3838
3939# unsafe_method_ ***
4040
41- Unfortunately, Rust language limitations don't allow us to have one macro for methods that with
42- receiver ` self ` being a shared reference ` &self ` , a mutable reference ` &mut self ` or a value ` self ` .
43- We need to use three different macros: ` unsafe_method_ref ` , ` unsafe_method_mut ` and
44- ` unsafe_method_val ` .
41+ Unfortunately, Rust macros can't have access to the type system. So they can't differentiate whether
42+ a method's receiver is a shared reference ` &self ` , a mutable reference ` &mut self ` or a value
43+ ` self ` .
44+
45+ We need to use three different macros:
46+ - ` unsafe_method_ref ` ,
47+ - ` unsafe_method_mut ` and
48+ - ` unsafe_method_val ` .
4549
4650# unsafe_method_ref and unsafe_method_mut in const
4751
Original file line number Diff line number Diff line change @@ -215,8 +215,9 @@ pub trait AsRefOrMut {
215215}
216216impl < T > AsRefOrMut for T { }
217217
218- /// Invoke an unsafe method that has a shared `Self` reference as a receiver: `&self`. Like
219- /// [unsafe_fn], but:
218+ /// Invoke an unsafe method that has a shared reference as a receiver: `&self`.
219+ ///
220+ /// Like [unsafe_fn], but
220221/// - This accepts a receiver `&self`, `&mut self` and `self` (which is then referenced, so it's
221222/// **not** moved/copied).
222223/// - This stores `self` in a variable outside of the generated `unsafe {...}`.
You can’t perform that action at this time.
0 commit comments