Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The changes are pretty primitive at this point. But at least it works. ^-^
Problems with the current change that I can think of now:
~const Dropshouldn't change anything in the non-const world.~const Dropin const contexts.struct S { a: u8, b: u16 }This might not fail forneeds_non_const_drop, but it will fail inrustc_trait_selection.const Dropimpls but have non-constDropglue.Fixes #88424.
Significant Changes:
~const Dropis no longer treated as a normal trait bound. In non-const contexts, this bound has no effect, but in const contexts, this restricts the input type and all of its transitive fields to either a) have aconst Dropimpl or b) can be trivially dropped (i.e. no drop glue)T: ~const Dropwill not be linted likeT: Drop.rustc_mir::transform::check_consts, we use the trait system to special case~const Drop. Seerustc_trait_selection::...::candidate_assembly#assemble_const_drop_candidatesand others.Changes not related to
const Dropping and/or changes that are insignificant:Node.constness_for_typeckno longer returnshir::Constness::Constfor type aliases in traits. This was previously used to hack how we determine default bound constness for items. But because we now use an explicit opt-in, it is no longer needed.is_const_impl_rawquery. We haveimpl_constness, and the only existing use of that query usesHirId, which means we can just operate it with hir.ty::Destructornow has a fieldconstness, which represents the constness of the destructor.r? @oli-obk