mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-11 08:05:12 +00:00
coerce documentation
This commit is contained in:
parent
eece58a8e3
commit
01b3637f6e
@ -186,7 +186,6 @@ impl<'a, 'tcx> At<'a, 'tcx> {
|
||||
impl<'a, 'tcx> Trace<'a, 'tcx> {
|
||||
/// Makes `a <: b` where `a` may or may not be expected (if
|
||||
/// `a_is_expected` is true, then `a` is expected).
|
||||
/// Makes `expected <: actual`.
|
||||
pub fn sub<T>(self, a: &T, b: &T) -> InferResult<'tcx, ()>
|
||||
where
|
||||
T: Relate<'tcx>,
|
||||
|
@ -107,6 +107,7 @@ fn coerce_mutbls<'tcx>(
|
||||
}
|
||||
}
|
||||
|
||||
/// Do not require any adjustments, i.e. coerce `x -> x`.
|
||||
fn identity(_: Ty<'_>) -> Vec<Adjustment<'_>> {
|
||||
vec![]
|
||||
}
|
||||
@ -115,6 +116,7 @@ fn simple(kind: Adjust<'tcx>) -> impl FnOnce(Ty<'tcx>) -> Vec<Adjustment<'tcx>>
|
||||
move |target| vec![Adjustment { kind, target }]
|
||||
}
|
||||
|
||||
/// This always returns `Ok(...)`.
|
||||
fn success<'tcx>(
|
||||
adj: Vec<Adjustment<'tcx>>,
|
||||
target: Ty<'tcx>,
|
||||
@ -133,6 +135,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
|
||||
}
|
||||
|
||||
pub fn unify(&self, a: Ty<'tcx>, b: Ty<'tcx>) -> InferResult<'tcx, Ty<'tcx>> {
|
||||
debug!("unify(a: {:?}, b: {:?}, use_lub: {})", a, b, self.use_lub);
|
||||
self.commit_if_ok(|_| {
|
||||
if self.use_lub {
|
||||
self.at(&self.cause, self.fcx.param_env).lub(b, a)
|
||||
|
Loading…
Reference in New Issue
Block a user