1515 * limitations under the License.
1616 */
1717
18- use crate :: collections:: BorrowHashed ;
18+ use crate :: { collections:: BorrowHashed , values :: StringValue } ;
1919/// Deal with all aspects of runtime parameter evaluation.
2020/// First build a Parameters structure, then use collect to collect the
2121/// parameters into slots.
@@ -425,7 +425,7 @@ impl<'v, V: ValueLike<'v>> ParametersSpec<V> {
425425 None => {
426426 add_kwargs (
427427 & mut kwargs,
428- Hashed :: new_unchecked ( name. small_hash ( ) , * name_value) ,
428+ Hashed :: new_unchecked ( name. small_hash ( ) , name_value. to_value ( ) ) ,
429429 * v,
430430 ) ;
431431 }
@@ -633,7 +633,7 @@ pub struct Arguments<'v, 'a> {
633633 /// Names of named arguments.
634634 ///
635635 /// `named` length must be equal to `names` length.
636- pub names : & ' a [ ( Symbol , Value < ' v > ) ] ,
636+ pub names : & ' a [ ( Symbol , StringValue < ' v > ) ] ,
637637 /// `*args` argument.
638638 pub args : Option < Value < ' v > > ,
639639 /// `**kwargs` argument.
@@ -649,7 +649,8 @@ impl<'v, 'a> Arguments<'v, 'a> {
649649 None => {
650650 let mut result = SmallMap :: with_capacity ( self . names . len ( ) ) ;
651651 for ( k, v) in self . names . iter ( ) . zip ( self . named ) {
652- result. insert_hashed ( Hashed :: new_unchecked ( k. 0 . small_hash ( ) , k. 1 ) , * v) ;
652+ result
653+ . insert_hashed ( Hashed :: new_unchecked ( k. 0 . small_hash ( ) , k. 1 . to_value ( ) ) , * v) ;
653654 }
654655 Ok ( Dict :: new ( result) )
655656 }
@@ -664,7 +665,10 @@ impl<'v, 'a> Arguments<'v, 'a> {
664665 let mut result =
665666 SmallMap :: with_capacity ( self . names . len ( ) + kwargs. content . len ( ) ) ;
666667 for ( k, v) in self . names . iter ( ) . zip ( self . named ) {
667- result. insert_hashed ( Hashed :: new_unchecked ( k. 0 . small_hash ( ) , k. 1 ) , * v) ;
668+ result. insert_hashed (
669+ Hashed :: new_unchecked ( k. 0 . small_hash ( ) , k. 1 . to_value ( ) ) ,
670+ * v,
671+ ) ;
668672 }
669673 for ( k, v) in kwargs. iter_hashed ( ) {
670674 let s = Arguments :: unpack_kwargs_key ( * k. key ( ) ) ?;
@@ -985,7 +989,7 @@ mod test {
985989 p. kwargs = None ;
986990 let named = [ Value :: new_none ( ) ] ;
987991 p. named = & named;
988- let names = [ ( Symbol :: new ( "test" ) , heap. alloc ( "test" ) ) ] ;
992+ let names = [ ( Symbol :: new ( "test" ) , heap. alloc_string_value ( "test" ) ) ] ;
989993 p. names = & names;
990994 assert ! ( p. no_named_args( ) . is_err( ) ) ;
991995 }
0 commit comments