Skip to content

Feed a span into the const eval queries in case of an error #104438

Open
@oli-obk

Description

@oli-obk
Contributor

Unfortunately we cannot do this on the query level, because then evaluating the same constant at different locations would re-evaluate the constant each time since an input changes.

We could do that by having an Option<Span> argument in the query key that we only set to Some if we are erroring. So basically invoke it once with None, causing no error to be emitted, but an error to be returned, if you get back an error, invoke again with Some(span) and now the query can error inside.

Originally posted by @oli-obk in #104317 (comment)

Activity

added
A-diagnosticsArea: Messages for errors, warnings, and lints
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)
on Nov 15, 2022
added
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
on Apr 5, 2023
moved this to In Progress in query feedingon May 25, 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, ...)A-diagnosticsArea: Messages for errors, warnings, and lintsT-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

        Participants

        @oli-obk@Noratrieb

        Issue actions

          Feed a span into the const eval queries in case of an error · Issue #104438 · rust-lang/rust