1 // aux-build:proc_macro_unsafe.rs
3 #![warn(clippy::undocumented_unsafe_blocks)]
4 #![allow(clippy::let_unit_value)]
6 extern crate proc_macro_unsafe;
56 fn local_tuple_expression() {
58 let _ = (42, unsafe {});
66 fn line_comment_newlines() {
72 fn line_comment_empty() {
80 fn line_comment_with_extras() {
81 // This is a description
91 fn block_comment_newlines() {
97 fn block_comment_with_extras() {
98 /* This is a description
104 fn block_comment_terminator_same_line() {
105 /* This is a description
111 // Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
112 // incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
113 // ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
114 // reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
115 // occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est
117 // Tellus elementum sagittis vitae et leo duis ut diam quam. Sit amet nulla facilisi
118 // morbi tempus iaculis urna. Amet luctus venenatis lectus magna. At quis risus sed vulputate odio
119 // ut. Luctus venenatis lectus magna fringilla urna. Tortor id aliquet lectus proin nibh nisl
120 // condimentum id venenatis. Vulputate dignissim suspendisse in est ante in nibh mauris cursus.
124 fn safety_with_prepended_text() {
125 // This is a test. safety:
129 fn local_line_comment() {
134 fn local_block_comment() {
141 let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
146 let _ = (42, unsafe {}, "test", unsafe {});
151 let _ = *unsafe { &42 };
154 #[allow(clippy::match_single_binding)]
157 let _ = match unsafe {} {
162 fn comment_addr_of() {
167 fn comment_repeat() {
169 let _ = [unsafe {}; 5];
172 fn comment_macro_call() {
185 fn comment_macro_def() {
196 fn non_ascii_comment() {
201 fn local_commented_block() {
209 let _ = [(42, unsafe {}, unsafe {}), (52, unsafe {}, unsafe {})];
212 fn in_fn_call(x: *const u32) {
219 fn multi_in_fn_call(x: *const u32) {
220 fn f(x: u32, y: u32) {}
223 f(unsafe { *x }, unsafe { *x });
226 fn in_multiline_fn_call(x: *const u32) {
227 fn f(x: u32, y: u32) {}
236 fn in_macro_call(x: *const u32) {
238 println!("{}", unsafe { *x });
241 fn in_multiline_macro_call(x: *const u32) {
249 fn from_proc_macro() {
250 proc_macro_unsafe::unsafe_block!(token);
256 fn inline_block_comment() {
257 /* Safety: */ unsafe {}
264 fn no_comment_array() {
265 let _ = [unsafe { 14 }, unsafe { 15 }, 42, unsafe { 16 }];
268 fn no_comment_tuple() {
269 let _ = (42, unsafe {}, "test", unsafe {});
272 fn no_comment_unary() {
273 let _ = *unsafe { &42 };
276 #[allow(clippy::match_single_binding)]
277 fn no_comment_match() {
278 let _ = match unsafe {} {
283 fn no_comment_addr_of() {
287 fn no_comment_repeat() {
288 let _ = [unsafe {}; 5];
291 fn local_no_comment() {
295 fn no_comment_macro_call() {
305 fn no_comment_macro_def() {
315 fn trailing_comment() {
319 fn internal_comment() {
333 pub fn print_binary_tree() {
334 println!("{}", unsafe { String::from_utf8_unchecked(vec![]) });