-
Notifications
You must be signed in to change notification settings - Fork 1
Add ruby-rbs-sys Rust crate with FFI bindings for RBS parser #47
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
base: master
Are you sure you want to change the base?
Conversation
|
^ Looks like Rust CI is working as intended 👀 |
825c965 to
223d780
Compare
rust/ruby-rbs-sys/build.rs
Outdated
| fn source_files<P: AsRef<Path>>(root_dir: P) -> Vec<String> { | ||
| let mut files = Vec::new(); | ||
|
|
||
| for entry in fs::read_dir(root_dir.as_ref()).unwrap() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| for entry in fs::read_dir(root_dir.as_ref()).unwrap() { | |
| for entry in fs::read_dir(root_dir.as_ref()).map_err(|e| format!("Failed to read source directory: {}", e))? { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly here, if you map the error into a string, what happens with the for loop?
rust/ruby-rbs-sys/build.rs
Outdated
| let path = entry.path(); | ||
|
|
||
| if path.is_file() { | ||
| let path = path.to_str().unwrap().to_string(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| let path = path.to_str().unwrap().to_string(); | |
| let path = path.to_str() | |
| .ok_or_else(|| format!("Invalid UTF-8 in filename: {:?}", path))? | |
| .to_string(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this too would put a string in a place where we expect a file path.
f7071bc to
4f43565
Compare
vinistock
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM at this point. With the addition of the second crate, we may discover the need for a few adjustments, but it seems ready
| branches: | ||
| - master |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the branches part necessary? We want this to run on any commit that matches the given paths, so maybe we can remove this?
7ac55a5 to
4de62ba
Compare
|
@alexcrocha This PR looks fine to me. I think rebasing on top of the latest trunk would fix the test failure. |
This establishes the foundation for using RBS functionality from Rust. - Generated FFI bindings via bindgen from RBS C headers - Set up build configuration to link with the RBS library - Added initial tests for basic functionality (constant pool, parser) - Configured workspace structure in rust/Cargo.toml The -sys crate follows Rust conventions for FFI bindings, keeping raw unsafe bindings separate from future safe API wrappers. Future commits will add a separate safe wrapper crate on top of these bindings.
The -sys crate follows Rust conventions for FFI bindings, keeping raw unsafe bindings separate from future safe API wrappers.
Future commits will add a separate safe wrapper crate on top of these bindings.