Skip to content

Add NonZeroSign type to ensure proper sign handling#652

Merged
nekevss merged 5 commits intomainfrom
update-sign-handling
Dec 16, 2025
Merged

Add NonZeroSign type to ensure proper sign handling#652
nekevss merged 5 commits intomainfrom
update-sign-handling

Conversation

@nekevss
Copy link
Copy Markdown
Member

@nekevss nekevss commented Dec 16, 2025

This adds a NonZeroSign type to lib.rs and makes appropriate adjustments for the new type.

Open question is with a Sign and NonZeroSign type now in temporal_rs. Should we move them to their own sign module or keep them in the crate root?

@nekevss nekevss added the C-internal Internal library improvements label Dec 16, 2025
@nekevss nekevss requested a review from Manishearth December 16, 2025 01:37
Copy link
Copy Markdown
Contributor

@Manishearth Manishearth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks mostly correct! Worth running through test262 but is probably fine.

Comment thread src/builtins/core/zoned_date_time.rs Outdated
} else {
Sign::Positive
};
let sign = Sign::from(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: why not NonZeroSign::from?

Copy link
Copy Markdown
Member Author

@nekevss nekevss Dec 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can add it in. The main reason was because I was a bit over cautious about adding in an extra from implementation. Wait, actually this is a good question.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think an extra From impl is fine.

@nekevss nekevss merged commit fe975d7 into main Dec 16, 2025
8 checks passed
@nekevss nekevss deleted the update-sign-handling branch December 21, 2025 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-internal Internal library improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants