@@ -217,6 +217,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
217217 [ sym:: rustc_has_incoherent_inherent_impls, ..] => {
218218 self . check_has_incoherent_inherent_impls ( attr, span, target)
219219 }
220+ [ sym:: rustc_non_const_sized, ..] => {
221+ self . check_rustc_non_const_sized ( span, target)
222+ }
220223 [ sym:: ffi_pure, ..] => self . check_ffi_pure ( attr. span ( ) , attrs, target) ,
221224 [ sym:: ffi_const, ..] => self . check_ffi_const ( attr. span ( ) , target) ,
222225 [ sym:: link_ordinal, ..] => self . check_link_ordinal ( attr, span, target) ,
@@ -2578,6 +2581,18 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
25782581 }
25792582 }
25802583
2584+ /// `#[rustc_non_const_sized]` is a testing attribute for forcing `const Sized` not to be
2585+ /// implemented (while there are no types which are non-`const Sized`) - it should only be
2586+ /// applied to structs or enums.
2587+ fn check_rustc_non_const_sized ( & self , span : Span , target : Target ) {
2588+ match target {
2589+ Target :: Struct | Target :: Enum => ( ) ,
2590+ _ => {
2591+ self . dcx ( ) . emit_err ( errors:: RustcNonConstSized { attr_span : span } ) ;
2592+ }
2593+ }
2594+ }
2595+
25812596 /// Checks if `#[autodiff]` is applied to an item other than a function item.
25822597 fn check_autodiff ( & self , _hir_id : HirId , _attr : & Attribute , span : Span , target : Target ) {
25832598 debug ! ( "check_autodiff" ) ;
0 commit comments