Skip to content

Comments

emit rustc-check-cfg only on rust 1.80+#4168

Merged
davidhewitt merged 1 commit intoPyO3:mainfrom
davidhewitt:check-cfg-1.63
May 15, 2024
Merged

emit rustc-check-cfg only on rust 1.80+#4168
davidhewitt merged 1 commit intoPyO3:mainfrom
davidhewitt:check-cfg-1.63

Conversation

@davidhewitt
Copy link
Member

Testing on MSRV just now I got a lot of build warnings on the console:

warning: cargo:rustc-check-cfg requires -Zcheck-cfg=output flag
warning: cargo:rustc-check-cfg requires -Zcheck-cfg=output flag
warning: cargo:rustc-check-cfg requires -Zcheck-cfg=output flag
warning: cargo:rustc-check-cfg requires -Zcheck-cfg=output flag
warning: cargo:rustc-check-cfg requires -Zcheck-cfg=output flag
warning: cargo:rustc-check-cfg requires -Zcheck-cfg=output flag
warning: cargo:rustc-check-cfg requires -Zcheck-cfg=output flag
warning: cargo:rustc-check-cfg requires -Zcheck-cfg=output flag
warning: cargo:rustc-check-cfg requires -Zcheck-cfg=output flag
warning: cargo:rustc-check-cfg requires -Zcheck-cfg=output flag
warning: cargo:rustc-check-cfg requires -Zcheck-cfg=output flag
warning: cargo:rustc-check-cfg requires -Zcheck-cfg=output flag
warning: cargo:rustc-check-cfg requires -Zcheck-cfg=output flag
warning: cargo:rustc-check-cfg requires -Zcheck-cfg=output flag
warning: cargo:rustc-check-cfg requires -Zcheck-cfg=output flag
warning: cargo:rustc-check-cfg requires -Zcheck-cfg=output flag
warning: cargo:rustc-check-cfg requires -Zcheck-cfg=output flag
warning: cargo:rustc-check-cfg requires -Zcheck-cfg=output flag
warning: cargo:rustc-check-cfg requires -Zcheck-cfg=output flag
warning: cargo:rustc-check-cfg requires -Zcheck-cfg=output flag
warning: cargo:rustc-check-cfg requires -Zcheck-cfg=output flag
warning: cargo:rustc-check-cfg requires -Zcheck-cfg=output flag
warning: cargo:rustc-check-cfg requires -Zcheck-cfg=output flag
warning: cargo:rustc-check-cfg requires -Zcheck-cfg=output flag

... so I guess let's gate these behind a version check.

@davidhewitt davidhewitt added the CI-skip-changelog Skip checking changelog entry label May 9, 2024
Copy link
Member

@Icxolu Icxolu left a comment

Choose a reason for hiding this comment

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

Makes sense. I thought I tested it when i added them in #4163, and didn't see anything. But I can reproduce this as well (and there also in the CI log), so I guess I'm misremembering or something 🤷 . Given that we now check the rustc version we can maybe also switch to the cargo:: (double colon) variant, which is preferred since 1.77.

@davidhewitt
Copy link
Member Author

Ah, looks like cargo explicitly rejects that due to the lower msrv. I guess I'll drop that second commit and merge?

}
pieces.next()?.parse().ok()
})
.clone()
Copy link
Member

Choose a reason for hiding this comment

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

Clippy also appears to be unhappy about this clone call:

grafik

@adamreichold
Copy link
Member

Ah, looks like cargo explicitly rejects that due to the lower msrv. I guess I'll drop that second commit and merge?

As a short-team solution yes, but I think Cargo is a bit overzealous here as they statically second-guess code which can adjust itself at runtime. Will the old format ever be phased out? What if the range between the current version and our MSRV saddles that release and we have to dynamically adjust?

@davidhewitt
Copy link
Member Author

Agreed, I asked about this in rust-lang/cargo#13868 (comment)

@davidhewitt davidhewitt added this pull request to the merge queue May 15, 2024
Merged via the queue into PyO3:main with commit 7790dab May 15, 2024
@davidhewitt davidhewitt deleted the check-cfg-1.63 branch May 15, 2024 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI-skip-changelog Skip checking changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants