File tree 1 file changed +3
-2
lines changed
src/doc/rustc-dev-guide/src
1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -167,7 +167,8 @@ equal when testing whether they can be assigned to each other (which is a common
167
167
diagnostics code). ` == ` on them will return ` false ` though, since they are different types.
168
168
169
169
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.
171
172
This is typically what you want to check during diagnostics, which is concerned with questions such
172
173
as whether two types can be assigned to each other, not whether they're represented identically in
173
174
the compiler's type-checking layer.
@@ -183,7 +184,7 @@ primarily a concern during HIR type checking and with all types from a `TyCtxt`
183
184
(for example from ` tcx.type_of() ` ).
184
185
185
186
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
187
188
` tcx.normalize_erasing_regions(ty) ` .
188
189
189
190
There are also cases where using ` == ` on ` Ty ` is fine. This is for example the case in late lints
You can’t perform that action at this time.
0 commit comments