-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
deny using default function in impl const Trait #86571
Conversation
r? @jackh726 (rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
62a07b7
to
22a8d46
Compare
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 wondering if this would catch super trait functions. Can you add a test for that?
@rustbot label -S-waiting-on-author +S-waiting-on-review |
.filter(|it| matches!(it.kind, hir::AssocItemKind::Fn { .. })) | ||
.count(); | ||
|
||
if trait_fn_cnt != impl_fn_cnt { |
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.
Also, this is kind of a hacky way to check if there are any non-implemented default functions. But it might just be the best.
I don't understand, because with Is there anything about super traits (and default implementations of functions of those) that it should catch? There is no way for a sub-trait to specify default impls for a super-trait, right? |
cc @oli-obk |
Ah, you're right. Not sure about if |
31f1d29
to
5e178b2
Compare
@rustbot label -S-waiting-on-author +S-waiting-on-review |
@bors r+ |
📌 Commit 5e178b2 has been approved by |
☀️ Test successful - checks-actions |
Fixes #79450.
I don't know if my implementation is correct:
rustc_passes::check_const
, should I put it somewhere else instead?