Invoke coercions on !

This commit is contained in:
Andrew Cann 2016-06-25 20:02:09 +08:00
parent 0d863616e0
commit c88c54ec5a

View File

@ -68,7 +68,8 @@ use rustc::traits::{self, ObligationCause};
use rustc::ty::adjustment::{AutoAdjustment, AutoDerefRef, AdjustDerefRef};
use rustc::ty::adjustment::{AutoPtr, AutoUnsafe, AdjustReifyFnPointer};
use rustc::ty::adjustment::{AdjustUnsafeFnPointer, AdjustMutToConstPointer};
use rustc::ty::{self, LvaluePreference, TypeAndMut, Ty};
use rustc::ty::adjustment::AdjustEmptyToAny;
use rustc::ty::{self, TypeVariants, LvaluePreference, TypeAndMut, Ty};
use rustc::ty::fold::TypeFoldable;
use rustc::ty::error::TypeError;
use rustc::ty::relate::RelateResult;
@ -167,6 +168,10 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> {
return self.identity(b);
}
if let TypeVariants::TyEmpty = a.sty {
return Ok((b, AdjustEmptyToAny(b)));
}
// Consider coercing the subtype to a DST
let unsize = self.coerce_unsized(a, b);
if unsize.is_ok() {