Skip to content

Commit

Permalink
Deprecate Dict::new
Browse files Browse the repository at this point in the history
Summary:
* We may want to have more efficient dict representation on the heap, for example, store dict data in starlark heap rather than malloc, this is how list is implemented
* This code is function is not as useful when typechecking and documentation is important: if we allocate the dict explicitly, and pass it to `heap.alloc()`, we no longer can use it as function return value

Reviewed By: shonaganuma

Differential Revision: D50484424

fbshipit-source-id: 2514b537c0a3790c8ec812971e11c479348975fc
  • Loading branch information
stepancheg authored and facebook-github-bot committed Oct 21, 2023
1 parent 02d42ed commit 12eee0c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion starlark/src/values/types/dict/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@ impl<'v> Dict<'v> {
DictGen::<FrozenDictData>::get_type_value_static()
}

/// Create a new [`Dict`].
/// This function is deprecated.
/// Use [`AllocDict`](crate::values::dict::AllocDict) or [`SmallMap`]
/// to allocate a new dictionary on the heap.
pub fn new(content: SmallMap<Value<'v>, Value<'v>>) -> Self {
Self { content }
}
Expand Down

0 comments on commit 12eee0c

Please sign in to comment.