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 ( ( ) )
@@ -974,7 +979,7 @@ impl super::Validator {
974979 } => {
975980 self . validate_func_call_with_overloads (
976981 module,
977- proc:: select:: WgslSymbol ,
982+ format_args ! ( "`{}`" , proc:: select:: WgslSymbol . to_wgsl ( ) ) ,
978983 proc:: select:: overloads ( ) ,
979984 [ reject, accept, condition]
980985 . iter ( )
@@ -1053,7 +1058,7 @@ impl super::Validator {
10531058
10541059 self . validate_func_call_with_overloads (
10551060 module,
1056- fun,
1061+ format_args ! ( "{ fun:?}" ) ,
10571062 fun. overloads ( ) ,
10581063 actuals
10591064 . iter ( )
0 commit comments