-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Inference issues with trait constification #148028
Copy link
Copy link
Open
Labels
A-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.I-types-nominatedNominated for discussion during a types team meeting.Nominated for discussion during a types team meeting.PG-const-traitsProject group: Const traitsProject group: Const traitsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.I-types-nominatedNominated for discussion during a types team meeting.Nominated for discussion during a types team meeting.PG-const-traitsProject group: Const traitsProject group: Const traitsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
I'm just going to file an issue for this so it's tracked somewhere.
Tracking for
const_convertfeature: #143773Essentially, Implementations for
Cowwere reverted (#148011 and #148016) due to inference failures on beta (see #147964):The main issue here is the extra
whereclauses adding bounds which are technically redundant, but required for constness. We could fix these by making these contingent onconst ToOwned, but I intentionally didn't do that in the initial implementation because it wasn't necessary: only const borrowing is necessary here, not const allocation.Perhaps the trait solver could correctly identify these where clauses as being "redundant" except for constness to avoid the issues, or maybe next-solver fixes this. Either way, constification of these is probably blocked in the meantime, and I doubt these are going to be the only decisions going forward.
The reality is that constifying traits generally involves a lot of where clauses that might mess with the trait solver, and something needs to be decided on that.
Extra note:
Derefwas specifically not de-constified properly in 1.57.0, so it has been changed a bit.(note, I'm using modern syntax for this for ease of reading, but technically the const trait syntax changed between 1.57.0 and 1.90.0)
The decision was made to keep the status quo this close to the 1.90.0 stable release, but the revert to the pre-1.57 version is still on the 1.91.0 beta for now.