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

FFI related paper cuts in driver ↔ lint-crate communication #37

Open
5 of 7 tasks
xFrednet opened this issue Sep 2, 2022 · 2 comments
Open
5 of 7 tasks

FFI related paper cuts in driver ↔ lint-crate communication #37

xFrednet opened this issue Sep 2, 2022 · 2 comments
Labels
A-driver Area: Driver or something related to the internal working of a driver. C-tracking-issue Category: Tracking issue I-unsound Issue: A part of the linter API that's unsound or uses undefined behavior

Comments

@xFrednet
Copy link
Member

xFrednet commented Sep 2, 2022

When I created the prototype, I hacked together a basic driver ↔ lint-crate communication. After reworking the communication and learning more about FFI stuff, it turns out that the current implementation is unsound. This is a collection of all issues that need to be fixed:

Note: We can change #[repr(C)] to a different ABI as long as it's stable like C

@xFrednet xFrednet added C-tracking-issue Category: Tracking issue I-unsound Issue: A part of the linter API that's unsound or uses undefined behavior A-driver Area: Driver or something related to the internal working of a driver. labels Sep 2, 2022
@xFrednet
Copy link
Member Author

xFrednet commented Sep 2, 2022

I'm currently slowly working on these, while designing the AST. The last few PRs already made some good progress, like adding the FFI module to linter_api

@xFrednet
Copy link
Member Author

A lot of progress on this has been made in #54 as it removes a lot of dyn and traits. The API is not totally FFI safe, but has a good baseline by my estimation

bors bot added a commit that referenced this issue Jul 11, 2023
164: API: Follow "Rust API Guidelines", Seal traits 🦭 and use enums instead of bools r=xFrednet a=xFrednet

I generally checked the [Rust API Guidelines](https://rust-lang.github.io/api-guidelines/checklist.html). One of the most important changes is the new `Sealed` trait, to prevent lint crates from implementing Marker's API traits.

I've also added new `Mutability`, `Constness`, and `Syncness` enums, to remove boolean flags. I wanted to do this for some time, for the case that [keyword generics](https://blog.rust-lang.org/inside-rust/2022/07/27/keyword-generics.html) ever get added or some other magic. Having them shouldn't hurt, either way :)

Oh, and I also added a missing `#[repr(C)]`. That one should hopefully be the last missing one. (cc: #37)

---

Closes: #163

Co-authored-by: xFrednet <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-driver Area: Driver or something related to the internal working of a driver. C-tracking-issue Category: Tracking issue I-unsound Issue: A part of the linter API that's unsound or uses undefined behavior
Projects
None yet
Development

No branches or pull requests

1 participant