Skip to content

Remove InvalidInternalKey variant from TaprootBuilderError#2887

Merged
apoelstra merged 2 commits intorust-bitcoin:masterfrom
tcharding:06-20-rm-internal-key-variant
Jun 23, 2024
Merged

Remove InvalidInternalKey variant from TaprootBuilderError#2887
apoelstra merged 2 commits intorust-bitcoin:masterfrom
tcharding:06-20-rm-internal-key-variant

Conversation

@tcharding
Copy link
Copy Markdown
Member

This variant is unused, remove it.

Done as part of #2883.

@github-actions github-actions bot added the C-bitcoin PRs modifying the bitcoin crate label Jun 20, 2024
Copy link
Copy Markdown
Collaborator

@Kixunil Kixunil left a comment

Choose a reason for hiding this comment

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

ACK 7265560

@Kixunil
Copy link
Copy Markdown
Collaborator

Kixunil commented Jun 21, 2024

Side notes: what made it no longer needed? We should take a huge care to avoid these situations since after 1.0 we'll be stuck with unused variants.

@tcharding
Copy link
Copy Markdown
Member Author

Yes, I'd love to have some tooling to find these unused variants but I don't know of any?

@Kixunil
Copy link
Copy Markdown
Collaborator

Kixunil commented Jun 22, 2024

I was mainly pointing at whatever caused the variant to be there in the first place - likely not great design. This is also the exact reason I suggested to hide all the errors first and only unhide them later when we're confident about what they should be.

@apoelstra
Copy link
Copy Markdown
Member

Weirdly it appears to have been introduced in #677 but never used even then. I guess it was a rebasing error of some sort.

@tcharding re tooling -- one thing you can do is change all the error enums from pub to private (or maybe pub(crate)) and then see what warnings come up. I'm not sure if we can do that programmatically.

Copy link
Copy Markdown
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ACK 7265560

@apoelstra apoelstra merged commit 0974085 into rust-bitcoin:master Jun 23, 2024
@tcharding
Copy link
Copy Markdown
Member Author

tcharding commented Jun 23, 2024

I did the pub -> pub(crate) change using a perl oneliner but then clippy chokes a million times on

warning: type `parse::PrefixedHexError` is more private than the item `parse::hex_u32_prefixed`

I do not know if the lack of "variant foo never constructed" warnings means that they don't exist or that clippy just stops before getting to checking unused variants?

@apoelstra
Copy link
Copy Markdown
Member

I think it means they don't exist. But yeah, it's super annoying to reduced visibility without rustc complaining these days. You might be able to use 1.56.1 and it'll compalin less while still complaining about never-constructed variats.

@tcharding
Copy link
Copy Markdown
Member Author

Drats, even worse, with 1.56.1 they are errors not warnings.

@Kixunil
Copy link
Copy Markdown
Collaborator

Kixunil commented Jun 24, 2024

They're trying to prevent libraries from having broken API by having non-public items in the API. Sadly, there's no tool that I know of to prevent having a bad API by having an unneeded variant.

@apoelstra
Copy link
Copy Markdown
Member

This is pretty obnoxious, given that it's totally possible to have non-public items in your API (and this "feature" is even abused in sealing constructions etc).

I'm simultaneously dealing with "non-public items in API" in BlockstreamResearch/rust-simplicity#219 while the compiler is spamming Tobin with this useless nonsense..

@tcharding tcharding deleted the 06-20-rm-internal-key-variant branch June 26, 2024 05:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-bitcoin PRs modifying the bitcoin crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants