-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[missing_const_for_fn
]: fix suggestions for fn with abi that requires const_extern_fn
feature
#13037
Conversation
extern "C-unwind" fn c_unwind() {} | ||
extern "system" fn system() {} | ||
extern "system-unwind" fn system_unwind() {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a little bit unsure should we report these with help messages like "if your are on nightly toolchain, enable const_extern_fn
feature with #![feature(const_extern_fn)]
" instead of just skip them, it surely will make some noise tho.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you really want to add that and can detect that a nightly toolchain is a build requirement (for example via a toolchain file), I'm not opposed to it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, that reminds me I probably (???) could use this cx.sess().is_nightly_build
to check that but I assume it will be useless in our test cases, since it will be true
in all of them...
Well, I'll keep this in mind for future reference, maybe we could have some attribute like #[clippy::toolchain = "nightly"]
in the future if that function turns out to be useful, but for now this might be fine (I think)~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the record, the problem with is_nightly_build
is that it's true when compiled on nightly. This is the wrong criteria, the code might still accept compiling on stable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh right... I see, that'll made the users having to force nightly toolchain if they only follow the suggestion once...
hmmm, I understand why you mentioned "via a toolchain file" now, as it seems like the only sensible way here. But doing so would require clippy to have some basic de-serializer written to match that file, and I saw there's a security flaw with that file on this rustup issue, so I'm expecting rustup
to make some changes regarding that file, meaning that we'll have to change them too~
For these reasons I think it might not worth the efforts, and lets just call this perfect imperfection :D
…es `const_extern_fn` feature
This already looks merge-worthy. So r=me unless you want to change something. @bors delegate+ |
✌️ @J-ZhengLi, you can now approve this pull request! If @llogiq told you to " |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
closes: #13008
changelog: [
missing_const_for_fn
]: fix suggestions for fn with abi that requiresconst_extern_fn
feature.