diff options
| author | bors <bors@rust-lang.org> | 2025-05-07 09:31:15 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-05-07 09:31:15 +0000 |
| commit | db0e836148accac8a22532e3596ac612b63c2d8e (patch) | |
| tree | 9399ae8afd71403a78ead73041c427b08e2b88c7 /compiler | |
| parent | f76c7367c6363d33ddb5a93b5de0d158b2d827f6 (diff) | |
| parent | aca12a821620f37d48c6539524c99be8a6bb6520 (diff) | |
Auto merge of #140735 - GuillaumeGomez:rollup-dlhbxsg, r=GuillaumeGomez
Rollup of 4 pull requests Successful merges: - #139518 (Stabilize precise capture syntax in style guide) - #140398 (Fix backtrace for cygwin) - #140719 (fix typo in autorefs lint doc example) - #140724 (Update `compiler-builtins` to 0.1.158) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_lint/src/autorefs.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/compiler/rustc_lint/src/autorefs.rs b/compiler/rustc_lint/src/autorefs.rs index ddab13190be..91d58d92466 100644 --- a/compiler/rustc_lint/src/autorefs.rs +++ b/compiler/rustc_lint/src/autorefs.rs @@ -15,9 +15,9 @@ declare_lint! { /// /// ```rust /// unsafe fn fun(ptr: *mut [u8]) -> *mut [u8] { - /// &raw mut (*ptr)[..16] - /// // ^^^^^^ this calls `IndexMut::index_mut(&mut ..., ..16)`, - /// // implicitly creating a reference + /// unsafe { &raw mut (*ptr)[..16] } + /// // ^^^^^^ this calls `IndexMut::index_mut(&mut ..., ..16)`, + /// // implicitly creating a reference /// } /// ``` /// @@ -34,17 +34,17 @@ declare_lint! { /// /// ```rust /// unsafe fn fun(ptr: *mut [u8]) -> *mut [u8] { - /// &raw mut (&mut *ptr)[..16] + /// unsafe { &raw mut (&mut *ptr)[..16] } /// } /// ``` /// /// Otherwise try to find an alternative way to achive your goals using only raw pointers: /// /// ```rust - /// use std::slice; + /// use std::ptr; /// - /// unsafe fn fun(ptr: *mut [u8]) -> *mut [u8] { - /// slice::from_raw_parts_mut(ptr.cast(), 16) + /// fn fun(ptr: *mut [u8]) -> *mut [u8] { + /// ptr::slice_from_raw_parts_mut(ptr.cast(), 16) /// } /// ``` pub DANGEROUS_IMPLICIT_AUTOREFS, |
