This is meant to be the interim successor to generic const expressions. Essentially, const item RHS's will be allowed to do arbitrary const operations using generics. The limitation is that these const items will be treated opaquely, like ADTs in nominal typing, such that uses of them will only be equal if the same const item is referenced. In other words, two const items with the exact same RHS will not be considered equal. I also added some logic to check feature gates that depend on others being enabled (like oGCA depending on mGCA). = Coherence = During coherence, OGCA consts should be normalized ambiguously because they are opaque but eventually resolved to a real value. We don't want two OGCAs that have the same value to be treated as distinct for coherence purposes. (Just like opaque types.) This actually doesn't work yet because there are pre-existing fundamental issues with equate relations involving consts that need to be normalized. The problem is that we normalize only one layer of the const item and don't actually process the resulting anon const. Normally the created inference variable should be handled, which in this case would cause us to hit the anon const, but that's not happening. Specifically, `visit_const` on `Generalizer` should be updated to be similar to `visit_ty`.
10 lines
355 B
Text
10 lines
355 B
Text
error: generic parameters may not be used in const operations
|
|
--> $DIR/selftyparam.rs:5:37
|
|
|
|
|
LL | fn foo() -> [(); const { let _: Self; 1 }];
|
|
| ^^^^
|
|
|
|
|
= help: add `#![feature(opaque_generic_const_args)]` to allow generic expressions as the RHS of const items
|
|
|
|
error: aborting due to 1 previous error
|
|
|