-
Notifications
You must be signed in to change notification settings - Fork 543
Update rustc-driver related examples #1345
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
Conversation
@@ -76,7 +77,7 @@ fn main() { | |||
let hir_id = expr.hir_id; // hir_id identifies the string "Hello, world!" | |||
let def_id = tcx.hir().local_def_id(item.hir_id()); // def_id identifies the main function | |||
let ty = tcx.typeck(def_id).node_type(hir_id); | |||
println!("{:?}: {:?}", expr, ty); // prints expr(HirId { owner: DefIndex(3), local_id: 4 }: "Hello, world!"): &'static str | |||
println!("{:?}: {:?}", expr, ty); // prints "`rustc_hir::Expr`: `rustc_middle::ty::Ty`" |
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.
are you sure? that seems very strange for it to print, normally it gives details about the item itself
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.
It actually prints:
fn main() { let message = "Hello, world!"; println!("{}", message); }
Expr { hir_id: HirId { owner: DefId(0:3 ~ rust_out[a9df]::main), local_id: 2 }, kind: Lit(Spanned { node: Str("Hello, world!", Cooked), span: <main.rs>:1:27: 1:42 (#0) }), span: <main.rs>:1:27: 1:42 (#0) }: &str
Well, I remember I truncated the output because it's a bit long but... yeah it's quite different.
Any suggestions here? I feel it's verbose and would like to shorten if possible. Though I don't mind pasting it as-is if you think it's better :)
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.
I would rid of the comment
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.
Removed!
45c4156
to
920ae60
Compare
Updates rustc-driver related examples to the latest nightly (I forgot to update the references on #1330 :P).
cc #1344