mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-19 03:03:21 +00:00
Fix ICE on undocumented_unsafe_blocks
This commit is contained in:
parent
83ad51108b
commit
3f3d7c2005
@ -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