typeck: rename mk_assignty to coercion::try.
This commit is contained in:
parent
2b1bd80f34
commit
871a1e1cf8
@ -239,7 +239,7 @@ impl<'tcx> CastCheck<'tcx> {
|
||||
(None, Some(t_cast)) => {
|
||||
if let ty::TyFnDef(_, _, f) = self.expr_ty.sty {
|
||||
// Attempt a coercion to a fn pointer type.
|
||||
let res = coercion::mk_assignty(fcx, &self.expr,
|
||||
let res = coercion::try(fcx, &self.expr,
|
||||
self.expr_ty, fcx.tcx().mk_ty(ty::TyFnPtr(f)));
|
||||
if !res.is_ok() {
|
||||
return Err(CastError::NonScalar);
|
||||
@ -390,14 +390,7 @@ impl<'tcx> CastCheck<'tcx> {
|
||||
}
|
||||
|
||||
fn try_coercion_cast<'a>(&self, fcx: &FnCtxt<'a, 'tcx>) -> bool {
|
||||
if let Ok(()) = coercion::mk_assignty(fcx,
|
||||
&self.expr,
|
||||
self.expr_ty,
|
||||
self.cast_ty) {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
coercion::try(fcx, &self.expr, self.expr_ty, self.cast_ty).is_ok()
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -435,12 +435,12 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn mk_assignty<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
|
||||
expr: &hir::Expr,
|
||||
a: Ty<'tcx>,
|
||||
b: Ty<'tcx>)
|
||||
-> RelateResult<'tcx, ()> {
|
||||
debug!("mk_assignty({:?} -> {:?})", a, b);
|
||||
pub fn try<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
|
||||
expr: &hir::Expr,
|
||||
a: Ty<'tcx>,
|
||||
b: Ty<'tcx>)
|
||||
-> RelateResult<'tcx, ()> {
|
||||
debug!("coercion::try({:?} -> {:?})", a, b);
|
||||
let mut unsizing_obligations = vec![];
|
||||
let adjustment = try!(indent(|| {
|
||||
fcx.infcx().commit_if_ok(|_| {
|
||||
|
Loading…
x
Reference in New Issue
Block a user