Function rustc_hir_analysis::check::wfcheck::check_item
source · Expand description
Checks that the field types (in a struct def’n) or argument types (in an enum def’n) are well-formed, meaning that they do not require any constraints not declared in the struct definition itself. For example, this definition would be illegal:
struct Ref<'a, T> { x: &'a T }
because the type did not declare that T:'a
.
We do this check as a pre-pass before checking fn bodies because if these constraints are not included it frequently leads to confusing errors in fn bodies. So it’s better to check the types first.