From 65e8c5bb2f8fade40569daa10662625eb299d884 Mon Sep 17 00:00:00 2001 From: Tbkhi Date: Sun, 10 Mar 2024 15:42:07 -0300 Subject: [PATCH 1/4] adding links --- src/rustc-driver-interacting-with-the-ast.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/rustc-driver-interacting-with-the-ast.md b/src/rustc-driver-interacting-with-the-ast.md index 1339fdce8..4058a9943 100644 --- a/src/rustc-driver-interacting-with-the-ast.md +++ b/src/rustc-driver-interacting-with-the-ast.md @@ -1,12 +1,16 @@ # Example: Type checking through `rustc_interface` -`rustc_interface` allows you to interact with Rust code at various stages of compilation. +The [`rustc_interface`] allows you to interact with Rust code at various stages of compilation. ## Getting the type of an expression -To get the type of an expression, use the `global_ctxt` to get a `TyCtxt`. +To get the type of an expression, use the [`global_ctxt()`] query to [get] a [`TyCtxt`]. The following was tested with `nightly-2024-01-19`: ```rust {{#include ../examples/rustc-driver-interacting-with-the-ast.rs}} ``` +[`rustc_interface`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_interface/index.html +[`global_ctxt()`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_interface/queries/struct.Queries.html#method.global_ctxt +[get]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.GlobalCtxt.html#method.enter +[`TyCtxt`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html \ No newline at end of file From db2136922d44c8b7a6ea6c1bf524ed1762e0d88f Mon Sep 17 00:00:00 2001 From: Tbkhi Date: Mon, 11 Mar 2024 07:13:56 -0300 Subject: [PATCH 2/4] Update src/rustc-driver-interacting-with-the-ast.md Co-authored-by: Tshepang Mbambo --- src/rustc-driver-interacting-with-the-ast.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/rustc-driver-interacting-with-the-ast.md b/src/rustc-driver-interacting-with-the-ast.md index 4058a9943..b9e81e3b4 100644 --- a/src/rustc-driver-interacting-with-the-ast.md +++ b/src/rustc-driver-interacting-with-the-ast.md @@ -4,13 +4,10 @@ The [`rustc_interface`] allows you to interact with Rust code at various stages ## Getting the type of an expression -To get the type of an expression, use the [`global_ctxt()`] query to [get] a [`TyCtxt`]. +To get the type of an expression, use the [`global_ctxt`] query to [get] a [`TyCtxt`]. The following was tested with `nightly-2024-01-19`: ```rust {{#include ../examples/rustc-driver-interacting-with-the-ast.rs}} -``` -[`rustc_interface`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_interface/index.html -[`global_ctxt()`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_interface/queries/struct.Queries.html#method.global_ctxt [get]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.GlobalCtxt.html#method.enter [`TyCtxt`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html \ No newline at end of file From 63b1d66375d150c5f6f442874baf962e9140945d Mon Sep 17 00:00:00 2001 From: Tbkhi Date: Mon, 11 Mar 2024 07:25:47 -0300 Subject: [PATCH 3/4] redo links and formatting --- src/rustc-driver-interacting-with-the-ast.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/rustc-driver-interacting-with-the-ast.md b/src/rustc-driver-interacting-with-the-ast.md index b9e81e3b4..9c8425aec 100644 --- a/src/rustc-driver-interacting-with-the-ast.md +++ b/src/rustc-driver-interacting-with-the-ast.md @@ -9,5 +9,8 @@ The following was tested with `nightly-2024-01-19` ```rust {{#include ../examples/rustc-driver-interacting-with-the-ast.rs}} +``` + +[`rustc_interface`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_interface [get]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.GlobalCtxt.html#method.enter [`TyCtxt`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html \ No newline at end of file From 4de8423f3ba7530c497c29e6533ad20ac9e036e5 Mon Sep 17 00:00:00 2001 From: Tbkhi Date: Mon, 11 Mar 2024 07:30:00 -0300 Subject: [PATCH 4/4] Update rustc-driver-interacting-with-the-ast.md --- src/rustc-driver-interacting-with-the-ast.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/rustc-driver-interacting-with-the-ast.md b/src/rustc-driver-interacting-with-the-ast.md index 9c8425aec..5de22d8b0 100644 --- a/src/rustc-driver-interacting-with-the-ast.md +++ b/src/rustc-driver-interacting-with-the-ast.md @@ -10,7 +10,7 @@ The following was tested with `nightly-2024-01-19` ```rust {{#include ../examples/rustc-driver-interacting-with-the-ast.rs}} ``` - -[`rustc_interface`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_interface [get]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.GlobalCtxt.html#method.enter -[`TyCtxt`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html \ No newline at end of file +[`global_ctxt`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_interface/queries/struct.Queries.html#method.global_ctxt +[`rustc_interface`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_interface +[`TyCtxt`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html