File tree 1 file changed +10
-7
lines changed
1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -422,15 +422,18 @@ impl<T> [T] {
422
422
/// use two pointers to refer to a range of elements in memory, as is
423
423
/// common in C++.
424
424
///
425
- /// It can also be useful to check if a reference or pointer to an element
426
- /// refers to an element of this slice:
425
+ /// It can also be useful to check if a pointer to an element refers to an
426
+ /// element of this slice:
427
427
///
428
428
/// ```
429
- /// let a = [1,2,3];
430
- /// let x = &a[1];
431
- /// let y = &5;
432
- /// assert!(a.as_ptr_range().contains(x));
433
- /// assert!(!a.as_ptr_range().contains(y));
429
+ /// #![feature(slice_ptr_range)]
430
+ ///
431
+ /// let a = [1, 2, 3];
432
+ /// let x = &a[1] as *const _;
433
+ /// let y = &5 as *const _;
434
+ ///
435
+ /// assert!(a.as_ptr_range().contains(&x));
436
+ /// assert!(!a.as_ptr_range().contains(&y));
434
437
/// ```
435
438
///
436
439
/// [`as_ptr`]: #method.as_ptr
You can’t perform that action at this time.
0 commit comments