Skip to content

Commit 2684779

Browse files
Noratriebtshepang
authored andcommitted
Add param_env and wording
1 parent 285c19f commit 2684779

File tree

1 file changed

+3
-2
lines changed
  • src/doc/rustc-dev-guide/src

1 file changed

+3
-2
lines changed

src/doc/rustc-dev-guide/src/ty.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ equal when testing whether they can be assigned to each other (which is a common
167167
diagnostics code). `==` on them will return `false` though, since they are different types.
168168

169169
The simplest way to compare two types correctly requires an inference context (`infcx`).
170-
If you have one, you can use `infcx.can_eq(ty1, ty2)` to check whether the types can be made equal.
170+
If you have one, you can use `infcx.can_eq(param_env, ty1, ty2)`
171+
to check whether the types can be made equal.
171172
This is typically what you want to check during diagnostics, which is concerned with questions such
172173
as whether two types can be assigned to each other, not whether they're represented identically in
173174
the compiler's type-checking layer.
@@ -183,7 +184,7 @@ primarily a concern during HIR type checking and with all types from a `TyCtxt`
183184
(for example from `tcx.type_of()`).
184185

185186
When a `FnCtxt` or an `ObligationCtxt` is available during type checking, `.normalize(ty)`
186-
can be used on them to normalize the type. After type checking, diagnostics code can use
187+
should be used on them to normalize the type. After type checking, diagnostics code can use
187188
`tcx.normalize_erasing_regions(ty)`.
188189

189190
There are also cases where using `==` on `Ty` is fine. This is for example the case in late lints

0 commit comments

Comments
 (0)