File tree 4 files changed +28
-2
lines changed
4 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -145,8 +145,9 @@ impl UndocumentedUnsafeBlocks {
145
145
let file_name = source_map. span_to_filename ( between_span) ;
146
146
let source_file = source_map. get_source_file ( & file_name) ?;
147
147
148
- let lex_start = ( between_span. lo ( ) . 0 + 1 ) as usize ;
149
- let src_str = source_file. src . as_ref ( ) ?[ lex_start..between_span. hi ( ) . 0 as usize ] . to_string ( ) ;
148
+ let lex_start = ( between_span. lo ( ) . 0 - source_file. start_pos . 0 + 1 ) as usize ;
149
+ let lex_end = ( between_span. hi ( ) . 0 - source_file. start_pos . 0 ) as usize ;
150
+ let src_str = source_file. src . as_ref ( ) ?[ lex_start..lex_end] . to_string ( ) ;
150
151
151
152
let mut pos = 0 ;
152
153
let mut comment = false ;
Original file line number Diff line number Diff line change
1
+ fn zero ( ) {
2
+ unsafe { 0 } ;
3
+ }
Original file line number Diff line number Diff line change
1
+ #![ warn( clippy:: undocumented_unsafe_blocks) ]
2
+ #![ allow( clippy:: no_effect) ]
3
+
4
+ #[ path = "auxiliary/ice-7868-aux.rs" ]
5
+ mod zero;
6
+
7
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error: unsafe block missing a safety comment
2
+ --> $DIR/auxiliary/ice-7868-aux.rs:2:5
3
+ |
4
+ LL | unsafe { 0 };
5
+ | ^^^^^^^^^^^^
6
+ |
7
+ = note: `-D clippy::undocumented-unsafe-blocks` implied by `-D warnings`
8
+ help: consider adding a safety comment
9
+ |
10
+ LL ~ // Safety: ...
11
+ LL ~ unsafe { 0 };
12
+ |
13
+
14
+ error: aborting due to previous error
15
+
You can’t perform that action at this time.
0 commit comments