Module rustc_typeck::impl_wf_check [−][src]
🔬 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?
This pass enforces various "well-formedness constraints" on impls. Logically, it is part of wfcheck -- but we do it early so that we can stop compilation afterwards, since part of the trait matching infrastructure gets very grumpy if these conditions don't hold. In particular, if there are type parameters that are not part of the impl, then coherence will report strange inference ambiguity errors; if impls have duplicate items, we get misleading specialization errors. These things can (and probably should) be fixed, but for the moment it's easier to do these checks early.
Re-exports
use constrained_type_params as ctp; |
use rustc::hir; |
use rustc::hir::itemlikevisit::ItemLikeVisitor; |
use rustc::hir::def_id::DefId; |
use rustc::ty; |
use rustc::ty::TyCtxt; |
use rustc::util::nodemap::FxHashMap; |
use rustc::util::nodemap::FxHashMap; |
use rustc::util::nodemap::FxHashSet; |
use rustc::util::nodemap::FxHashSet; |
use std::collections::hash_map::Entry::Occupied; |
use std::collections::hash_map::Entry::Vacant; |
use syntax_pos::Span; |
Structs
ImplWfCheck |
[ Experimental ]
|
Functions
enforce_impl_items_are_distinct |
[ Experimental ] Enforce that we do not have two items in an impl with the same name. |
enforce_impl_params_are_constrained |
[ Experimental ]
|
impl_wf_check |
[ Experimental ] Checks that all the type/lifetime parameters on an impl also
appear in the trait ref or self-type (or are constrained by a
where-clause). These rules are needed to ensure that, given a
trait ref like |
report_unused_parameter |
[ Experimental ]
|