Ralf Jung
a0215d8e46
Re-do recursive const stability checks
...
Fundamentally, we have *three* disjoint categories of functions:
1. const-stable functions
2. private/unstable functions that are meant to be callable from const-stable functions
3. functions that can make use of unstable const features
This PR implements the following system:
- `#[rustc_const_stable]` puts functions in the first category. It may only be applied to `#[stable]` functions.
- `#[rustc_const_unstable]` by default puts functions in the third category. The new attribute `#[rustc_const_stable_indirect]` can be added to such a function to move it into the second category.
- `const fn` without a const stability marker are in the second category if they are still unstable. They automatically inherit the feature gate for regular calls, it can now also be used for const-calls.
Also, several holes in recursive const stability checking are being closed.
There's still one potential hole that is hard to avoid, which is when MIR
building automatically inserts calls to a particular function in stable
functions -- which happens in the panic machinery. Those need to *not* be
`rustc_const_unstable` (or manually get a `rustc_const_stable_indirect`) to be
sure they follow recursive const stability. But that's a fairly rare and special
case so IMO it's fine.
The net effect of this is that a `#[unstable]` or unmarked function can be
constified simply by marking it as `const fn`, and it will then be
const-callable from stable `const fn` and subject to recursive const stability
requirements. If it is publicly reachable (which implies it cannot be unmarked),
it will be const-unstable under the same feature gate. Only if the function ever
becomes `#[stable]` does it need a `#[rustc_const_unstable]` or
`#[rustc_const_stable]` marker to decide if this should also imply
const-stability.
Adding `#[rustc_const_unstable]` is only needed for (a) functions that need to
use unstable const lang features (including intrinsics), or (b) `#[stable]`
functions that are not yet intended to be const-stable. Adding
`#[rustc_const_stable]` is only needed for functions that are actually meant to
be directly callable from stable const code. `#[rustc_const_stable_indirect]` is
used to mark intrinsics as const-callable and for `#[rustc_const_unstable]`
functions that are actually called from other, exposed-on-stable `const fn`. No
other attributes are required.
2024-10-25 20:31:40 +02:00
..
2024-09-22 10:46:59 -04:00
2023-11-24 19:15:52 +01:00
2023-12-04 21:54:34 +00:00
2023-12-04 21:54:34 +00:00
2023-11-24 19:15:52 +01:00
2024-02-13 10:44:54 +00:00
2024-04-06 16:23:10 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2024-08-18 19:46:53 +02:00
2024-08-18 19:46:53 +02:00
2024-08-18 19:46:53 +02:00
2024-08-18 19:46:53 +02:00
2024-08-18 19:46:53 +02:00
2024-08-18 19:46:53 +02:00
2024-08-18 19:46:53 +02:00
2024-08-18 19:46:53 +02:00
2024-07-26 14:41:56 -04:00
2024-09-13 14:10:56 +03:00
2024-09-13 14:10:56 +03:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-01-11 09:32:08 +00:00
2023-11-24 19:15:52 +01:00
2023-07-10 20:09:26 +00:00
2023-05-05 22:40:05 +12:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2024-07-26 14:41:56 -04:00
2024-02-16 20:02:50 +00:00
2024-04-10 20:36:14 +00:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-01-11 09:32:08 +00:00
2023-05-05 22:40:05 +12:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2023-07-10 20:09:26 +00:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2024-04-10 20:36:14 +00:00
2024-04-10 20:36:14 +00:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2024-04-12 04:46:31 +00:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2024-07-04 05:36:34 +00:00
2023-01-11 09:32:08 +00:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-01-11 09:32:08 +00:00
2023-11-24 19:15:52 +01: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
2024-02-16 20:02:50 +00:00
2024-07-26 14:41:56 -04:00
2024-02-16 20:02:50 +00:00
2024-04-11 16:41:41 +00:00
2024-04-11 16:41:41 +00:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +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
2024-04-11 16:41:41 +00:00
2024-04-11 16:41:41 +00:00
2024-04-10 20:36:14 +00:00
2024-04-10 20:36:14 +00:00
2024-04-15 21:36:52 -04:00
2024-04-10 20:36:14 +00:00
2024-04-10 20:36:14 +00:00
2023-07-10 20:09:26 +00:00
2023-11-24 19:15:52 +01:00
2024-04-11 16:41:41 +00:00
2024-02-16 20:02:50 +00:00
2024-04-11 16:41:41 +00:00
2023-01-11 09:32:08 +00:00
2024-07-26 14:41:56 -04:00
2024-02-16 20:02:50 +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
2024-07-26 14:41:56 -04:00
2024-07-26 14:41:56 -04: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-10 20:09:26 +00: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-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-07-04 02:02:21 +00:00
2024-02-16 20:02:50 +00:00
2024-04-24 22:21:16 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-07-26 14:41:56 -04:00
2024-06-29 19:58:18 +08:00
2023-11-24 19:15:52 +01:00
2024-07-26 14:41:56 -04:00
2023-10-24 15:30:17 +00:00
2023-10-24 15:30:17 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-10-24 15:30:17 +00:00
2023-10-24 15:30:17 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-04-11 16:41:41 +00:00
2024-02-16 20:02:50 +00:00
2024-04-11 16:41:41 +00:00
2024-04-11 16:41:41 +00:00
2024-04-11 16:41:41 +00:00
2024-04-24 22:21:15 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2024-07-26 14:41:56 -04:00
2024-02-16 20:02:50 +00:00
2024-07-26 14:41:56 -04:00
2023-11-24 19:15:52 +01:00
2023-07-10 20:09:26 +00:00
2023-07-10 20:09:26 +00:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-01-11 09:32:08 +00:00
2023-11-24 19:15:52 +01:00
2023-07-10 20:09:26 +00:00
2023-11-24 19:15:52 +01:00
2024-04-24 22:21:15 +00:00
2023-11-24 19:15:52 +01:00
2023-07-10 20:09:26 +00:00
2024-04-11 16:41:41 +00:00
2024-07-26 14:41:56 -04:00
2023-01-11 09:32:08 +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
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2023-05-05 22:40:05 +12: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-10 20:09:26 +00:00
2023-11-24 19:15:52 +01:00
2024-04-10 20:36:14 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-04-10 20:36:14 +00:00
2024-04-11 16:41:42 +00:00
2024-04-12 20:57:07 +00:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2024-07-26 14:41:56 -04:00
2024-04-11 16:41:42 +00:00
2024-04-10 20:36:14 +00:00
2024-04-10 20:36:14 +00:00
2024-04-15 21:36:52 -04:00
2024-02-06 23:12:23 +00:00
2024-04-10 20:36:14 +00:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-07-10 20:09:26 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-18 06:01:40 +03:00
2024-09-13 14:10:56 +03:00
2024-02-16 20:02:50 +00:00
2024-04-10 20:36:14 +00:00
2024-04-10 20:36:14 +00:00
2024-04-10 20:36:14 +00:00
2024-02-16 20:02:50 +00:00
2024-04-10 20:36:14 +00:00
2024-04-10 20:36:14 +00:00
2024-04-10 20:36:14 +00:00
2024-04-10 20:36:14 +00:00
2024-04-10 20:36:14 +00:00
2024-04-10 20:36:14 +00:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2024-04-11 16:41:41 +00:00
2024-04-11 16:41: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-11-24 19:15:52 +01:00
2024-04-11 16:41:41 +00:00
2024-03-13 23:05:11 +00:00
2024-07-26 14:41:56 -04:00
2024-04-11 16:41:41 +00:00
2024-02-16 20:02:50 +00:00
2024-04-11 16:41:41 +00:00
2024-03-23 20:22:51 +01:00
2024-06-27 15:19:08 -04:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2024-07-16 02:48:47 +08:00
2024-07-16 02:48:47 +08:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2024-01-16 09:25:28 +01:00
2024-02-16 20:02:50 +00:00
2024-01-16 09:25:28 +01:00
2024-02-16 20:02:50 +00:00
2024-05-29 09:27:07 +00:00
2024-05-29 09:27:07 +00:00
2024-03-21 21:27:37 +01:00
2024-03-21 21:27:37 +01:00
2024-07-24 23:36:47 -04:00
2024-07-24 23:36:47 -04:00
2023-01-11 09:32:08 +00:00
2024-07-04 02:02:21 +00:00
2023-11-24 19:15:52 +01:00
2023-07-10 20:09:26 +00:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2024-04-24 22:21:15 +00:00
2024-09-13 14:10:56 +03:00
2024-09-13 14:10:56 +03:00
2024-02-16 20:02:50 +00:00
2024-04-10 20:36:14 +00:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-07-04 04:36:52 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-01-11 09:32:08 +00:00
2023-11-24 19:15:52 +01:00
2024-07-04 02:02:21 +00:00
2024-07-04 02:02:21 +00:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2023-01-11 09:32:08 +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
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2024-09-13 14:10:56 +03:00
2024-09-13 14:10:56 +03:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-10-24 15:30:17 +00:00
2024-04-10 20:36:14 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-09-07 00:20:38 +08:00
2024-10-25 20:31:40 +02:00
2024-10-25 20:31:40 +02:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +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-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-01-11 09:32:08 +00:00
2023-11-24 19:15:52 +01:00
2023-01-11 09:32:08 +00:00
2023-11-24 19:15:52 +01:00
2023-01-11 09:32:08 +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
2024-03-20 13:00:34 -04:00
2024-07-22 22:51:53 +00:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-12-04 21:54:32 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2024-01-13 22:00:34 +00:00
2024-01-13 22:00:34 +00:00
2024-01-13 22:00:34 +00:00
2024-01-13 22:00:34 +00:00
2024-04-11 16:41:41 +00:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2024-01-13 22:00:34 +00:00
2024-01-13 22:00:34 +00:00
2023-11-24 19:15:52 +01:00
2023-09-19 18:15:23 +02:00
2023-11-24 19:15:52 +01:00
2023-01-11 09:32:08 +00:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-09-21 22:20:58 +02:00
2024-07-26 14:41:56 -04:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-04-15 21:36:52 -04:00
2024-02-16 20:02:50 +00:00
2024-04-24 22:21:15 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-03-18 16:25:36 +00:00
2023-05-29 13:11:03 +08:00
2024-07-04 05:36:34 +00:00
2023-08-23 12:35:00 +08:00
2023-11-28 17:12:20 -08:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2024-01-13 22:00:34 +00:00
2024-04-24 22:21:15 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-20 15:34:11 +01:00
2024-02-20 15:34:11 +01:00
2023-11-24 19:15:52 +01:00
2023-01-11 09:32:08 +00:00
2024-04-24 22:21:15 +00:00
2024-04-11 16:41:41 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-04-24 22:21:15 +00:00
2024-07-19 09:34:32 +08:00
2024-07-19 09:34:32 +08:00
2024-06-29 19:58:18 +08:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-04-24 22:21:15 +00:00
2024-07-17 10:07:02 +08:00
2024-07-17 10:07:02 +08:00
2024-07-17 10:07:02 +08:00
2024-03-17 21:32:26 +00:00
2024-07-17 10:07:02 +08:00
2023-07-10 20:09:26 +00:00
2023-07-10 20:09:26 +00:00
2024-07-04 05:36:34 +00:00
2024-04-21 22:00:38 +02:00
2024-04-21 22:00:38 +02:00
2024-03-23 12:19:05 +01:00
2024-03-23 12:19:05 +01:00
2023-11-24 19:15:52 +01:00
2024-08-22 02:20:05 +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-12-04 21:54:32 +00:00
2024-04-15 21:36:52 -04:00
2023-07-10 20:09:26 +00:00
2023-11-24 19:15:52 +01:00
2023-07-10 20:09:26 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2024-04-25 04:54:25 +08:00
2024-07-04 02:02:21 +00:00
2023-11-24 19:15:52 +01:00
2024-07-04 02:02:21 +00:00
2024-04-06 16:23:10 +00:00
2024-04-06 16:23:10 +00:00
2023-11-24 19:15:52 +01:00
2024-05-09 14:47:09 +10:00
2024-05-09 14:47:09 +10:00
2024-05-09 14:47:09 +10:00
2024-05-09 14:47:09 +10:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-07-10 20:09:26 +00:00
2024-02-16 20:02:50 +00:00
2024-05-09 14:47:09 +10:00
2024-05-09 14:47:09 +10:00
2024-02-16 20:02:50 +00:00
2024-05-09 14:47:09 +10:00
2024-05-09 14:47:09 +10:00
2023-11-24 19:15:52 +01:00
2024-09-24 22:20:46 +02:00
2024-04-11 16:41:41 +00:00
2024-02-16 20:02:50 +00:00
2024-04-11 16:41:41 +00:00
2024-06-12 11:11:02 +08:00
2024-06-12 11:11:02 +08:00
2024-06-17 15:21:07 +10:00
2024-06-17 15:21:07 +10:00