-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Trait methods inherit trait const stability, do not inherit const stability from their own regular stability #136319
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
base: master
Are you sure you want to change the base?
Conversation
It definitely should get rewritten, this code is a mess and I was hoping I don't have to see it again.^^ |
@rustbot author |
159a5fb
to
f419a33
Compare
This comment was marked as resolved.
This comment was marked as resolved.
This comment has been minimized.
This comment has been minimized.
gah rebase error |
…bility from their own regular stability
f419a33
to
096033a
Compare
@rustbot ready |
fn_sig.is_none_or(|s| !s.header.is_const()), | ||
"should never have parent const stability for a const fn" | ||
); | ||
self.index.const_stab_map.insert(def_id, parent); |
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.
Shouldn't this be const_stab = parent
?
Right now, it seems like we could then enter the if
below which actually sets const_stab
to Some
and then that gets inserted into the table.
&& let Some(parent) = self.parent_const_stab | ||
&& parent.is_const_unstable() | ||
{ | ||
// For now, `const fn` in const traits/trait impls does not exist. |
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 now, `const fn` in const traits/trait impls does not exist. | |
// For now, `const fn` in const traits/trait impls does not exist. | |
// If we ever support that, the logic here and also the const-stability enforcement | |
// logic needs some re-thinking. |
@rustbot author |
Needed to constify
PartialEq
:Since currently, we get const stability errors in
fn ne
, since it's currently considered to be const stable via inheriting const stability from its own regular stability, rather than from the parent trait, and thus we can't callSelf::eq
b/c it requires theconst_trait_impl
andconst_cmp
features.We do two changes:
InheritConstStability::Yes
for trait items.cc @rust-lang/project-const-generics
r? RalfJung
This stability computation code is kinda jank, maybe it should get rewritten :S