Skip to content

Commit 01b3637

Browse files
committed
coerce documentation
1 parent eece58a commit 01b3637

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/librustc_infer/infer/at.rs

-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ impl<'a, 'tcx> At<'a, 'tcx> {
186186
impl<'a, 'tcx> Trace<'a, 'tcx> {
187187
/// Makes `a <: b` where `a` may or may not be expected (if
188188
/// `a_is_expected` is true, then `a` is expected).
189-
/// Makes `expected <: actual`.
190189
pub fn sub<T>(self, a: &T, b: &T) -> InferResult<'tcx, ()>
191190
where
192191
T: Relate<'tcx>,

src/librustc_typeck/check/coercion.rs

+3
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ fn coerce_mutbls<'tcx>(
107107
}
108108
}
109109

110+
/// Do not require any adjustments, i.e. coerce `x -> x`.
110111
fn identity(_: Ty<'_>) -> Vec<Adjustment<'_>> {
111112
vec![]
112113
}
@@ -115,6 +116,7 @@ fn simple(kind: Adjust<'tcx>) -> impl FnOnce(Ty<'tcx>) -> Vec<Adjustment<'tcx>>
115116
move |target| vec![Adjustment { kind, target }]
116117
}
117118

119+
/// This always returns `Ok(...)`.
118120
fn success<'tcx>(
119121
adj: Vec<Adjustment<'tcx>>,
120122
target: Ty<'tcx>,
@@ -133,6 +135,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
133135
}
134136

135137
pub fn unify(&self, a: Ty<'tcx>, b: Ty<'tcx>) -> InferResult<'tcx, Ty<'tcx>> {
138+
debug!("unify(a: {:?}, b: {:?}, use_lub: {})", a, b, self.use_lub);
136139
self.commit_if_ok(|_| {
137140
if self.use_lub {
138141
self.at(&self.cause, self.fcx.param_env).lub(b, a)

0 commit comments

Comments
 (0)