Applied suggestions
This commit is contained in:
parent
2db927d8d8
commit
3660a4e972
2 changed files with 12 additions and 16 deletions
|
@ -349,6 +349,12 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
|
|||
),
|
||||
|
||||
gated!(cmse_nonsecure_entry, AssumedUsed, template!(Word), experimental!(cmse_nonsecure_entry)),
|
||||
// RFC 2632
|
||||
gated!(
|
||||
default_method_body_is_const, AssumedUsed, template!(Word), const_trait_impl,
|
||||
"`default_method_body_is_const` is a temporary placeholder for declaring default bodies \
|
||||
as `const`, which may be removed or renamed in the future."
|
||||
),
|
||||
|
||||
// ==========================================================================
|
||||
// Internal attributes: Stability, deprecation, and unsafe:
|
||||
|
@ -470,11 +476,6 @@ 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:
|
||||
|
|
|
@ -93,17 +93,12 @@ impl<'tcx> hir::itemlikevisit::ItemLikeVisitor<'tcx> for CheckConstTraitVisitor<
|
|||
kind: ty::AssocKind::Fn, ident, defaultness, ..
|
||||
} = self.tcx.associated_item(*did)
|
||||
{
|
||||
match (
|
||||
self.tcx.has_attr(*did, sym::default_method_body_is_const),
|
||||
defaultness.has_value(),
|
||||
) {
|
||||
(false, true) => {
|
||||
to_implement.insert(ident);
|
||||
}
|
||||
// ignore functions that do not have default bodies
|
||||
// if those are unimplemented it will be catched by
|
||||
// typeck.
|
||||
_ => {}
|
||||
// we can ignore functions that do not have default bodies:
|
||||
// if those are unimplemented it will be catched by typeck.
|
||||
if defaultness.has_value()
|
||||
&& !self.tcx.has_attr(*did, sym::default_method_body_is_const)
|
||||
{
|
||||
to_implement.insert(ident);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue