-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
We don't reject const auto traits #149285
Copy link
Copy link
Closed
Labels
A-auto-traitsArea: auto traits (e.g., `auto trait Send {}`)Area: auto traits (e.g., `auto trait Send {}`)C-bugCategory: This is a bug.Category: This is a bug.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.F-auto_traits`#![feature(auto_traits)]``#![feature(auto_traits)]`F-const_trait_impl`#![feature(const_trait_impl)]``#![feature(const_trait_impl)]`P-lowLow priorityLow priorityPG-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.
Metadata
Metadata
Assignees
Labels
A-auto-traitsArea: auto traits (e.g., `auto trait Send {}`)Area: auto traits (e.g., `auto trait Send {}`)C-bugCategory: This is a bug.Category: This is a bug.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.F-auto_traits`#![feature(auto_traits)]``#![feature(auto_traits)]`F-const_trait_impl`#![feature(const_trait_impl)]``#![feature(const_trait_impl)]`P-lowLow priorityLow priorityPG-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.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Auto traits are just markers, mere flags. Marking them const doesn't serve much purpose. If you're longing for
AutoBoundvs.const AutoBound, just introduce another auto trait:AutoBoundvs.AnotherAutoBound. The utility of[const] AutoBoundis also questionable to me.Moreover, today, the constness of auto traits doesn't "propagate" (i.e., built-in auto trait impl candidates are always non-const), so one can't actually benefit from the autoness of the const trait. We should keep it that way IMO & forbid const auto traits, not sure if anybody would disagree.
As an aside, we currently intentionally panic in the next-gen solver when trying to prove a host effect predicate where the corresp. trait is auto:
Just opening this so we don't lose track of this.