Skip to content

[tracking issue] warnings on long running constant evaluations #49980

Description

@oli-obk

#49947 introduces a warning (removing the previous hard error).

This warning is currently unsilenceable and should probably become a lint. For simplicity (#49947 needs to be backported to beta) this has not been done.

"When" the warning appears is deterministic, but depends on MIR, so it might change between versions of rustc.

Activity

  1. added
    A-diagnosticsArea: Messages for errors, warnings, and lints
    A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)
    on Apr 15, 2018
  2. rcoh commented on Apr 17, 2018

    @rcoh
    Contributor

    Seems like this will also require a small amount of refactoring? I don't think the evaluator where the warning is currently emitted knows the NodeId that is needed when emitting the lint.

  3. oli-obk commented on Apr 18, 2018

    @oli-obk
    ContributorAuthor

    We should be reporting the lint on the constant that is being evaluated, not the place that we are currently at, because that place might change between rustc versions

  4. oli-obk commented on May 18, 2018

    @oli-obk
    ContributorAuthor

    Note that just turning this into a lint is probably not enough. We need to also check whether the lint is deny in the constant's scope. If it is, we need to abort the interpretation. Otherwise we'd just keep getting these lints as errors without ever stopping compilation.

  5. added
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFC
    on Aug 27, 2018
  6. steveklabnik commented on Aug 14, 2020

    @steveklabnik
    Contributor

    Triage: I'm not aware of any changes here. I'm also not sure what to do to reproduce this issue, to be honest.

  7. oli-obk commented on Aug 15, 2020

    @oli-obk
    ContributorAuthor

    static FOO: () = loop {}; gives (on beta)

    error[E0080]: could not evaluate static initializer
     --> src/lib.rs:1:18
      |
    1 | static FOO: () = loop {};
      |                  ^^^^^^^ exceeded interpreter step limit (see `#[const_eval_limit]`)
    

    So I think we're good here

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 lintsC-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCT-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