-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Closed
Closed
Copy link
Labels
A-trait-systemArea: Trait systemArea: Trait systemC-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.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.F-associated_const_equality`#![feature(associated_const_equality)]``#![feature(associated_const_equality)]`F-generic_const_exprs`#![feature(generic_const_exprs)]``#![feature(generic_const_exprs)]`F-min_generic_const_args`#![feature(min_generic_const_args)]``#![feature(min_generic_const_args)]`T-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.
Description
EDIT(@camelid): If you're interested in doing this, please add a //@ check-pass test to tests/ui/const-generics/mgca/ that is along the lines of the example in #120905 (comment). Feel free to ping me (@camelid) or assign me on your PR.
For example, I expected the following code to succeed compilation:
#![feature(generic_const_exprs)]
#![feature(associated_const_equality)]
trait Trait {
const C: usize;
}
fn f<T: Trait<C = 1>>()
where
[(); T::C]:
{
let _: [(); T::C] = [()];
}Since (I'm pretty sure that) the ParamEnv contains the projection predicate <T as Trait>::C == 1, the const projection <T as Trait>::C inside the function body should be able to get normalized to 1. That however doesn't seem to happen:
error[E0308]: mismatched types
--> src/lib.rs:12:25
|
12 | let _: [(); T::C] = [()];
| ^^^^ expected `T::C`, found `1`
|
= note: expected constant `T::C`
found constant `1`
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-trait-systemArea: Trait systemArea: Trait systemC-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.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.F-associated_const_equality`#![feature(associated_const_equality)]``#![feature(associated_const_equality)]`F-generic_const_exprs`#![feature(generic_const_exprs)]``#![feature(generic_const_exprs)]`F-min_generic_const_args`#![feature(min_generic_const_args)]``#![feature(min_generic_const_args)]`T-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
Projects
Status
Done