diff options
| author | León Orell Valerian Liehr <me@fmease.dev> | 2024-02-11 09:22:52 +0100 |
|---|---|---|
| committer | León Orell Valerian Liehr <me@fmease.dev> | 2024-03-22 06:31:51 +0100 |
| commit | 82c2c8deb1fb7640fedfbc49b5647957a1d572db (patch) | |
| tree | 2a143c231f11041fd227262c1c650f7b7bd025ea /compiler/rustc_hir_analysis/src/lib.rs | |
| parent | 05d48b936f3733ff1d64de91a47465682603b133 (diff) | |
| download | rust-82c2c8deb1fb7640fedfbc49b5647957a1d572db.tar.gz rust-82c2c8deb1fb7640fedfbc49b5647957a1d572db.zip | |
Update (doc) comments
Several (doc) comments were super outdated or didn't provide enough context. Some doc comments shoved everything in a single paragraph without respecting the fact that the first paragraph should be a single sentence because rustdoc treats these as item descriptions / synopses on module pages.
Diffstat (limited to 'compiler/rustc_hir_analysis/src/lib.rs')
| -rw-r--r-- | compiler/rustc_hir_analysis/src/lib.rs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/compiler/rustc_hir_analysis/src/lib.rs b/compiler/rustc_hir_analysis/src/lib.rs index e95ed554a78..d7fcb19a536 100644 --- a/compiler/rustc_hir_analysis/src/lib.rs +++ b/compiler/rustc_hir_analysis/src/lib.rs @@ -30,8 +30,8 @@ several major phases: The type checker is defined into various submodules which are documented independently: -- astconv: converts the AST representation of types - into the `ty` representation. +- astconv: lowers type-system entities from the [HIR][hir] to the + [`rustc_middle::ty`] representation. - collect: computes the types of each top-level item and enters them into the `tcx.types` table for later use. @@ -211,8 +211,16 @@ pub fn check_crate(tcx: TyCtxt<'_>) -> Result<(), ErrorGuaranteed> { Ok(()) } -/// A quasi-deprecated helper used in rustdoc and clippy to get -/// the type from a HIR node. +/// Lower a [`hir::Ty`] to a [`Ty`]. +/// +/// <div class="warning"> +/// +/// This function is **quasi-deprecated**. It can cause ICEs if called inside of a body +/// (of a function or constant) and especially if it contains inferred types (`_`). +/// +/// It's used in rustdoc and Clippy. +/// +/// </div> pub fn lower_ty<'tcx>(tcx: TyCtxt<'tcx>, hir_ty: &hir::Ty<'tcx>) -> Ty<'tcx> { // In case there are any projections, etc., find the "environment" // def-ID that will be used to determine the traits/predicates in |
