-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Emit smir #117745
Emit smir #117745
Conversation
Failed to set assignee to
|
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. This PR changes Stable MIR cc @oli-obk, @celinval, @spastorino, @ouz-a |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's awesome! I would like to suggest two things:
- To change the interface of all methods, except
write_smir_pretty
to use&Table
instead ofTyCtxt
. This will make it much cleaner to invoke StableMIR APIs and to expose some of these methods in thestable_mir
crate as well. - To write to the given writer directly, instead of returning
String
in all methods. Users could still extract that information into aString
if needed by passing aVec<u8>
.
r? @celinval |
Thanks! Regarding your suggestions // from this to
format!(
"[{}; {}]",
pretty_ty(ty.kind(), tcx),
internal(&len).try_to_scalar().unwrap()
)
// this
write!(w, "[");
write!(w,"{}", pretty_ty(ty.kind(), tcx,w));
write!(w, "; ");
write!(w,"{}", internal(&len).try_to_scalar().unwrap()); 2: I don't know how to make this work e.g this gives borrow errror run(tcx, || {
with_tables(|tables| {
let items = stable_mir::all_local_items();
let _ = items.iter().map(|item| -> io::Result<()> {
function_name(*item, tables)?;
}); |
Fair. Thanks for trying.
You should remove |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me after fixing the result value
@bors r=celinval |
Emit smir This adds ability to `-Zunpretty=smir` and get smir output of a Rust file, this is obliviously pretty basic compared to `mir` output but I think we could iteratively improve it, and even at this state this is useful for us. r? `@celinval`
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#117338 (Remove asmjs) - rust-lang#117549 (Use `copied` instead of manual `map`) - rust-lang#117745 (Emit smir) - rust-lang#117964 (When using existing fn as module, don't claim it doesn't exist) - rust-lang#118006 (clarify `fn discriminant` guarantees: only free lifetimes may get erased) - rust-lang#118016 (Add stable mir members to triagebot config) - rust-lang#118022 (Miri subtree update) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#117745 - ouz-a:emit_smir, r=celinval Emit smir This adds ability to `-Zunpretty=smir` and get smir output of a Rust file, this is obliviously pretty basic compared to `mir` output but I think we could iteratively improve it, and even at this state this is useful for us. r? ``@celinval``
This adds ability to
-Zunpretty=smir
and get smir output of a Rust file, this is obliviously pretty basic compared tomir
output but I think we could iteratively improve it, and even at this state this is useful for us.r? @celinval