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

New lint: add function_abi_no_longer_unwind lint #689

Merged
merged 8 commits into from Mar 11, 2024

Conversation

qstommyshu
Copy link
Contributor

This PR is to implement the second task in #503

Copy link
Owner

@obi1kenobi obi1kenobi left a comment

Choose a reason for hiding this comment

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

The lint query looks good! There are a few issues in the metadata that need fixing, and I recommend taking a close look at other ABI-related lints and using them as inspiration here.

src/lints/unwind_function_missing.ron Outdated Show resolved Hide resolved
SemverQuery(
id: "unwind_function_missing",
human_readable_name: "unwind function missing",
description: "pub fn changed from an unwind-capable ABI to the same-named ABI without unwind: \"C-unwind\" to \"C\"",
Copy link
Owner

Choose a reason for hiding this comment

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

We don't necessarily know that the change was specifically C-unwind to C. It's possible that the change is from a different unwind-capable ABI to its non-unwind-capable equivalent.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see, I will change the description to "pub fn changed from an unwind-capable ABI to the same-named ABI without unwind" then. So that the description doesn't specify if the change was specifically C-unwind to C to anticipate new types of unwind capable ABI being added to rust in the future (although I don't know any other unwind capable FFI other than C-unwind so far). Is this an appropriate approach to address this issue?

Copy link
Owner

Choose a reason for hiding this comment

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

Sounds good to me!

Here are a few more unwind-capable ABIs in case you're curious: https://github.com/rust-lang/rfcs/blob/master/text/2945-c-unwind-abi.md#other-unwind-abi-strings

If we expand the set to not-yet-stable ABIs, the set is even bigger:
https://doc.rust-lang.org/beta/unstable-book/language-features/c-unwind.html

We might want to use the RFC that introduced unwind ABIs as the reference link on line 6 btw: https://github.com/rust-lang/rfcs/blob/master/text/2945-c-unwind-abi.md

human_readable_name: "unwind function missing",
description: "pub fn changed from an unwind-capable ABI to the same-named ABI without unwind: \"C-unwind\" to \"C\"",
required_update: Major,
reference_link: None,
Copy link
Owner

Choose a reason for hiding this comment

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

Please include an appropriate reference link here. Anything is better than nothing. For example, we could link to the reference page that other ABI-related lints use, if there's nothing more specific.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Attached the proposal to add C-unwind ABI. It contains lots of information about the design and behaviours. It also links to the RFC PR and issue to C-unwind.

src/lints/unwind_function_missing.ron Outdated Show resolved Hide resolved
test_crates/unwind_function_missing/new/src/lib.rs Outdated Show resolved Hide resolved
@obi1kenobi obi1kenobi mentioned this pull request Mar 11, 2024
4 tasks
qstommyshu and others added 3 commits March 11, 2024 08:45
add trailing newline to unwind_function_missing.ron

Co-authored-by: Predrag Gruevski <2348618+obi1kenobi@users.noreply.github.com>
Co-authored-by: Predrag Gruevski <2348618+obi1kenobi@users.noreply.github.com>
@qstommyshu qstommyshu changed the title add unwind_function_missing lint add function_abi_no_longer_unwind lint Mar 11, 2024
@qstommyshu qstommyshu changed the title add function_abi_no_longer_unwind lint New lint: add function_abi_no_longer_unwind lint Mar 11, 2024
Copy link
Owner

@obi1kenobi obi1kenobi left a comment

Choose a reason for hiding this comment

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

Very nice! I added a brief bit of extra info to help users understand why this is a major breaking change, and will merge this promptly.

I'm planning to make a new release later today, and this lint will be part of it!

src/lints/function_abi_no_longer_unwind.ron Outdated Show resolved Hide resolved
src/lints/function_abi_no_longer_unwind.ron Outdated Show resolved Hide resolved
@obi1kenobi obi1kenobi enabled auto-merge (squash) March 11, 2024 17:21
@obi1kenobi obi1kenobi merged commit 97e37b3 into obi1kenobi:main Mar 11, 2024
30 checks passed
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.

None yet

2 participants