improve documentation for resolve()
This commit is contained in:
parent
08e1f0b9d7
commit
59e778e5e1
1 changed files with 18 additions and 2 deletions
|
|
@ -116,8 +116,24 @@ impl<'a, 'b, 'tcx> Instance<'tcx> {
|
|||
self.def.def_id()
|
||||
}
|
||||
|
||||
/// The point where linking happens. Resolve a (def_id, substs)
|
||||
/// pair to an instance.
|
||||
/// Resolve a (def_id, substs) pair to an (optional) instance -- most commonly,
|
||||
/// this is used to find the precise code that will run for a trait method invocation,
|
||||
/// if known.
|
||||
///
|
||||
/// Returns `None` if we cannot resolve `Instance` to a specific instance.
|
||||
/// For example, in a context like this,
|
||||
///
|
||||
/// ```
|
||||
/// fn foo<T: Debug>(t: T) { ... }
|
||||
/// ```
|
||||
///
|
||||
/// trying to resolve `Debug::fmt` applied to `T` will yield `None`, because we do not
|
||||
/// know what code ought to run. (Note that this setting is also affected by the
|
||||
/// `RevealMode` in the parameter environment.)
|
||||
///
|
||||
/// Presuming that coherence and type-check have succeeded, if this method is invoked
|
||||
/// in a monomorphic context (i.e., like during trans), then it is guaranteed to return
|
||||
/// `Some`.
|
||||
pub fn resolve(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
def_id: DefId,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue