File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -80,8 +80,15 @@ pub enum SubgroupError {
8080pub enum LocalVariableError {
8181 #[ error( "Local variable has a type {0:?} that can't be stored in a local variable." ) ]
8282 InvalidType ( Handle < crate :: Type > ) ,
83- #[ error( "Initializer doesn't match the variable type" ) ]
84- InitializerType ,
83+ #[ error(
84+ "Initializer of type {:?} doesn't match the variable type {:?}" ,
85+ initializer_ty,
86+ variable_ty
87+ ) ]
88+ InitializerType {
89+ variable_ty : crate :: TypeInner ,
90+ initializer_ty : crate :: TypeInner ,
91+ } ,
8592 #[ error( "Initializer is not a const or override expression" ) ]
8693 NonConstOrOverrideInitializer ,
8794}
@@ -1652,7 +1659,10 @@ impl super::Validator {
16521659
16531660 if let Some ( init) = var. init {
16541661 if !gctx. compare_types ( & TypeResolution :: Handle ( var. ty ) , & fun_info[ init] . ty ) {
1655- return Err ( LocalVariableError :: InitializerType ) ;
1662+ return Err ( LocalVariableError :: InitializerType {
1663+ initializer_ty : init_ty. clone ( ) ,
1664+ variable_ty : decl_ty. clone ( ) ,
1665+ } ) ;
16561666 }
16571667
16581668 if !local_expr_kind. is_const_or_override ( init) {
You can’t perform that action at this time.
0 commit comments