add an ObligationCauseCode we'll use later (ReturnNoExpression)

This commit is contained in:
Niko Matsakis 2017-03-17 09:37:18 -04:00
parent 27f4b57602
commit eeb6447bbf
3 changed files with 7 additions and 0 deletions

View File

@ -904,6 +904,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
ObligationCauseCode::StartFunctionType | ObligationCauseCode::StartFunctionType |
ObligationCauseCode::IntrinsicType | ObligationCauseCode::IntrinsicType |
ObligationCauseCode::MethodReceiver | ObligationCauseCode::MethodReceiver |
ObligationCauseCode::ReturnNoExpression |
ObligationCauseCode::MiscObligation => { ObligationCauseCode::MiscObligation => {
} }
ObligationCauseCode::SliceOrArrayElem => { ObligationCauseCode::SliceOrArrayElem => {

View File

@ -173,6 +173,9 @@ pub enum ObligationCauseCode<'tcx> {
// method receiver // method receiver
MethodReceiver, MethodReceiver,
// `return` with no expression
ReturnNoExpression,
} }
#[derive(Clone, Debug, PartialEq, Eq)] #[derive(Clone, Debug, PartialEq, Eq)]

View File

@ -167,6 +167,7 @@ impl<'a, 'tcx> Lift<'tcx> for traits::ObligationCauseCode<'a> {
type Lifted = traits::ObligationCauseCode<'tcx>; type Lifted = traits::ObligationCauseCode<'tcx>;
fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<Self::Lifted> { fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<Self::Lifted> {
match *self { match *self {
super::ReturnNoExpression => Some(super::ReturnNoExpression),
super::MiscObligation => Some(super::MiscObligation), super::MiscObligation => Some(super::MiscObligation),
super::SliceOrArrayElem => Some(super::SliceOrArrayElem), super::SliceOrArrayElem => Some(super::SliceOrArrayElem),
super::TupleElem => Some(super::TupleElem), super::TupleElem => Some(super::TupleElem),
@ -489,6 +490,7 @@ impl<'tcx> TypeFoldable<'tcx> for traits::ObligationCauseCode<'tcx> {
super::StructInitializerSized | super::StructInitializerSized |
super::VariableType(_) | super::VariableType(_) |
super::ReturnType | super::ReturnType |
super::ReturnNoExpression |
super::RepeatVec | super::RepeatVec |
super::FieldSized | super::FieldSized |
super::ConstSized | super::ConstSized |
@ -533,6 +535,7 @@ impl<'tcx> TypeFoldable<'tcx> for traits::ObligationCauseCode<'tcx> {
super::StructInitializerSized | super::StructInitializerSized |
super::VariableType(_) | super::VariableType(_) |
super::ReturnType | super::ReturnType |
super::ReturnNoExpression |
super::RepeatVec | super::RepeatVec |
super::FieldSized | super::FieldSized |
super::ConstSized | super::ConstSized |