1
- use alloc:: { format, string:: String } ;
1
+ use alloc:: {
2
+ format,
3
+ string:: { String , ToString } ,
4
+ } ;
5
+ use core:: format_args;
2
6
3
7
use super :: { compose:: validate_compose, FunctionInfo , ModuleInfo , ShaderStages , TypeFlags } ;
4
8
use crate :: arena:: UniqueArena ;
5
9
use crate :: {
6
10
arena:: Handle ,
11
+ common:: wgsl:: ToWgsl as _,
7
12
proc,
8
13
proc:: OverloadSet ,
9
14
proc:: { IndexableLengthError , ResolveError } ,
@@ -130,7 +135,7 @@ pub enum ExpressionError {
130
135
InvalidCastArgument ,
131
136
#[ error( "Invalid argument count for {0}" ) ]
132
137
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." ) ]
134
139
InvalidArgumentType ( String , u32 , Handle < crate :: Expression > ) ,
135
140
#[ error(
136
141
"workgroupUniformLoad result type can't be {0:?}. It can only be a constructible type."
@@ -245,14 +250,14 @@ impl super::Validator {
245
250
actuals : A ,
246
251
) -> Result < ( ) , ExpressionError >
247
252
where
248
- F : core:: fmt:: Debug + Copy ,
253
+ F : core:: fmt:: Display + Copy ,
249
254
O : OverloadSet ,
250
255
A : Iterator < Item = ( Handle < crate :: Expression > , & ' a crate :: TypeInner ) > + ExactSizeIterator ,
251
256
{
252
257
// Start with the set of all overloads available for `fun`.
253
258
let mut overloads = overloads;
254
259
log:: debug!(
255
- "initial overloads for {:? }: {:#?}" ,
260
+ "initial overloads for {}: {:#?}" ,
256
261
fun,
257
262
overloads. for_debug( & module. types)
258
263
) ;
@@ -278,15 +283,15 @@ impl super::Validator {
278
283
if overloads. is_empty ( ) {
279
284
log:: debug!( "all overloads eliminated" ) ;
280
285
return Err ( ExpressionError :: InvalidArgumentType (
281
- format ! ( "{ fun:?}" ) ,
286
+ fun. to_string ( ) ,
282
287
i as u32 ,
283
288
expr,
284
289
) ) ;
285
290
}
286
291
}
287
292
288
293
if actuals_len < overloads. min_arguments ( ) {
289
- return Err ( ExpressionError :: WrongArgumentCount ( format ! ( "{ fun:?}" ) ) ) ;
294
+ return Err ( ExpressionError :: WrongArgumentCount ( fun. to_string ( ) ) ) ;
290
295
}
291
296
292
297
Ok ( ( ) )
@@ -978,7 +983,7 @@ impl super::Validator {
978
983
} => {
979
984
self . validate_func_call_with_overloads (
980
985
module,
981
- proc:: select:: WgslSymbol ,
986
+ format_args ! ( "`{}`" , proc:: select:: WgslSymbol . to_wgsl ( ) ) ,
982
987
proc:: select:: overloads ( ) ,
983
988
[ reject, accept, condition]
984
989
. iter ( )
@@ -1057,7 +1062,7 @@ impl super::Validator {
1057
1062
1058
1063
self . validate_func_call_with_overloads (
1059
1064
module,
1060
- fun,
1065
+ format_args ! ( "{ fun:?}" ) ,
1061
1066
fun. overloads ( ) ,
1062
1067
actuals
1063
1068
. iter ( )
0 commit comments