File tree 3 files changed +21
-2
lines changed
3 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -3407,7 +3407,7 @@ declare_lint! {
3407
3407
///
3408
3408
/// ### Example of drop reorder
3409
3409
///
3410
- /// ```rust,compile_fail
3410
+ /// ```rust,edition2018, compile_fail
3411
3411
/// #![deny(rust_2021_incompatible_closure_captures)]
3412
3412
/// # #![allow(unused)]
3413
3413
///
@@ -3443,7 +3443,7 @@ declare_lint! {
3443
3443
///
3444
3444
/// ### Example of auto-trait
3445
3445
///
3446
- /// ```rust,compile_fail
3446
+ /// ```rust,edition2018, compile_fail
3447
3447
/// #![deny(rust_2021_incompatible_closure_captures)]
3448
3448
/// use std::thread;
3449
3449
///
Original file line number Diff line number Diff line change @@ -2024,6 +2024,10 @@ fn should_do_rust_2021_incompatible_closure_captures_analysis(
2024
2024
tcx : TyCtxt < ' _ > ,
2025
2025
closure_id : hir:: HirId ,
2026
2026
) -> bool {
2027
+ if tcx. sess . rust_2021 ( ) {
2028
+ return false ;
2029
+ }
2030
+
2027
2031
let ( level, _) =
2028
2032
tcx. lint_level_at_node ( lint:: builtin:: RUST_2021_INCOMPATIBLE_CLOSURE_CAPTURES , closure_id) ;
2029
2033
Original file line number Diff line number Diff line change
1
+ // check-pass
2
+ // edition:2021
3
+ #![ deny( rust_2021_compatibility) ]
4
+
5
+ pub struct Warns {
6
+ // `Arc` has significant drop
7
+ _significant_drop : std:: sync:: Arc < ( ) > ,
8
+ field : String ,
9
+ }
10
+
11
+ pub fn test ( w : Warns ) {
12
+ _ = || drop ( w. field ) ;
13
+ }
14
+
15
+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments