Skip to content

Commit f717215

Browse files
committed
Update outdated doc for types
1 parent 101bfc8 commit f717215

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/ty.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ HIR is built, some basic type inference and type checking is done. During the ty
7474
figure out what the `ty::Ty` of everything is and we also check if the type of something is
7575
ambiguous. The `ty::Ty` is then used for type checking while making sure everything has the
7676
expected type. The [`astconv` module][astconv] is where the code responsible for converting a
77-
`rustc_hir::Ty` into a `ty::Ty` is located. This occurs during the type-checking phase,
77+
`rustc_hir::Ty` into a `ty::Ty` is located, the main routine used is `ast_ty_to_ty`. This occurs during the type-checking phase,
7878
but also in other parts of the compiler that want to ask questions like "what argument types does
7979
this function expect?"
8080

@@ -137,11 +137,11 @@ benefits of interning.
137137

138138
## Allocating and working with types
139139

140-
To allocate a new type, you can use the various `mk_` methods defined on the `tcx`. These have names
140+
To allocate a new type, you can use the various `new_` methods defined on the [`rustc_middle::ty`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.Ty.html). These have names
141141
that correspond mostly to the various kinds of types. For example:
142142

143143
```rust,ignore
144-
let array_ty = tcx.mk_array(elem_ty, len * 2);
144+
let array_ty = Ty::new_array_with_const_len(tcx, ty,count)
145145
```
146146

147147
These methods all return a `Ty<'tcx>` – note that the lifetime you get back is the lifetime of the

0 commit comments

Comments
 (0)