Rollup merge of #111381 - oli-obk:closure_attr, r=petrochenkov

Keep encoding attributes for closures

see https://github.com/model-checking/kani/pull/2406#issuecomment-1539630332 for some context.

We stopped encoding attributes for closures, but some tools need them
This commit is contained in:
Matthias Krüger 2023-05-10 06:12:14 +02:00 committed by GitHub
commit 3d4d6703a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -862,6 +862,11 @@ fn should_encode_attrs(def_kind: DefKind) -> bool {
| DefKind::Macro(_)
| DefKind::Field
| DefKind::Impl { .. } => true,
// Tools may want to be able to detect their tool lints on
// closures from upstream crates, too. This is used by
// https://github.com/model-checking/kani and is not a performance
// or maintenance issue for us.
DefKind::Closure => true,
DefKind::TyParam
| DefKind::ConstParam
| DefKind::Ctor(..)
@ -874,7 +879,6 @@ fn should_encode_attrs(def_kind: DefKind) -> bool {
| DefKind::ImplTraitPlaceholder
| DefKind::LifetimeParam
| DefKind::GlobalAsm
| DefKind::Closure
| DefKind::Generator => false,
}
}