bors
88d69b72b4
Auto merge of #119099 - fmease:always-const-trait-bounds, r=fee1-dead
...
Introduce `const Trait` (always-const trait bounds)
Feature `const_trait_impl` currently lacks a way to express “always const” trait bounds. This makes it impossible to define generic items like fns or structs which contain types that depend on const method calls (\*). While the final design and esp. the syntax of effects / keyword generics isn't set in stone, some version of “always const” trait bounds will very likely form a part of it. Further, their implementation is trivial thanks to the `effects` backbone.
Not sure if this needs t-lang sign-off though.
(\*):
```rs
#![feature(const_trait_impl, effects, generic_const_exprs)]
fn compute<T: const Trait>() -> Type<{ T::generate() }> { /*…*/ }
struct Store<T: const Trait>
where
Type<{ T::generate() }>:,
{
field: Type<{ T::generate() }>,
}
```
Lastly, “always const” trait bounds are a perfect fit for `generic_const_items`.
```rs
#![feature(const_trait_impl, effects, generic_const_items)]
const DEFAULT<T: const Default>: T = T::default();
```
Previously, we (oli, fee1-dead and I) wanted to reinterpret `~const Trait` as `const Trait` in generic const items which would've been quite surprising and not very generalizable.
Supersedes #117530 .
---
cc `@oli-obk`
As discussed
r? fee1-dead (or compiler)
2023-12-27 19:24:31 +00:00
..
2023-12-19 04:28:21 +00:00
2023-12-24 11:10:38 +01:00
2023-11-24 19:15:52 +01:00
2023-12-12 17:19:19 +01:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-10-25 22:35:12 +00:00
2023-11-24 19:15:52 +01:00
2023-12-07 17:46:36 +01:00
2023-11-27 09:15:40 +01:00
2023-11-24 19:15:52 +01:00
2023-11-04 15:27:29 -04:00
2023-11-04 15:27:29 -04:00
2023-06-12 20:24:48 +08:00
2023-11-24 19:15:52 +01:00
2023-08-20 00:21:47 +00:00
2023-08-20 00:21:47 +00:00
2023-11-24 19:15:52 +01:00
2023-12-19 04:28:21 +00:00
2023-12-19 04:28:21 +00:00
2023-09-28 11:07:06 -07:00
2023-11-24 19:15:52 +01:00
2023-05-21 14:09:03 +02:00
2023-07-10 20:09:26 +00:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-10-04 08:01:11 +08:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-12-19 13:56:50 -08:00
2023-12-19 13:56:50 -08:00
2023-07-27 15:51:02 +00:00
2023-11-24 19:15:52 +01:00
2023-12-10 10:56:22 +08:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-08-06 15:47:40 -07:00
2023-10-16 16:29:35 +00:00
2023-08-06 15:47:40 -07:00
2023-10-15 18:13:31 +02:00
2023-11-24 19:15:52 +01:00
2023-11-24 21:04:51 +01:00
2023-11-24 19:15:52 +01:00
2023-10-05 01:04:41 +00:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-09-14 22:34:05 +02:00
2023-12-19 04:28:21 +00:00
2023-07-24 20:28:35 +00:00
2023-07-24 20:28:35 +00:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-11-12 12:49:46 +01:00
2023-05-15 00:00:00 +00:00
2023-05-15 00:00:00 +00:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-12-14 15:22:37 +01:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-12-07 17:46:36 +01:00
2023-12-07 17:46:36 +01:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-12-19 04:28:21 +00:00
2023-05-15 00:00:00 +00:00
2023-11-24 19:15:52 +01:00
2023-10-25 12:04:54 +00:00
2023-10-25 12:04:54 +00:00
2023-11-24 19:15:52 +01:00
2023-12-19 04:28:21 +00:00
2023-10-16 16:29:35 +00:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-09-07 18:31:17 +00:00
2023-11-12 04:33:19 +00:00
2023-11-12 04:33:19 +00:00
2023-10-05 01:04:41 +00:00
2023-09-05 20:20:55 +00:00
2023-11-24 19:15:52 +01:00
2023-12-27 12:51:32 +01:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-07-27 15:51:02 +00:00
2023-11-24 19:15:52 +01:00
2023-12-07 17:46:36 +01:00
2023-12-07 17:46:36 +01:00
2023-12-07 17:46:36 +01:00
2023-11-24 19:15:52 +01:00
2023-05-24 19:35:59 -03:00
2023-05-24 19:35:59 -03:00
2023-05-24 19:35:59 -03:00
2023-11-24 19:15:52 +01:00
2023-10-05 01:04:41 +00:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-07-27 15:51:02 +00:00
2023-11-24 19:15:52 +01:00
2023-05-24 19:35:59 -03:00
2023-05-24 19:54:13 -03:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-10-20 08:46:27 +00:00
2023-10-20 08:46:27 +00:00
2023-11-24 19:15:52 +01:00
2023-05-04 11:22:40 +01:00
2023-05-04 11:22:40 +01:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-05-15 00:00:00 +00:00
2023-05-15 00:00:00 +00:00
2023-07-27 15:51:02 +00:00
2023-07-27 15:51:02 +00:00
2023-12-07 17:46:36 +01:00
2023-12-07 17:46:36 +01:00
2023-11-24 19:15:52 +01:00
2023-05-15 00:00:00 +00:00
2023-10-08 12:09:06 +00:00
2023-07-27 15:51:02 +00:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-12-19 04:28:21 +00:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-12-07 17:46:36 +01:00
2023-11-24 19:15:52 +01:00
2023-12-12 15:54:25 +11:00
2023-12-12 15:54:25 +11:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-07-27 15:51:02 +00:00
2023-12-19 04:28:21 +00:00
2023-10-08 10:06:17 +00:00
2023-07-18 21:53:34 -04:00
2023-05-21 14:09:03 +02:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-09-14 11:56:55 +02:00
2023-10-23 22:14:39 +08:00
2023-10-23 22:14:39 +08:00
2023-05-05 20:36:21 +02:00
2023-11-26 09:02:25 -05:00
2023-06-12 20:24:48 +08:00
2023-10-11 12:49:57 +00:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-10-16 16:29:35 +00:00
2023-11-26 09:02:25 -05:00
2023-06-24 18:04:14 +00:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-04-22 00:47:07 -04:00
2023-11-26 09:02:25 -05:00
2023-10-16 16:29:35 +00:00
2023-11-26 09:02:25 -05:00
2023-11-24 19:15:52 +01:00
2023-12-07 16:28:33 +00:00
2023-07-27 15:51:02 +00:00
2023-07-27 15:51:02 +00:00
2023-08-01 18:23:37 +02:00
2023-08-03 10:52:15 +02:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-12-02 09:01:19 +11:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-06-01 18:21:42 +00:00
2023-06-01 18:21:42 +00:00
2023-08-06 13:34:53 +00:00
2023-08-07 17:16:10 +00:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-06-22 14:11:10 +00:00
2023-11-24 19:15:52 +01:00
2023-06-27 23:31:06 +00:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-09-20 03:02:14 +00:00
2023-12-27 12:51:32 +01:00
2023-07-18 21:53:34 -04:00