Skip to content

Add non-generic constants' value to metadata and stop encoding their MIR #83011

@oli-obk

Description

@oli-obk

I think it is cheaper to store the evaluated constant in crate metadata than to store its entire MIR. The only reason we encode the MIR right now is so that downstream crates can evaluate the constant again.

cc @rust-lang/wg-const-eval any problems with this that come to mind? We may be able to do this for promoteds in non-generic functions, too. Paired with polymorphization we can even do that for polymorphic constants at some point (as long as the value does not depend on the generic parameters).

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)A-metadataArea: Crate metadata

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions