From 4185dca09501ae8b941457563c5658d4d5d98d5b Mon Sep 17 00:00:00 2001 From: Boxy Date: Fri, 6 Jun 2025 20:20:06 +0100 Subject: [PATCH] Stub chapter and consolidate under `/hir/` --- src/SUMMARY.md | 5 +++-- src/diagnostics.md | 2 +- src/hir.md | 2 +- src/hir/ambig-unambig-ty-and-consts.md | 1 + src/{hir-debugging.md => hir/debugging.md} | 0 src/{ast-lowering.md => hir/lowering.md} | 2 +- src/overview.md | 2 +- 7 files changed, 8 insertions(+), 6 deletions(-) create mode 100644 src/hir/ambig-unambig-ty-and-consts.md rename src/{hir-debugging.md => hir/debugging.md} (100%) rename src/{ast-lowering.md => hir/lowering.md} (97%) diff --git a/src/SUMMARY.md b/src/SUMMARY.md index 2acc3c21..50a3f44a 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -121,8 +121,9 @@ - [Feature gate checking](./feature-gate-ck.md) - [Lang Items](./lang-items.md) - [The HIR (High-level IR)](./hir.md) - - [Lowering AST to HIR](./ast-lowering.md) - - [Debugging](./hir-debugging.md) + - [Lowering AST to HIR](./hir/lowering.md) + - [Ambig/Unambig Types and Consts](./hir/ambig-unambig-ty-and-consts.md) + - [Debugging](./hir/debugging.md) - [The THIR (Typed High-level IR)](./thir.md) - [The MIR (Mid-level IR)](./mir/index.md) - [MIR construction](./mir/construction.md) diff --git a/src/diagnostics.md b/src/diagnostics.md index 01e59c91..33f5441d 100644 --- a/src/diagnostics.md +++ b/src/diagnostics.md @@ -553,7 +553,7 @@ compiler](#linting-early-in-the-compiler). [AST nodes]: the-parser.md -[AST lowering]: ast-lowering.md +[AST lowering]: ./hir/lowering.md [HIR nodes]: hir.md [MIR nodes]: mir/index.md [macro expansion]: macro-expansion.md diff --git a/src/hir.md b/src/hir.md index 0c1c9941..72fb1070 100644 --- a/src/hir.md +++ b/src/hir.md @@ -5,7 +5,7 @@ The HIR – "High-Level Intermediate Representation" – is the primary IR used in most of rustc. It is a compiler-friendly representation of the abstract syntax tree (AST) that is generated after parsing, macro expansion, and name -resolution (see [Lowering](./ast-lowering.html) for how the HIR is created). +resolution (see [Lowering](./hir/lowering.md) for how the HIR is created). Many parts of HIR resemble Rust surface syntax quite closely, with the exception that some of Rust's expression forms have been desugared away. For example, `for` loops are converted into a `loop` and do not appear in diff --git a/src/hir/ambig-unambig-ty-and-consts.md b/src/hir/ambig-unambig-ty-and-consts.md new file mode 100644 index 00000000..b5458d71 --- /dev/null +++ b/src/hir/ambig-unambig-ty-and-consts.md @@ -0,0 +1 @@ +# Ambig/Unambig Types and Consts \ No newline at end of file diff --git a/src/hir-debugging.md b/src/hir/debugging.md similarity index 100% rename from src/hir-debugging.md rename to src/hir/debugging.md diff --git a/src/ast-lowering.md b/src/hir/lowering.md similarity index 97% rename from src/ast-lowering.md rename to src/hir/lowering.md index 033fd4b7..02c69b86 100644 --- a/src/ast-lowering.md +++ b/src/hir/lowering.md @@ -1,6 +1,6 @@ # AST lowering -The AST lowering step converts AST to [HIR](hir.html). +The AST lowering step converts AST to [HIR](../hir.md). This means many structures are removed if they are irrelevant for type analysis or similar syntax agnostic analyses. Examples of such structures include but are not limited to diff --git a/src/overview.md b/src/overview.md index 92d0c7b0..8a1a22fa 100644 --- a/src/overview.md +++ b/src/overview.md @@ -410,7 +410,7 @@ For more details on bootstrapping, see - Guide: [The HIR](hir.md) - Guide: [Identifiers in the HIR](hir.md#identifiers-in-the-hir) - Guide: [The `HIR` Map](hir.md#the-hir-map) - - Guide: [Lowering `AST` to `HIR`](ast-lowering.md) + - Guide: [Lowering `AST` to `HIR`](./hir/lowering.md) - How to view `HIR` representation for your code `cargo rustc -- -Z unpretty=hir-tree` - Rustc `HIR` definition: [`rustc_hir`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/index.html) - Main entry point: **TODO**