This repository has been archived by the owner on Aug 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Herman Venter
committed
Dec 7, 2018
1 parent
8fdb938
commit 71c0a7e
Showing
7 changed files
with
625 additions
and
41 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ use rustc_metadata::cstore::CStore; | |
use std::path::PathBuf; | ||
use syntax::{ast, errors}; | ||
use visitors; | ||
use visitors::MirVisitor; | ||
|
||
/// Private state used to implement the callbacks. | ||
pub struct MiraiCallbacks { | ||
|
@@ -139,8 +140,10 @@ impl<'a> CompilerCalls<'a> for MiraiCallbacks { | |
/// interpretation of all of the functions that will end up in the compiler output. | ||
fn after_analysis(state: &mut driver::CompileState) { | ||
let tcx = state.tcx.unwrap(); | ||
state | ||
.hir_crate | ||
.unwrap() | ||
.visit_all_item_likes(&mut visitors::CrateVisitor { tcx, state }); | ||
for def_id in tcx.body_owners() { | ||
// By this time all analyses have been carried out, so it should be safe to borrow this now. | ||
let mir = tcx.optimized_mir(def_id); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
hermanventer
Contributor
|
||
let mir_visitor = visitors::MirTestVisitor { tcx, def_id, mir }; | ||
mir_visitor.visit_body(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
If you want to extract aliasing information from the types I suggest to use
validated_mir
instead ofoptimized_mir
, because some type guarantees are not respected in the latter. For example, mutable borrows can be copied in optimized MIR: rust-lang/rust#46420 (as pointed out in https://users.rust-lang.org/t/why-the-borrow-checker-runs-on-validated-and-not-optimized-mir/15775).