diff options
| author | y21 <30553356+y21@users.noreply.github.com> | 2024-01-01 02:20:46 +0100 |
|---|---|---|
| committer | y21 <30553356+y21@users.noreply.github.com> | 2024-01-01 02:57:23 +0100 |
| commit | ef35e82ea3d40ba271e97764c5b9868f7297d318 (patch) | |
| tree | c8b030ff3cf360b4bdf313bfd534a18a96afca00 /tests | |
| parent | 174a0d7be6f18bf6470a46d107e4b3f0b870c315 (diff) | |
| download | rust-ef35e82ea3d40ba271e97764c5b9868f7297d318.tar.gz rust-ef35e82ea3d40ba271e97764c5b9868f7297d318.zip | |
don't look for safety comments in codeblocks
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/unnecessary_safety_comment.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/ui/unnecessary_safety_comment.rs b/tests/ui/unnecessary_safety_comment.rs index d9a7ad8e56c..bdc6fa0f46b 100644 --- a/tests/ui/unnecessary_safety_comment.rs +++ b/tests/ui/unnecessary_safety_comment.rs @@ -73,4 +73,25 @@ mod issue_10084 { } } +mod issue_12048 { + pub const X: u8 = 0; + + /// Returns a pointer to five. + /// + /// # Examples + /// + /// ``` + /// use foo::point_to_five; + /// + /// let five_pointer = point_to_five(); + /// // Safety: this pointer always points to a valid five. + /// let five = unsafe { *five_pointer }; + /// assert_eq!(five, 5); + /// ``` + pub fn point_to_five() -> *const u8 { + static FIVE: u8 = 5; + &FIVE + } +} + fn main() {} |
