Skip to content

Get rid of "const_fn" feature gate #84510

Closed
@RalfJung

Description

@RalfJung

With #84310, the const-checking analysis in compiler/rustc_mir/src/transform/check_consts no longer cares about the const_fn feature gate. So it's time we remove it entirely. That, however, turns out to be non-trivial -- I tried.

  • Some external creates need to be patched first to not use const_fn any more:
error[E0557]: feature has been removed
  --> /cargo/registry/src/github.com-1ecc6299db9ec823/lock_api-0.4.1/src/lib.rs:91:42
   |
91 | #![cfg_attr(feature = "nightly", feature(const_fn))]
   |                                          ^^^^^^^^ feature has been removed
   |
   = note: replaced by finer-grained feature flags
  • Something very strange is going on with the "const fn in trait" errors. In my attempt I made this a new feature gate, which however just lead to tons of duplicate errors.
  • Something else but equally strange is going on with some cases of having trait bounds on const fn, leading to errors disappearing in the min_const_fn test.

Cc @rust-lang/wg-const-eval

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)C-cleanupCategory: PRs that clean code up or issues documenting cleanup.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions