Skip to content

Commit

Permalink
Rollup merge of #111381 - oli-obk:closure_attr, r=petrochenkov
Browse files Browse the repository at this point in the history
Keep encoding attributes for closures

see model-checking/kani#2406 (comment) for some context.

We stopped encoding attributes for closures, but some tools need them
  • Loading branch information
matthiaskrgr authored May 10, 2023
2 parents d117b41 + b7f570f commit 3d4d670
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion compiler/rustc_metadata/src/rmeta/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(..)
Expand All @@ -874,7 +879,6 @@ fn should_encode_attrs(def_kind: DefKind) -> bool {
| DefKind::ImplTraitPlaceholder
| DefKind::LifetimeParam
| DefKind::GlobalAsm
| DefKind::Closure
| DefKind::Generator => false,
}
}
Expand Down

0 comments on commit 3d4d670

Please sign in to comment.