diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-09-05 14:15:53 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-05 14:15:53 +0530 |
| commit | 3a9e2ff3d873b2bf28ab8c377bc4cf9e5919e419 (patch) | |
| tree | bfa187b0bd5944d6bc403bc71549856fa9b610d6 /compiler | |
| parent | e4534fe6fef5452a5f2fd42927c933e06d8ec1b8 (diff) | |
| parent | fcd42d628cced5169ebbb791a992a8832d220ab6 (diff) | |
| download | rust-3a9e2ff3d873b2bf28ab8c377bc4cf9e5919e419.tar.gz rust-3a9e2ff3d873b2bf28ab8c377bc4cf9e5919e419.zip | |
Rollup merge of #101409 - WaffleLapkin:rust_2021_compatibility_no_warn_in_2021_crates, r=TaKO8Ki
Don't fire `rust_2021_incompatible_closure_captures` in `edition = 2021` crates Fixes #101284
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_lint_defs/src/builtin.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_typeck/src/check/upvar.rs | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index ca01599acc8..2e3a06fcbb7 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -3407,7 +3407,7 @@ declare_lint! { /// /// ### Example of drop reorder /// - /// ```rust,compile_fail + /// ```rust,edition2018,compile_fail /// #![deny(rust_2021_incompatible_closure_captures)] /// # #![allow(unused)] /// @@ -3443,7 +3443,7 @@ declare_lint! { /// /// ### Example of auto-trait /// - /// ```rust,compile_fail + /// ```rust,edition2018,compile_fail /// #![deny(rust_2021_incompatible_closure_captures)] /// use std::thread; /// diff --git a/compiler/rustc_typeck/src/check/upvar.rs b/compiler/rustc_typeck/src/check/upvar.rs index 0afc153300b..0b207a6c0be 100644 --- a/compiler/rustc_typeck/src/check/upvar.rs +++ b/compiler/rustc_typeck/src/check/upvar.rs @@ -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); |
