File tree Expand file tree Collapse file tree 3 files changed +21
-2
lines changed Expand file tree Collapse file tree 3 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -3407,7 +3407,7 @@ declare_lint! {
34073407 ///
34083408 /// ### Example of drop reorder
34093409 ///
3410- /// ```rust,compile_fail
3410+ /// ```rust,edition2018, compile_fail
34113411 /// #![deny(rust_2021_incompatible_closure_captures)]
34123412 /// # #![allow(unused)]
34133413 ///
@@ -3443,7 +3443,7 @@ declare_lint! {
34433443 ///
34443444 /// ### Example of auto-trait
34453445 ///
3446- /// ```rust,compile_fail
3446+ /// ```rust,edition2018, compile_fail
34473447 /// #![deny(rust_2021_incompatible_closure_captures)]
34483448 /// use std::thread;
34493449 ///
Original file line number Diff line number Diff line change @@ -2024,6 +2024,10 @@ fn should_do_rust_2021_incompatible_closure_captures_analysis(
20242024 tcx : TyCtxt < ' _ > ,
20252025 closure_id : hir:: HirId ,
20262026) -> bool {
2027+ if tcx. sess . rust_2021 ( ) {
2028+ return false ;
2029+ }
2030+
20272031 let ( level, _) =
20282032 tcx. lint_level_at_node ( lint:: builtin:: RUST_2021_INCOMPATIBLE_CLOSURE_CAPTURES , closure_id) ;
20292033
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