This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
src/doc/rustc-dev-guide/src Expand file tree Collapse file tree 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
167167diagnostics code). ` == ` on them will return ` false ` though, since they are different types.
168168
169169The 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.
171172This is typically what you want to check during diagnostics, which is concerned with questions such
172173as whether two types can be assigned to each other, not whether they're represented identically in
173174the 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
185186When 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
189190There 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