@@ -4753,28 +4753,25 @@ pub fn compute_and_append_statement_semantic<'db>(
47534753 }
47544754 }
47554755 }
4756- ast:: ModuleItem :: Module ( _) => {
4757- unreachable ! ( "Modules are not supported inside a function." )
4758- }
4759- ast:: ModuleItem :: FreeFunction ( _) => {
4760- unreachable ! ( "FreeFunction type not supported." )
4761- }
4762- ast:: ModuleItem :: ExternFunction ( _) => {
4763- unreachable ! ( "ExternFunction type not supported." )
4764- }
4765- ast:: ModuleItem :: ExternType ( _) => unreachable ! ( "ExternType type not supported." ) ,
4766- ast:: ModuleItem :: Trait ( _) => unreachable ! ( "Trait type not supported." ) ,
4767- ast:: ModuleItem :: Impl ( _) => unreachable ! ( "Impl type not supported." ) ,
4768- ast:: ModuleItem :: ImplAlias ( _) => unreachable ! ( "ImplAlias type not supported." ) ,
4769- ast:: ModuleItem :: Struct ( _) => unreachable ! ( "Struct type not supported." ) ,
4770- ast:: ModuleItem :: Enum ( _) => unreachable ! ( "Enum type not supported." ) ,
4771- ast:: ModuleItem :: TypeAlias ( _) => unreachable ! ( "TypeAlias type not supported." ) ,
4772- ast:: ModuleItem :: InlineMacro ( _) => unreachable ! ( "InlineMacro type not supported." ) ,
4773- ast:: ModuleItem :: HeaderDoc ( _) => unreachable ! ( "HeaderDoc type not supported." ) ,
4774- ast:: ModuleItem :: MacroDeclaration ( _) => {
4775- unreachable ! ( "MacroDeclaration type not supported." )
4756+ ast:: ModuleItem :: Module ( _)
4757+ | ast:: ModuleItem :: FreeFunction ( _)
4758+ | ast:: ModuleItem :: ExternFunction ( _)
4759+ | ast:: ModuleItem :: ExternType ( _)
4760+ | ast:: ModuleItem :: Trait ( _)
4761+ | ast:: ModuleItem :: Impl ( _)
4762+ | ast:: ModuleItem :: ImplAlias ( _)
4763+ | ast:: ModuleItem :: Struct ( _)
4764+ | ast:: ModuleItem :: Enum ( _)
4765+ | ast:: ModuleItem :: TypeAlias ( _)
4766+ | ast:: ModuleItem :: InlineMacro ( _)
4767+ | ast:: ModuleItem :: HeaderDoc ( _)
4768+ | ast:: ModuleItem :: MacroDeclaration ( _) => {
4769+ return Err ( ctx
4770+ . diagnostics
4771+ . report ( stmt_item_syntax. stable_ptr ( db) , UnsupportedItemInStatement ) ) ;
47764772 }
4777- ast:: ModuleItem :: Missing ( _) => unreachable ! ( "Missing type not supported." ) ,
4773+ // Diagnostics reported on syntax level already.
4774+ ast:: ModuleItem :: Missing ( _) => return Err ( skip_diagnostic ( ) ) ,
47784775 }
47794776 statements. push ( ctx. arenas . statements . alloc ( semantic:: Statement :: Item (
47804777 semantic:: StatementItem { stable_ptr : syntax. stable_ptr ( db) } ,
0 commit comments