Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

Implement a visitor for the THIR #3

Closed
LeSeulArtichaut opened this issue Mar 7, 2021 · 0 comments
Closed

Implement a visitor for the THIR #3

LeSeulArtichaut opened this issue Mar 7, 2021 · 0 comments
Assignees

Comments

@LeSeulArtichaut
Copy link
Contributor

Create visiting machinery for the THIR akin to rustc_hir::intravisit for the HIR.

@LeSeulArtichaut LeSeulArtichaut self-assigned this Mar 7, 2021
bors added a commit to rust-lang-ci/rust that referenced this issue May 13, 2021
…matsakis

Introduce the beginning of a THIR unsafety checker

This poses the foundations for the THIR unsafety checker, so that it can be implemented incrementally:
- implements a rudimentary `Visitor` for the THIR (which will definitely need some tweaking in the future)
- introduces a new `-Zthir-unsafeck` flag which tells the compiler to use THIR unsafeck instead of MIR unsafeck
- implements detection of unsafe functions
- adds revisions to the UI tests to test THIR unsafeck alongside MIR unsafeck

This uses a very simple query design, where bodies are unsafety-checked on a body per body basis. This however has some big flaws:
- the unsafety-checker builds the THIR itself, which means a lot of work is duplicated with MIR building constructing its own copy of the THIR
- unsafety-checking closures is currently completely wrong: closures should take into account the "safety context" in which they are created, here we are considering that closures are always a safe context

I had intended to fix these problems in follow-up PRs since they are always gated under the `-Zthir-unsafeck` flag (which is explicitely noted to be unsound).

r? `@nikomatsakis`
cc rust-lang/project-thir-unsafeck#3 rust-lang/project-thir-unsafeck#7
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant