@@ -218,6 +218,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
218218 [ sym:: rustc_has_incoherent_inherent_impls, ..] => {
219219 self . check_has_incoherent_inherent_impls ( attr, span, target)
220220 }
221+ [ sym:: rustc_non_const_sized, ..] => {
222+ self . check_rustc_non_const_sized ( span, target)
223+ }
221224 [ sym:: ffi_pure, ..] => self . check_ffi_pure ( attr. span ( ) , attrs, target) ,
222225 [ sym:: ffi_const, ..] => self . check_ffi_const ( attr. span ( ) , target) ,
223226 [ sym:: link_ordinal, ..] => self . check_link_ordinal ( attr, span, target) ,
@@ -2600,6 +2603,19 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
26002603 }
26012604 }
26022605
2606+ /// `#[rustc_non_const_sized]` is a testing attribute for forcing a type to only be `Sized`,
2607+ /// not `const Sized` (which almost all types implement) - it should only be applied to structs
2608+ /// or enums. This isn't equivalent to `!const Sized` or anything like that, it just means that
2609+ /// there isn't a `impl const Sized for T`, only `impl Sized for T` in the compiler.
2610+ fn check_rustc_non_const_sized ( & self , span : Span , target : Target ) {
2611+ match target {
2612+ Target :: Struct | Target :: Enum => ( ) ,
2613+ _ => {
2614+ self . dcx ( ) . emit_err ( errors:: RustcNonConstSized { attr_span : span } ) ;
2615+ }
2616+ }
2617+ }
2618+
26032619 /// Checks if `#[autodiff]` is applied to an item other than a function item.
26042620 fn check_autodiff ( & self , _hir_id : HirId , _attr : & Attribute , span : Span , target : Target ) {
26052621 debug ! ( "check_autodiff" ) ;
0 commit comments