Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update savvy requirement from 0.6.8 to 0.7.1 in /r-harmonium/src/rust #33

Closed

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Oct 21, 2024

Updates the requirements on savvy to permit the latest version.

Changelog

Sourced from savvy's changelog.

[v0.7.1] (2024-10-21)

Bug fixes

  • NumericScalar::as_usize() and NumericSexp::iter_usize() now fail if the number is larger than 2^53 - 1 because this is the maximum number that can be safely converted to usize.

[v0.7.0] (2024-10-20)

Breaking Change

Removed TryFrom<Sexp> for usize, so the following code no longer compiles.

#[savvy]
fn foo(x: usize) -> savvy::Result<()> {
    ...
}

Instead, you can use i32 and convert it to usize by yourself. If you are sure the input number is never negative, you can just use the as conversion. If you are not sure, you should use <usize>::try_from() and handle the error by yourself. Also, please be aware you need to handle NA as well.

#[savvy]
fn foo(x: i32) -> savvy::Result<()> {
    if x.is_na() {
        return Err("cannot convert NA to usize".into())?;
    }
let x = &lt;usize&gt;::try_from(x).map_err(|e| e.to_string().into());
...

}

Alternatively, you can use newly-added methods, NumericScalar::as_usize() and NumericSexp::iter_usize(). What's good is that this can handle integer-ish numeric, which means you can allow users to input a larger number than the integer max (2147483647)!

fn usize_to_string_scalar(x: NumericScalar) -> savvy::Result<Sexp> {
    let x_usize = x.as_usize()?;
    x_usize.to_string().try_into()
}

... (truncated)

Commits
  • edd2877 chore: Release
  • db7cfbc Reject the conversion from >2^53 to usize (#313)
  • b2a4168 chore: Release
  • 3cfb6f6 Remove TryFrom\<Sexp> for usize and add NumericScalar::as_usize(), `Numeri...
  • 7c36f4f Allow unconditional_panic
  • 3b456b2 Setup R to ensure Rscript is on Path
  • 6f860a5 Fix Rust installation check in configure scripts (#304)
  • See full diff in compare view

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Updates the requirements on [savvy](https://github.com/yutannihilation/savvy) to permit the latest version.
- [Release notes](https://github.com/yutannihilation/savvy/releases)
- [Changelog](https://github.com/yutannihilation/savvy/blob/main/CHANGELOG.md)
- [Commits](yutannihilation/savvy@v0.6.8...v0.7.1)

---
updated-dependencies:
- dependency-name: savvy
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
@dependabot dependabot bot added dependencies Pull requests that update a dependency file rust Pull requests that update Rust code labels Oct 21, 2024
Copy link
Contributor Author

dependabot bot commented on behalf of github Oct 28, 2024

Superseded by #34.

@dependabot dependabot bot closed this Oct 28, 2024
@dependabot dependabot bot deleted the dependabot/cargo/r-harmonium/src/rust/savvy-0.7.1 branch October 28, 2024 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file rust Pull requests that update Rust code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants