You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds the Felt252DictValue<T> trait bound to the Felt252DictDefault implementation, ensuring that Default<Felt252Dict<T>> is only implemented for types that are valid dictionary value types.
Type of change
Please check one:
Bug fix (fixes incorrect behavior)
New feature
Performance improvement
Documentation change with concrete technical impact
Style, wording, formatting, or typo-only change
Why is this change needed?
The Felt252DictDefault implementation was missing the Felt252DictValue<T> constraint, meaning Default<Felt252Dict<T>> could theoretically be invoked for types that are not valid dictionary value types. This constraint is required for correctness, as Felt252Dict<T> is only meaningful when T implements Felt252DictValue.
What was the behavior or documentation before?
Felt252DictDefault<T> implemented Default<Felt252Dict<T>> for any T, without requiring T to implement Felt252DictValue.
What is the behavior or documentation after?
Felt252DictDefault<T> now requires T: Felt252DictValue<T>, aligning the Default implementation with the actual constraints needed to construct and use a Felt252Dict<T>.
This is a minimal, targeted constraint fix with no behavioral change for valid usage, but it closes a gap where the trait bound was inconsistently applied compared to the rest of the Felt252Dict API.
Low Risk
Single trait-bound change in corelib with no runtime behavior change for already-valid dictionary types.
Overview
Adds Felt252DictValue<T> to the Default<Felt252Dict<T>> impl on Felt252DictDefault, matching Felt252DictImpl, Felt252DictEntryImpl, Destruct, and FromIterator.
Default::default() for Felt252Dict<T> is no longer available for types that cannot be dictionary values (those without Felt252DictValue). Valid usage such as Felt252Dict<u8> is unchanged at runtime; this only tightens type-checking at compile time.
Reviewed by Cursor Bugbot for commit 6867fc5. Bugbot is set up for automated code reviews on this repo. Configure here.
orizi
linked an issue
Jun 17, 2026
that may be
closed
by this pull request
The reason will be displayed to describe this comment to others. Learn more.
@TomerStarkware reviewed 1 file and all commit messages, and made 1 comment. Reviewable status: complete! all files reviewed, all discussions resolved (waiting on eytan-starkware).
orizi
deleted the
orizi/06-17-bugfix_corelib_disable_ability_to_dict-new_on_illegal_types
branch
June 17, 2026 15:13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the
Felt252DictValue<T>trait bound to theFelt252DictDefaultimplementation, ensuring thatDefault<Felt252Dict<T>>is only implemented for types that are valid dictionary value types.Type of change
Please check one:
Why is this change needed?
The
Felt252DictDefaultimplementation was missing theFelt252DictValue<T>constraint, meaningDefault<Felt252Dict<T>>could theoretically be invoked for types that are not valid dictionary value types. This constraint is required for correctness, asFelt252Dict<T>is only meaningful whenTimplementsFelt252DictValue.What was the behavior or documentation before?
Felt252DictDefault<T>implementedDefault<Felt252Dict<T>>for anyT, without requiringTto implementFelt252DictValue.What is the behavior or documentation after?
Felt252DictDefault<T>now requiresT: Felt252DictValue<T>, aligning theDefaultimplementation with the actual constraints needed to construct and use aFelt252Dict<T>.Related issue or discussion (if any)
#10098
Additional context
This is a minimal, targeted constraint fix with no behavioral change for valid usage, but it closes a gap where the trait bound was inconsistently applied compared to the rest of the
Felt252DictAPI.