diff options
author | Florian Klink <flokli@flokli.de> | 2024-01-23T12·54+0200 |
---|---|---|
committer | flokli <flokli@flokli.de> | 2024-01-24T14·00+0000 |
commit | e1d25891638597b0085033fd99814fce83fab4b9 (patch) | |
tree | 60f8250dfe2780430e3cbc0ae810426955094ca7 /tvix/eval/src/value | |
parent | adff7be4d15e9c038e1600559d5d7226023c3c73 (diff) |
fix(tvix/eval/value/function): use BTreeMap for function arg names r/7447
At least toXML wants to get these out in a sorted fashion. Change-Id: I6373d7488fff7c40dc2ddeeecd03ba537c92c4af Reviewed-on: https://cl.tvl.fyi/c/depot/+/10685 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval/src/value')
-rw-r--r-- | tvix/eval/src/value/function.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tvix/eval/src/value/function.rs b/tvix/eval/src/value/function.rs index 77ac7112d2cb..8131cffa0230 100644 --- a/tvix/eval/src/value/function.rs +++ b/tvix/eval/src/value/function.rs @@ -1,5 +1,5 @@ //! This module implements the runtime representation of functions. -use std::{collections::HashMap, hash::Hash, rc::Rc}; +use std::{collections::BTreeMap, hash::Hash, rc::Rc}; use codemap::Span; use smol_str::SmolStr; @@ -11,7 +11,7 @@ use super::NixString; #[derive(Clone, Debug, PartialEq)] pub(crate) struct Formals { /// Map from argument name, to whether that argument is required - pub(crate) arguments: HashMap<NixString, bool>, + pub(crate) arguments: BTreeMap<NixString, bool>, /// Do the formals of this function accept extra arguments pub(crate) ellipsis: bool, @@ -27,7 +27,7 @@ impl Formals { /// ellipsis pub(crate) fn contains<Q>(&self, arg: &Q) -> bool where - Q: ?Sized + Hash + Eq, + Q: ?Sized + Hash + Ord + Eq, NixString: std::borrow::Borrow<Q>, { self.ellipsis || self.arguments.contains_key(arg) |