Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The const-eval interpreter is called on incomplete/invalid/ill-formed code #124789

Open
RalfJung opened this issue May 6, 2024 · 4 comments
Open
Assignees
Labels
A-const-eval Area: constant evaluation (mir interpretation) C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@RalfJung
Copy link
Member

RalfJung commented May 6, 2024

It looks like #76064 is back. This is the source of countless ICEs. Just in the last few weeks:

As member of @rust-lang/wg-const-eval my position is that generally these are not const-eval bugs, but bugs in whatever part of the compiler is passing invalid data to const-eval. However, which part would that be? I am not sure whom to ping for this.^^

@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label May 6, 2024
@jieyouxu jieyouxu added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels May 13, 2024
@jieyouxu
Copy link
Contributor

IIRC @oli-obk has been trying to make compilation abort as late as possible to report as many errors as possible (at the item granularity). I'm not sure how to "suspend further compilation processes" for specific items that contain errors prior to const-eval.

@jieyouxu jieyouxu added A-const-eval Area: constant evaluation (mir interpretation) and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels May 13, 2024
@jieyouxu
Copy link
Contributor

It's probably desirable to discuss some error handling strategy that preserves the "fail as late as possible, report as many errors as possible" idea and yet does not let inputs that const-eval does not expect to handle to go through, at the item granularity. Maybe this involves some pre-const-eval validation/guard, or hardening const-eval against invalid inputs, or some other strategy. Nominating for T-compiler discussion.

@rustbot label +I-compiler-nominated

@rustbot rustbot added the I-compiler-nominated The issue / PR has been nominated for discussion during a compiler team meeting. label May 13, 2024
@RalfJung
Copy link
Member Author

On Zulip, @lcnr said that we already have the tainted_by_errors mechanism for this. But either the MIR bodies containing these invalid operations do not get tainted properly, or the interpreter is not properly skipping execution of tainted MIR bodies.

@apiraino
Copy link
Contributor

Discussed in T-compiler triage on Zulip.

We'll circle back on this, maybe in a dedicated meeting (cc: @oli-obk who maybe has more context here)

@rustbot label -I-compiler-nominated

@rustbot rustbot removed the I-compiler-nominated The issue / PR has been nominated for discussion during a compiler team meeting. label May 16, 2024
@oli-obk oli-obk self-assigned this May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-eval Area: constant evaluation (mir interpretation) C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
Status: Todo
Development

No branches or pull requests

5 participants