Function rustc_typeck::check::wfcheck::check_item_well_formed[][src]

pub fn check_item_well_formed<'a, 'tcx>(
    tcx: TyCtxt<'a, 'tcx, 'tcx>,
    def_id: DefId
)
🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

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.