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

Understand MIR scopes #55

Closed
virgil-serbanuta opened this issue Feb 27, 2023 · 3 comments
Closed

Understand MIR scopes #55

virgil-serbanuta opened this issue Feb 27, 2023 · 3 comments

Comments

@virgil-serbanuta
Copy link
Contributor

Mir functions may define variables in nested scopes. We should figure out if these scopes are useful or they can be ignored (i.e. declaring variables in scopes is the same as declaring them at the top level).

Example:
https://github.com/runtimeverification/mir-semantics-compiletest/blob/9251b00e38504a6f1279b0ca9f81b90b4964080d/ui/as-precedence.mir#L40-L79

@geo2a
Copy link
Contributor

geo2a commented Mar 6, 2023

The scopes in MIR have something to do with region checking, which seems related to the borrow checker. The scopes are requires to check "lexical lifetimes". It looks like there is an alternative, more powerful lifetime analysis which is called "non-lexical lifetimes" (NLL, https://rust-lang.github.io/rfcs/2094-nll.html) and is based on the control-flow graph. It is not clear if the scopes are still used for lifetime analysis.

References:

@geo2a
Copy link
Contributor

geo2a commented Mar 6, 2023

It seems like NLL is enables in current Rust: rust-lang/rust#43234 (this issue closed as completed)

Does that mean that we can ignore the scopes?

@virgil-serbanuta
Copy link
Contributor Author

Even if NLL was not enabled, would we be interested in lifetime analysis? If not, we could ignore scopes anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants