You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: book/src/development/type_checking.md
+7-4
Original file line number
Diff line number
Diff line change
@@ -104,13 +104,16 @@ impl LateLintPass<'_> for MyStructLint {
104
104
105
105
## `hir::Ty` and `ty::Ty`
106
106
107
-
We've been talking about [`ty::Ty`][middle_ty] this whole time without addressing [`hir::Ty`][hir_ty], but the latter is also important to understand.
107
+
We've been talking about [`ty::Ty`][middle_ty] this whole time without addressing [`hir::Ty`][hir_ty], but the latter
108
+
is also important to understand.
108
109
109
-
`hir::Ty` would represent *what* an user wrote, while `ty::Ty` would understand the meaning of it (because it has more information).
110
+
`hir::Ty` would represent *what* an user wrote, while `ty::Ty` would understand the meaning of it (because it has more
111
+
information).
110
112
111
113
**Example: `fn foo(x: u32) -> u32 { x }`**
112
114
113
-
Here the HIR sees the types without "thinking" about them, it knows that the function takes an `u32` and returns an `u32`. But at the `ty::Ty` level the compiler understands that they're the same type, in-depth lifetimes, etc...
115
+
Here the HIR sees the types without "thinking" about them, it knows that the function takes an `u32` and returns
116
+
an `u32`. But at the `ty::Ty` level the compiler understands that they're the same type, in-depth lifetimes, etc...
114
117
115
118
you can use the [`hir_ty_to_ty`][hir_ty_to_ty] function to convert from a `hir::Ty` to a `ty::Ty`
0 commit comments