Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracking Issue for closures in const contexts #106003

Open
1 of 3 tasks
fee1-dead opened this issue Dec 21, 2022 · 3 comments
Open
1 of 3 tasks

Tracking Issue for closures in const contexts #106003

fee1-dead opened this issue Dec 21, 2022 · 3 comments
Labels
A-const-eval Area: Constant evaluation (MIR interpretation) A-const-fn Area: const fn foo(..) {..}. Pure functions which can be applied at compile time. C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC

Comments

@fee1-dead
Copy link
Member

fee1-dead commented Dec 21, 2022

This is a tracking issue for declaring const closures.
The feature gate for the issue is #![feature(const_closures)].

About tracking issues

Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.

Steps

Unresolved Questions

  • for<'a> const static async move || {} (keyword order?)

Implementation history

@fee1-dead fee1-dead added the C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC label Dec 21, 2022
@Jerrody
Copy link
Contributor

Jerrody commented Dec 22, 2022

Unresolved Questions

  • const static async move || {} (keyword order?)

In my opinion, suggested keyword order is good.

bors added a commit to rust-lang-ci/rust that referenced this issue Jan 13, 2023
RalfJung pushed a commit to RalfJung/miri that referenced this issue Jan 13, 2023
@dtolnay
Copy link
Member

dtolnay commented Jan 16, 2023

Unresolved Questions

  • for<'a> const static async move || {} (keyword order?)

Data point: const async fn f() {} is the order accepted for function definitions, so we should ensure at minimum the relative order of constasync is consistent.

@jhpratt

This comment was marked as resolved.

@workingjubilee workingjubilee added A-const-fn Area: const fn foo(..) {..}. Pure functions which can be applied at compile time. A-const-eval Area: Constant evaluation (MIR interpretation) labels Mar 13, 2023
thomcc pushed a commit to tcdi/postgrestd that referenced this issue May 31, 2023
github-actions bot pushed a commit to rust-lang/glacier that referenced this issue Jul 29, 2023
=== stdout ===
=== stderr ===
error[E0658]: const closures are experimental
 --> /home/runner/work/glacier/glacier/ices/112822.rs:4:5
  |
4 |     const move || {
  |     ^^^^^
  |
  = note: see issue #106003 <rust-lang/rust#106003> for more information
  = help: add `#![feature(const_closures)]` to the crate attributes to enable

error[E0015]: cannot call non-const operator in constant functions
 --> /home/runner/work/glacier/glacier/ices/112822.rs:9:17
  |
9 |                 assert_eq!(first, &b'f');
  |                 ^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
  = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0015]: cannot call non-const fn `core::panicking::assert_failed::<&u8, &u8>` in constant functions
 --> /home/runner/work/glacier/glacier/ices/112822.rs:9:17
  |
9 |                 assert_eq!(first, &b'f');
  |                 ^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
  = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 3 previous errors

Some errors have detailed explanations: E0015, E0658.
For more information about an error, try `rustc --explain E0015`.
==============
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-eval Area: Constant evaluation (MIR interpretation) A-const-fn Area: const fn foo(..) {..}. Pure functions which can be applied at compile time. C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC
Projects
None yet
Development

No branches or pull requests

5 participants