diff options
| author | Takayuki Nakata <f.seasons017@gmail.com> | 2020-08-03 22:02:52 +0900 |
|---|---|---|
| committer | Who? Me?! <mark-i-m@users.noreply.github.com> | 2020-08-03 08:50:58 -0500 |
| commit | 43cc8ec16f5eb70c159e394488373047e4ce6a68 (patch) | |
| tree | 02f0deda5b13034d6e46be674720e32770c6699c /src/doc/rustc-dev-guide/examples/rustc-driver-interacting-with-the-ast.rs | |
| parent | b71885e14eaf02a46fc821c40ed42e1fdcc1a484 (diff) | |
| download | rust-43cc8ec16f5eb70c159e394488373047e4ce6a68.tar.gz rust-43cc8ec16f5eb70c159e394488373047e4ce6a68.zip | |
Fix examples not working
Diffstat (limited to 'src/doc/rustc-dev-guide/examples/rustc-driver-interacting-with-the-ast.rs')
| -rw-r--r-- | src/doc/rustc-dev-guide/examples/rustc-driver-interacting-with-the-ast.rs | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/doc/rustc-dev-guide/examples/rustc-driver-interacting-with-the-ast.rs b/src/doc/rustc-dev-guide/examples/rustc-driver-interacting-with-the-ast.rs index 105ee00194e..e33c2ee9571 100644 --- a/src/doc/rustc-dev-guide/examples/rustc-driver-interacting-with-the-ast.rs +++ b/src/doc/rustc-dev-guide/examples/rustc-driver-interacting-with-the-ast.rs @@ -3,7 +3,6 @@ // NOTE: For the example to compile, you will need to first run the following: // rustup component add rustc-dev -extern crate rustc; extern crate rustc_error_codes; extern crate rustc_errors; extern crate rustc_hash; @@ -65,7 +64,7 @@ fn main() { if let Some(expr) = local.init { 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_tables_of(def_id).node_type(hir_id); + 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 } } |
