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

Methods on generated flags types not being detected as const #337

Closed
KodrAus opened this issue Apr 11, 2023 · 6 comments
Closed

Methods on generated flags types not being detected as const #337

KodrAus opened this issue Apr 11, 2023 · 6 comments

Comments

@KodrAus
Copy link
Member

KodrAus commented Apr 11, 2023

          I am getting this (cut for brevity):

image

The very strange thing is that docs.rs does indeed show those as const. But my local build of the docs shows them as not const:

image

EDIT: I should have been more clear: docs.rs shows these fns as const in the bitflags 2.0.x docs. Building my own docs for my crate locally shows that they are not const with 2.x. But the docs for my crate on docs.rs are const using bitflags 1.3.x, and that is what is triggering semver-checks to fail.

Originally posted by @molpopgen in #310 (comment)

@KodrAus
Copy link
Member Author

KodrAus commented Apr 11, 2023

@molpopgen Did you ever get to the bottom of this? Would it be possible to share your version of rustc you're using to build with?

@molpopgen
Copy link

No, I haven't solved it. I put off an upgrade until there's another reason to bump the minor version. (The crate in question is pre-1.0 still).

❯ rustc --version
rustc 1.68.2 (9eb3afe9e 2023-03-27)

@KodrAus
Copy link
Member Author

KodrAus commented Apr 12, 2023

Hmm, this looks like it could be a rustdoc bug that was fixed at some point? If I upgrade tskit to bitflags 2 and build the docs with rustc 1.70.0-nightly I see the methods appear as const:

Screenshot 2023-04-12 at 5 54 17 pm

If I rebuild using 1.68.2 I don't see them as const:

Screenshot 2023-04-12 at 5 58 02 pm

They do appear to be const though. If I add a const fn that uses them, methods like intersects still work.

@molpopgen
Copy link

Very interesting. I'll try to confirm this myself later today. The possibility of rustdoc bugs is definitely a weakness for using semver-checks in one's CI :(.

@molpopgen
Copy link

I confirmed this on my end -- now only the removal of from_bits_unchecked gets flagged. I think we can close this one.

@KodrAus
Copy link
Member Author

KodrAus commented Apr 12, 2023

Thanks @molpopgen!

Yeh, it seems like there have been a few issues specifically around consts that have been getting ironed out with rustdoc lately. It looks like they're pretty swiftly resolved though.

I'll go ahead and close this one, but please do open fresh issues for anything else you encounter!

@KodrAus KodrAus closed this as completed Apr 12, 2023
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

No branches or pull requests

2 participants