mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-16 10:35:22 +00:00
Auto merge of #7988 - giraffate:fix_ice_on_undocumented_unsafe_blocks, r=flip1995
Fix ICE on `undocumented_unsafe_blocks` fix https://github.com/rust-lang/rust-clippy/issues/7979 changelog: Fix ICE on `undocumented_unsafe_blocks`
This commit is contained in:
commit
d550e5f5e6
@ -137,10 +137,10 @@ impl UndocumentedUnsafeBlocks {
|
||||
|
||||
let between_span = if block_span.from_expansion() {
|
||||
self.macro_expansion = true;
|
||||
enclosing_scope_span.with_hi(block_span.hi())
|
||||
enclosing_scope_span.with_hi(block_span.hi()).source_callsite()
|
||||
} else {
|
||||
self.macro_expansion = false;
|
||||
enclosing_scope_span.to(block_span)
|
||||
enclosing_scope_span.to(block_span).source_callsite()
|
||||
};
|
||||
|
||||
let file_name = source_map.span_to_filename(between_span);
|
||||
|
@ -284,4 +284,8 @@ fn interference() {
|
||||
unsafe {};
|
||||
}
|
||||
|
||||
pub fn print_binary_tree() {
|
||||
println!("{}", unsafe { String::from_utf8_unchecked(vec![]) });
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -155,5 +155,17 @@ LL ~ // Safety: ...
|
||||
LL ~ unsafe {};
|
||||
|
|
||||
|
||||
error: aborting due to 13 previous errors
|
||||
error: unsafe block missing a safety comment
|
||||
--> $DIR/undocumented_unsafe_blocks.rs:288:20
|
||||
|
|
||||
LL | println!("{}", unsafe { String::from_utf8_unchecked(vec![]) });
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: consider adding a safety comment
|
||||
|
|
||||
LL ~ println!("{}", // Safety: ...
|
||||
LL ~ unsafe { String::from_utf8_unchecked(vec![]) });
|
||||
|
|
||||
|
||||
error: aborting due to 14 previous errors
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user