Skip to content

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

Merged
merged 1 commit into from
May 30, 2022

Conversation

JohnTitor
Copy link
Member

Updates rustc-driver related examples to the latest nightly (I forgot to update the references on #1330 :P).
cc #1344

@JohnTitor JohnTitor mentioned this pull request May 1, 2022
36 tasks
@JohnTitor JohnTitor added the S-waiting-on-review Status: this PR is waiting for a reviewer to verify its content label May 16, 2022
@JohnTitor JohnTitor requested a review from a team May 21, 2022 03:52
@@ -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`"
Copy link
Member

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

Copy link
Member Author

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 :)

Copy link
Member

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed!

@JohnTitor JohnTitor force-pushed the rustc-driver-examples branch from 45c4156 to 920ae60 Compare May 24, 2022 08:07
@tshepang tshepang merged commit a206009 into rust-lang:master May 30, 2022
@JohnTitor JohnTitor deleted the rustc-driver-examples branch May 30, 2022 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: this PR is waiting for a reviewer to verify its content
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants