Coder Social home page Coder Social logo

Comments (5)

RalfJung avatar RalfJung commented on May 28, 2024 1

Caused by running the interpreter on code that doesn't even pass name resolution. Not sure where to fix this, but probably not in the interpreter.^^

Cc @oli-obk

from rust.

matthiaskrgr avatar matthiaskrgr commented on May 28, 2024

#121557 cc @RalfJung

from rust.

oli-obk avatar oli-obk commented on May 28, 2024

this is a promoted failing to compile because it gets the layout of this broken type, which gives us back an ErrorGuaranteed. I'm certain we can prevent const eval from running by checking such layouts earlier in the MIR pipeline, but the fix isn't clear to me yet.

from rust.

RalfJung avatar RalfJung commented on May 28, 2024

The issue is that in the sanity check here we only know it's an ErrorHandled::Reported, we don't know whether it was a typeck error on a const-eval error. So we can't really distinguish these cases.

If this is a LayoutError::ReferencesError, we could probably fix it by tweaking the error handling here. But there probably are similar cases where a promoted fails to evaluate due to a SizeOverflow and then we have to report the error somewhere.

The only option I see right now is to add another variant to ErrorHandled (or a flag in ErrorHandled::Reported) to track whether this was a failure inside the constant itself or a failure in something the constant referenced. But this distinction isn't always very clear anyway... it would basically have to be "is this an error that can occur even for supposedly infallible operations like &[]", i.e., match exactly the usecase of the const-eval / promoted sanity check. Which is not great.

from rust.

oli-obk avatar oli-obk commented on May 28, 2024

We already got the tainted_by_errors flag that we can reuse for that

from rust.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.