Skip to content

Commit b7026f8

Browse files
committed
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.
1 parent 75390b9 commit b7026f8

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

book/src/development/type_checking.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,10 @@ Here the HIR sees the types without "thinking" about them, it knows that the fun
118118
an `u32`. As far as `hir::Ty` is concerned those might be different types. But at the `ty::Ty` level the compiler
119119
understands that they're the same type, in-depth lifetimes, etc...
120120

121-
To get from a `hir::Ty` to a `ty::Ty`, you can use the [`hir_ty_to_ty`][hir_ty_to_ty] function outside of bodies or
121+
To get from a `hir::Ty` to a `ty::Ty`, you can use the [`lower_ty`][lower_ty] function outside of bodies or
122122
the [`TypeckResults::node_type()`][node_type] method inside of bodies.
123123

124-
> **Warning**: Don't use `hir_ty_to_ty` inside of bodies, because this can cause ICEs.
124+
> **Warning**: Don't use `lower_ty` inside of bodies, because this can cause ICEs.
125125
126126
## Creating Types programmatically
127127

@@ -162,6 +162,6 @@ in this chapter:
162162
[Ty]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.Ty.html
163163
[TyKind]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_type_ir/ty_kind/enum.TyKind.html
164164
[TypeckResults]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TypeckResults.html
165-
[middle_ty]: https://doc.rust-lang.org/beta/nightly-rustc/rustc_middle/ty/struct.Ty.html
166-
[hir_ty]: https://doc.rust-lang.org/beta/nightly-rustc/rustc_hir/struct.Ty.html
167-
[hir_ty_to_ty]: https://doc.rust-lang.org/beta/nightly-rustc/rustc_hir_analysis/fn.hir_ty_to_ty.html
165+
[middle_ty]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.Ty.html
166+
[hir_ty]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/struct.Ty.html
167+
[lower_ty]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir_analysis/fn.lower_ty.html

clippy_lints/src/types/redundant_allocation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, hir_ty: &hir::Ty<'tcx>, qpath:
5656
};
5757
let inner_span = match qpath_generic_tys(inner_qpath).next() {
5858
Some(hir_ty) => {
59-
// Reallocation of a fat pointer causes it to become thin. `hir_ty_to_ty` is safe to use
59+
// Reallocation of a fat pointer causes it to become thin. `lower_ty` is safe to use
6060
// here because `mod.rs` guarantees this lint is only run on types outside of bodies and
6161
// is not run on locals.
6262
let ty = lower_ty(cx.tcx, hir_ty);

clippy_lints/src/use_self.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ impl<'tcx> LateLintPass<'tcx> for UseSelf {
193193
}
194194

195195
fn check_body(&mut self, _: &LateContext<'_>, _: &hir::Body<'_>) {
196-
// `hir_ty_to_ty` cannot be called in `Body`s or it will panic (sometimes). But in bodies
196+
// `lower_ty` cannot be called in `Body`s or it will panic (sometimes). But in bodies
197197
// we can use `cx.typeck_results.node_type(..)` to get the `ty::Ty` from a `hir::Ty`.
198198
// However the `node_type()` method can *only* be called in bodies.
199199
if let Some(&mut StackItem::Check { ref mut in_body, .. }) = self.stack.last_mut() {

tests/ui/crashes/ice-6179.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//! This is a minimal reproducer for the ICE in https://github.com/rust-lang/rust-clippy/pull/6179.
2-
//! The ICE is mainly caused by using `hir_ty_to_ty`. See the discussion in the PR for details.
2+
//! The ICE is mainly caused by using `lower_ty`. See the discussion in the PR for details.
33
44
#![warn(clippy::use_self)]
55
#![allow(dead_code, clippy::let_with_type_underscore)]

0 commit comments

Comments
 (0)