1- use alloc:: { format, string:: String } ;
1+ use alloc:: {
2+ format,
3+ string:: { String , ToString } ,
4+ } ;
5+ use core:: format_args;
26
37use super :: { compose:: validate_compose, FunctionInfo , ModuleInfo , ShaderStages , TypeFlags } ;
48use crate :: arena:: UniqueArena ;
59use crate :: {
610 arena:: Handle ,
11+ common:: wgsl:: ToWgsl as _,
712 proc,
813 proc:: OverloadSet ,
914 proc:: { IndexableLengthError , ResolveError } ,
@@ -130,7 +135,7 @@ pub enum ExpressionError {
130135 InvalidCastArgument ,
131136 #[ error( "Invalid argument count for {0}" ) ]
132137 WrongArgumentCount ( String ) ,
133- #[ error( "Argument [{1}] to {0:?} as expression {2:?} has an invalid type." ) ]
138+ #[ error( "Argument [{1}] to `{0}` as expression {2:?} has an invalid type." ) ]
134139 InvalidArgumentType ( String , u32 , Handle < crate :: Expression > ) ,
135140 #[ error(
136141 "workgroupUniformLoad result type can't be {0:?}. It can only be a constructible type."
@@ -245,14 +250,14 @@ impl super::Validator {
245250 actuals : A ,
246251 ) -> Result < ( ) , ExpressionError >
247252 where
248- F : core:: fmt:: Debug + Copy ,
253+ F : core:: fmt:: Display + Copy ,
249254 O : OverloadSet ,
250255 A : Iterator < Item = ( Handle < crate :: Expression > , & ' a crate :: TypeInner ) > + ExactSizeIterator ,
251256 {
252257 // Start with the set of all overloads available for `fun`.
253258 let mut overloads = overloads;
254259 log:: debug!(
255- "initial overloads for {:? }: {:#?}" ,
260+ "initial overloads for {}: {:#?}" ,
256261 fun,
257262 overloads. for_debug( & module. types)
258263 ) ;
@@ -278,15 +283,15 @@ impl super::Validator {
278283 if overloads. is_empty ( ) {
279284 log:: debug!( "all overloads eliminated" ) ;
280285 return Err ( ExpressionError :: InvalidArgumentType (
281- format ! ( "{ fun:?}" ) ,
286+ fun. to_string ( ) ,
282287 i as u32 ,
283288 expr,
284289 ) ) ;
285290 }
286291 }
287292
288293 if actuals_len < overloads. min_arguments ( ) {
289- return Err ( ExpressionError :: WrongArgumentCount ( format ! ( "{ fun:?}" ) ) ) ;
294+ return Err ( ExpressionError :: WrongArgumentCount ( fun. to_string ( ) ) ) ;
290295 }
291296
292297 Ok ( ( ) )
@@ -978,7 +983,7 @@ impl super::Validator {
978983 } => {
979984 self . validate_func_call_with_overloads (
980985 module,
981- proc:: select:: WgslSymbol ,
986+ format_args ! ( "`{}`" , proc:: select:: WgslSymbol . to_wgsl ( ) ) ,
982987 proc:: select:: overloads ( ) ,
983988 [ reject, accept, condition]
984989 . iter ( )
@@ -1057,7 +1062,7 @@ impl super::Validator {
10571062
10581063 self . validate_func_call_with_overloads (
10591064 module,
1060- fun,
1065+ format_args ! ( "{ fun:?}" ) ,
10611066 fun. overloads ( ) ,
10621067 actuals
10631068 . iter ( )
0 commit comments