@@ -293,12 +293,18 @@ impl<'a> DeclValidator<'a> {
293293 fn validate_struct ( & mut self , struct_id : StructId ) {
294294 // Check the structure name.
295295 let data = self . db . struct_signature ( struct_id) ;
296- self . create_incorrect_case_diagnostic_for_item_name (
297- struct_id,
298- & data. name ,
299- CaseType :: UpperCamelCase ,
300- IdentType :: Structure ,
301- ) ;
296+
297+ // rustc implementation excuses repr(C) since C structs predominantly don't
298+ // use camel case.
299+ let has_repr_c = data. repr ( self . db , struct_id) . is_some_and ( |repr| repr. c ( ) ) ;
300+ if !has_repr_c {
301+ self . create_incorrect_case_diagnostic_for_item_name (
302+ struct_id,
303+ & data. name ,
304+ CaseType :: UpperCamelCase ,
305+ IdentType :: Structure ,
306+ ) ;
307+ }
302308
303309 // Check the field names.
304310 self . validate_struct_fields ( struct_id) ;
@@ -378,15 +384,20 @@ impl<'a> DeclValidator<'a> {
378384 }
379385
380386 fn validate_enum ( & mut self , enum_id : EnumId ) {
387+ // Check the enum name.
381388 let data = self . db . enum_signature ( enum_id) ;
382389
383- // Check the enum name.
384- self . create_incorrect_case_diagnostic_for_item_name (
385- enum_id,
386- & data. name ,
387- CaseType :: UpperCamelCase ,
388- IdentType :: Enum ,
389- ) ;
390+ // rustc implementation excuses repr(C) since C structs predominantly don't
391+ // use camel case.
392+ let has_repr_c = data. repr ( self . db , enum_id) . is_some_and ( |repr| repr. c ( ) ) ;
393+ if !has_repr_c {
394+ self . create_incorrect_case_diagnostic_for_item_name (
395+ enum_id,
396+ & data. name ,
397+ CaseType :: UpperCamelCase ,
398+ IdentType :: Enum ,
399+ ) ;
400+ }
390401
391402 // Check the variant names.
392403 self . validate_enum_variants ( enum_id)
0 commit comments