Skip to content

A const-unstable function cannot call other const-unstable functions gated under a language feature gate #129656

Description

@RalfJung

I expected this code to compile, but it does not:

#![feature(staged_api, f128)]
#![stable(feature = "rust_test", since = "1.0.0")]

#[unstable(feature = "f128", issue = "42")]
#[rustc_const_unstable(feature = "f128", issue = "42")]
const fn my_fun() {}

#[unstable(feature = "f128", issue = "42")]
#[rustc_const_unstable(feature = "f128", issue = "42")]
const fn my_fun2() {
    my_fun()
}

Renaming f128 to f128_const makes it compile, so somehow the issue must be related to the fact that f128 is a language feature gate. For regular library stability, we support also using a language feature as a library feature gate, but for const-stability that somehow does not work.

When this gets fixed, the f128_const and f16_const features (added in #129555) can be merged into the f128 and f16 features, respectively.

Cc @oli-obk

Activity

  1. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Aug 27, 2024
  2. added
    A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    and removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Aug 27, 2024
  3. added a commit that references this issue on Aug 31, 2024
  4. added a commit that references this issue on Aug 31, 2024
  5. added a commit that references this issue on Oct 4, 2024
  6. added a commit that references this issue on Oct 5, 2024
  7. added a commit that references this issue on Oct 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions