Add #[default_method_body_is_const]

This commit is contained in:
Deadbeef 2021-07-04 12:24:20 +08:00
parent a84d1b21ae
commit 2db927d8d8
No known key found for this signature in database
GPG key ID: 6525773485376D92
5 changed files with 82 additions and 22 deletions

View file

@ -470,6 +470,11 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
rustc_attr!(rustc_promotable, AssumedUsed, template!(Word), IMPL_DETAIL),
rustc_attr!(rustc_legacy_const_generics, AssumedUsed, template!(List: "N"), INTERNAL_UNSTABLE),
gated!(
default_method_body_is_const, AssumedUsed, template!(Word), const_trait_impl,
"the `#[default_method_body_is_const]` attribute marks a default method of a trait \
as const, so it does not need to be duplicated by a const impl."
),
// ==========================================================================
// Internal attributes, Layout related: