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

[Rust] Clean up conversions between TVM and Rust functions #6114

Merged
merged 3 commits into from
Jul 23, 2020

Conversation

mwillsey
Copy link
Contributor

This PR cleans up conversions between TVM's Function and Rust functions.

The ToBoxedFn trait is removed entirely, replaced by standard From implementations.
The ToFunction and Typed traits have more logic, so they stay, but I've added the following:

  • Remove some cloning
  • Don't panic if number of args is wrong, return an error
  • Actually drop functions/closures on the rust side

I've also macro-ified some impls to make them easier to maintain, and I've added some tests to the function conversion logic that checks error handling.

- Clone one less time
- Don't panic if number of args is wrong, return an error
- Actually drop functions/closures on the rust side
@jroesch jroesch merged commit 06d7565 into apache:master Jul 23, 2020
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Aug 26, 2020
* Replace ToBoxedFn with From

* Compact and improve Typed and ToFunction impls

- Clone one less time
- Don't panic if number of args is wrong, return an error
- Actually drop functions/closures on the rust side

* Retry
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Aug 26, 2020
* Replace ToBoxedFn with From

* Compact and improve Typed and ToFunction impls

- Clone one less time
- Don't panic if number of args is wrong, return an error
- Actually drop functions/closures on the rust side

* Retry
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Sep 2, 2020
* Replace ToBoxedFn with From

* Compact and improve Typed and ToFunction impls

- Clone one less time
- Don't panic if number of args is wrong, return an error
- Actually drop functions/closures on the rust side

* Retry
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request Sep 3, 2020
* Replace ToBoxedFn with From

* Compact and improve Typed and ToFunction impls

- Clone one less time
- Don't panic if number of args is wrong, return an error
- Actually drop functions/closures on the rust side

* Retry
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.

2 participants