Skip to content

Should const-evaluation be dynamically-typed or statically-typed? (And with what types?) #1071

Closed
@pnkfelix

Description

@pnkfelix

Currently our handling of types in const-evaluation is pretty ad-hoc.

See for example: rust-lang/rust#23833 or more generally several on the list at rust-lang/rust#23897

The const-evaluator often tries to act like it can figure out an expected type from the context and pass it in, but this is not always possible in general.

And in any case, it may make more sense to have the const-evaluated values carry around the actual computed types. But then this leads to issues like: Should the computed types be so strict as to be "this is the value -3 of type i8"? Or would it be better to be more flexible and have the computed type just be "this is the value -3 of type signed integer, so that it could be used with any signed integer type that can hold that value?

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-langRelevant to the language team, which will review and decide on the RFC.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions