File tree 1 file changed +18
-4
lines changed
1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -286,7 +286,9 @@ impl<'tcx> LateLintPass<'tcx> for NonShorthandFieldPatterns {
286
286
}
287
287
288
288
declare_lint ! {
289
- /// The `unsafe_code` lint catches usage of `unsafe` code.
289
+ /// The `unsafe_code` lint catches usage of `unsafe` code and other
290
+ /// potentially unsound constructs like `no_mangle`, `export_name`,
291
+ /// and `link_section`.
290
292
///
291
293
/// ### Example
292
294
///
@@ -297,17 +299,29 @@ declare_lint! {
297
299
///
298
300
/// }
299
301
/// }
302
+ ///
303
+ /// #[no_mangle]
304
+ /// fn func_0() { }
305
+ ///
306
+ /// #[export_name = "exported_symbol_name"]
307
+ /// pub fn name_in_rust() { }
308
+ ///
309
+ /// #[no_mangle]
310
+ /// #[link_section = ".example_section"]
311
+ /// pub static VAR1: u32 = 1;
300
312
/// ```
301
313
///
302
314
/// {{produces}}
303
315
///
304
316
/// ### Explanation
305
317
///
306
- /// This lint is intended to restrict the usage of `unsafe`, which can be
307
- /// difficult to use correctly.
318
+ /// This lint is intended to restrict the usage of `unsafe` blocks and other
319
+ /// constructs (including, but not limited to `no_mangle`, `link_section`
320
+ /// and `export_name` attributes) wrong usage of which causes undefined
321
+ /// behavior.
308
322
UNSAFE_CODE ,
309
323
Allow ,
310
- "usage of `unsafe` code"
324
+ "usage of `unsafe` code and other potentially unsound constructs "
311
325
}
312
326
313
327
declare_lint_pass ! ( UnsafeCode => [ UNSAFE_CODE ] ) ;
You can’t perform that action at this time.
0 commit comments