]> git.proxmox.com Git - rustc.git/blobdiff - compiler/rustc_typeck/src/check/upvar.rs
New upstream version 1.65.0+dfsg1
[rustc.git] / compiler / rustc_typeck / src / check / upvar.rs
index dd8f943b985ffecb56859814bb43d25e4e9f10ea..0b207a6c0bee1d8fbf3b5a1941bf565075c2ebc0 100644 (file)
@@ -1217,7 +1217,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
                 // Combine all the reasons of why the root variable should be captured as a result of
                 // auto trait implementation issues
-                auto_trait_migration_reasons.extend(capture_trait_reasons.clone());
+                auto_trait_migration_reasons.extend(capture_trait_reasons.iter().copied());
 
                 diagnostics_info.push(MigrationLintNote {
                     captures_info,
@@ -2024,6 +2024,10 @@ fn should_do_rust_2021_incompatible_closure_captures_analysis(
     tcx: TyCtxt<'_>,
     closure_id: hir::HirId,
 ) -> bool {
+    if tcx.sess.rust_2021() {
+        return false;
+    }
+
     let (level, _) =
         tcx.lint_level_at_node(lint::builtin::RUST_2021_INCOMPATIBLE_CLOSURE_CAPTURES, closure_id);