@@ -213,6 +213,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
213213 Attribute :: Parsed ( AttributeKind :: Used { span : attr_span, .. } ) => {
214214 self . check_used ( * attr_span, target, span) ;
215215 }
216+ & Attribute :: Parsed ( AttributeKind :: PassByValue ( attr_span) ) => {
217+ self . check_pass_by_value ( attr_span, span, target)
218+ }
216219 Attribute :: Unparsed ( attr_item) => {
217220 style = Some ( attr_item. style ) ;
218221 match attr. path ( ) . as_slice ( ) {
@@ -275,7 +278,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
275278 | [ sym:: const_trait, ..] => self . check_must_be_applied_to_trait ( attr. span ( ) , span, target) ,
276279 [ sym:: collapse_debuginfo, ..] => self . check_collapse_debuginfo ( attr, span, target) ,
277280 [ sym:: must_not_suspend, ..] => self . check_must_not_suspend ( attr, span, target) ,
278- [ sym:: rustc_pass_by_value, ..] => self . check_pass_by_value ( attr, span, target) ,
279281 [ sym:: rustc_allow_incoherent_impl, ..] => {
280282 self . check_allow_incoherent_impl ( attr, span, target)
281283 }
@@ -1438,11 +1440,11 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
14381440 }
14391441
14401442 /// Warns against some misuses of `#[pass_by_value]`
1441- fn check_pass_by_value ( & self , attr : & Attribute , span : Span , target : Target ) {
1443+ fn check_pass_by_value ( & self , attr_span : Span , span : Span , target : Target ) {
14421444 match target {
14431445 Target :: Struct | Target :: Enum | Target :: TyAlias => { }
14441446 _ => {
1445- self . dcx ( ) . emit_err ( errors:: PassByValue { attr_span : attr . span ( ) , span } ) ;
1447+ self . dcx ( ) . emit_err ( errors:: PassByValue { attr_span, span } ) ;
14461448 }
14471449 }
14481450 }
0 commit comments