mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
Don't fire rust_2021_incompatible_closure_captures
in edition = 2021
This commit is contained in:
parent
b11bf65e4a
commit
fcd42d628c
@ -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;
|
||||
///
|
||||
|
@ -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);
|
||||
|
||||
|
15
src/test/ui/lint/issue-101284.rs
Normal file
15
src/test/ui/lint/issue-101284.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// check-pass
|
||||
// edition:2021
|
||||
#![deny(rust_2021_compatibility)]
|
||||
|
||||
pub struct Warns {
|
||||
// `Arc` has significant drop
|
||||
_significant_drop: std::sync::Arc<()>,
|
||||
field: String,
|
||||
}
|
||||
|
||||
pub fn test(w: Warns) {
|
||||
_ = || drop(w.field);
|
||||
}
|
||||
|
||||
fn main() {}
|
Loading…
Reference in New Issue
Block a user