Skip to content

ConstrainedInteger: From -> TryFrom#425

Merged
XAMPPRocky merged 1 commit intolibrasn:mainfrom
Nicceboy:fix-int-constraints-err
Mar 10, 2025
Merged

ConstrainedInteger: From -> TryFrom#425
XAMPPRocky merged 1 commit intolibrasn:mainfrom
Nicceboy:fix-int-constraints-err

Conversation

@Nicceboy
Copy link
Copy Markdown
Contributor

Fixes #399

Additionally changes inner type of ConstrainedInteger to i128 since it does not currently make much sense to use Integer here.

@Nicceboy Nicceboy changed the title ConstrainedInteger: From -> TryFrom, inner constraint now i128 ConstrainedInteger: From -> TryFrom, inner integer type now i128 Mar 10, 2025
@XAMPPRocky
Copy link
Copy Markdown
Collaborator

Additionally changes inner type of ConstrainedInteger to i128 since it does not currently make much sense to use Integer here.

Thank you for your PR! I'm not sure if it does make more sense. I haven't communicated this but I have been experimenting with trying to make Integer a single pointer width using pointer provenance, and if we can implement that, then Integer will be smaller than i128.

@Nicceboy Nicceboy force-pushed the fix-int-constraints-err branch 2 times, most recently from 0fe421c to 4cd3927 Compare March 10, 2025 12:34
@Nicceboy Nicceboy force-pushed the fix-int-constraints-err branch from 4cd3927 to fe1a6f8 Compare March 10, 2025 12:38
@Nicceboy
Copy link
Copy Markdown
Contributor Author

Ah, I reverted that change but kept the isize, i32, i64, i128 only in try_from since it forces the type size to be in constraint range and solves the issue with overlapping implementations and is likely enough for all use cases.

@Nicceboy Nicceboy changed the title ConstrainedInteger: From -> TryFrom, inner integer type now i128 ConstrainedInteger: From -> TryFrom Mar 10, 2025
@XAMPPRocky XAMPPRocky merged commit 74fc454 into librasn:main Mar 10, 2025
@github-actions github-actions Bot mentioned this pull request Mar 10, 2025
@Nicceboy Nicceboy deleted the fix-int-constraints-err branch April 9, 2025 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ConstrainedInteger's From impl allows for creating a ConstrainedInteger which is outside of the allowed range

2 participants