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

fix: Fix proc macro ABI version checks #10799

Merged
merged 1 commit into from
Nov 18, 2021
Merged

Conversation

lnicola
Copy link
Member

@lnicola lnicola commented Nov 18, 2021

If I'm reading this right, we used to pick Abi1_55 for 1.54 and Abi_1_58 for 1.57.

CC @alexjg (just in case I'm misinterpreting the code), CC #10772.

bors r+

bors bot added a commit that referenced this pull request Nov 18, 2021
10799: fix: Fix proc macro ABI version checks r=lnicola a=lnicola

If I'm reading this right, we used to pick `Abi1_55` for `1.54` and `Abi_1_58` for `1.57`.

CC `@alexjg` (just in case I'm misinterpreting the code), CC #10772.

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
@bjorn3
Copy link
Member

bjorn3 commented Nov 18, 2021

The old code is correct too. It writes < and not <=.

@lnicola
Copy link
Member Author

lnicola commented Nov 18, 2021

bors r-

@bors
Copy link
Contributor

bors bot commented Nov 18, 2021

Canceled.

@lnicola
Copy link
Member Author

lnicola commented Nov 18, 2021

Doesn't it pick 1.55 for 54?

let inner = unsafe { Abi_1_47::from_lib(lib, symbol_name) }?;
Ok(Abi::Abi1_47(inner))
} else if info.version.1 < 56 {
let inner = unsafe { Abi_1_55::from_lib(lib, symbol_name) }?;
Copy link
Member

Choose a reason for hiding this comment

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

Say the minor version is 55, then < 54 is false but < 56 is true, so it ends up at this line, using the 1.55 abi.

Copy link
Member Author

Choose a reason for hiding this comment

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

No, let's say the minor is 54.

Copy link
Member

Choose a reason for hiding this comment

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

Right, then it still ends up using 1.55, so the old code is wrong. In any case your code is much clearer.

@lnicola
Copy link
Member Author

lnicola commented Nov 18, 2021

I'm still slightly worried about what happens between version bumps (say around the beta versions), but I hope it's not worse than before. This fixes a crash with beta on my machine.

bors r+

@bors
Copy link
Contributor

bors bot commented Nov 18, 2021

@bors bors bot merged commit ea01a3a into rust-lang:master Nov 18, 2021
@lnicola lnicola deleted the abi-versions branch November 18, 2021 08:56
@flodiebold
Copy link
Member

Maybe we're supporting too many ABIs? 😬

@Veykril
Copy link
Member

Veykril commented Nov 18, 2021

I think there are a few 1.58 nightlies(the early ones) that use the non 1.58 abi which causes us to crash. At least that was what I experienced before updating my 1.58 install I believe.

@lnicola
Copy link
Member Author

lnicola commented Nov 18, 2021

Yeah, probably, but we shouldn't go out of our way to support older nightlies in the current (or in a previous) release cycle.

I think someone asked for this (in the current release cycle), but it felt like it was some sort of an XY problem.

EDIT: that was @Dessix in #9550 (comment).

Many repositories- my own included- pin a working nightly in rust-toolchain to avoid breakages in CI. If an ABI changes multiple times in the same target version, we could still end up with non-functioning rust-toolchain options despite having gone through the effort of making various ABIs work.

To put it clearly, I'm against it because adding support for a new ABI is something that lately only @alexjg has done. Most code is lifted from rustc, but I think there are some non-trivial integration changes that need to be applied over that.

@alexjg
Copy link
Contributor

alexjg commented Nov 18, 2021

I can write a few extra docs on the process for adding a new ABI. It's fairly mechanical.

bors bot added a commit that referenced this pull request Jan 4, 2022
11187: Rename and use the 1.55 ABI for 1.54 r=lnicola a=lnicola

It seems that what we used to call the 1.55 ABI was actually introduced in 1.54.

CC #10799

Thanks to `@danielframpton` for finding it.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
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.

5 participants