mirror of
https://github.com/rust-lang/rust.git
synced 2025-09-28 21:55:31 +00:00

When `#![feature(min_generic_const_args)]` is enabled, we now lower all const paths in generic arg position to `hir::ConstArgKind::Path`. We then lower assoc const paths to `ty::ConstKind::Unevaluated` since we can no longer use the anon const expression lowering machinery. In the process of implementing this, I factored out `hir_ty_lowering` code that is now shared between lowering assoc types and assoc consts. This PR also introduces a `#[type_const]` attribute for trait assoc consts that are allowed as const args. However, we still need to implement code to check that assoc const definitions satisfy `#[type_const]` if present (basically is it a const path or a monomorphic anon const).
23 lines
980 B
Plaintext
23 lines
980 B
Plaintext
error: generic parameters may not be used in const operations
|
|
--> $DIR/feature-gate-min-generic-const-args.rs:8:29
|
|
|
|
|
LL | fn foo<T: Trait>() -> [u8; <T as Trait>::ASSOC] {
|
|
| ^ cannot perform const operation using `T`
|
|
|
|
|
= note: type parameters may not be used in const expressions
|
|
= help: add `#![feature(generic_const_exprs)]` to allow generic const expressions
|
|
|
|
error[E0658]: the `#[type_const]` attribute is an experimental feature
|
|
--> $DIR/feature-gate-min-generic-const-args.rs:2:5
|
|
|
|
|
LL | #[type_const]
|
|
| ^^^^^^^^^^^^^
|
|
|
|
|
= note: see issue #132980 <https://github.com/rust-lang/rust/issues/132980> for more information
|
|
= help: add `#![feature(min_generic_const_args)]` to the crate attributes to enable
|
|
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
|
|
|
error: aborting due to 2 previous errors
|
|
|
|
For more information about this error, try `rustc --explain E0658`.
|