Skip to content

Commit da0ecbb

Browse files
committed
Use MethodKind::TraitImpl for methods in trait impls
1 parent ff619e2 commit da0ecbb

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

‎compiler/rustc_passes/src/check_attr.rs‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ fn target_from_impl_item<'tcx>(tcx: TyCtxt<'tcx>, impl_item: &hir::ImplItem<'_>)
7777
_ => bug!("parent of an ImplItem must be an Impl"),
7878
};
7979
if containing_impl_is_for_trait {
80-
Target::Method(MethodKind::Trait { body: true })
80+
Target::Method(MethodKind::TraitImpl)
8181
} else {
8282
Target::Method(MethodKind::Inherent)
8383
}
@@ -749,7 +749,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
749749
match target {
750750
Target::Fn
751751
| Target::Closure
752-
| Target::Method(MethodKind::Trait { body: true } | MethodKind::Inherent) => {
752+
| Target::Method(
753+
MethodKind::Trait { body: true } | MethodKind::TraitImpl | MethodKind::Inherent,
754+
) => {
753755
// `#[inline]` is ignored if the symbol must be codegened upstream because it's exported.
754756
if let Some(did) = hir_id.as_owner()
755757
&& self.tcx.def_kind(did).has_codegen_attrs()
@@ -775,7 +777,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
775777
fn check_naked(&self, hir_id: HirId, target: Target) {
776778
match target {
777779
Target::Fn
778-
| Target::Method(MethodKind::Trait { body: true } | MethodKind::Inherent) => {
780+
| Target::Method(
781+
MethodKind::Trait { body: true } | MethodKind::TraitImpl | MethodKind::Inherent,
782+
) => {
779783
let fn_sig = self.tcx.hir_node(hir_id).fn_sig().unwrap();
780784
let abi = fn_sig.header.abi;
781785
if abi.is_rustic_abi() && !self.tcx.features().naked_functions_rustic_abi() {

0 commit comments

Comments
 (0)