about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2017-03-17 09:37:18 -0400
committerNiko Matsakis <niko@alum.mit.edu>2017-03-30 07:55:29 -0400
commiteeb6447bbfbb34ec093b723ff6a9dd40df2287bb (patch)
tree7c68fd5f4f82e3215384e42c539fbc00dd12e11f /src
parent27f4b57602a01c2b49c09b161e1ddca26752fec8 (diff)
downloadrust-eeb6447bbfbb34ec093b723ff6a9dd40df2287bb.tar.gz
rust-eeb6447bbfbb34ec093b723ff6a9dd40df2287bb.zip
add an `ObligationCauseCode` we'll use later (`ReturnNoExpression`)
Diffstat (limited to 'src')
-rw-r--r--src/librustc/traits/error_reporting.rs1
-rw-r--r--src/librustc/traits/mod.rs3
-rw-r--r--src/librustc/traits/structural_impls.rs3
3 files changed, 7 insertions, 0 deletions
diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs
index 27525d550ff..152dd6ac300 100644
--- a/src/librustc/traits/error_reporting.rs
+++ b/src/librustc/traits/error_reporting.rs
@@ -904,6 +904,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
             ObligationCauseCode::StartFunctionType |
             ObligationCauseCode::IntrinsicType |
             ObligationCauseCode::MethodReceiver |
+            ObligationCauseCode::ReturnNoExpression |
             ObligationCauseCode::MiscObligation => {
             }
             ObligationCauseCode::SliceOrArrayElem => {
diff --git a/src/librustc/traits/mod.rs b/src/librustc/traits/mod.rs
index c71fc28b4d6..47cbccdd2ab 100644
--- a/src/librustc/traits/mod.rs
+++ b/src/librustc/traits/mod.rs
@@ -173,6 +173,9 @@ pub enum ObligationCauseCode<'tcx> {
 
     // method receiver
     MethodReceiver,
+
+    // `return` with no expression
+    ReturnNoExpression,
 }
 
 #[derive(Clone, Debug, PartialEq, Eq)]
diff --git a/src/librustc/traits/structural_impls.rs b/src/librustc/traits/structural_impls.rs
index 717c171db2a..44ef461327d 100644
--- a/src/librustc/traits/structural_impls.rs
+++ b/src/librustc/traits/structural_impls.rs
@@ -167,6 +167,7 @@ impl<'a, 'tcx> Lift<'tcx> for traits::ObligationCauseCode<'a> {
     type Lifted = traits::ObligationCauseCode<'tcx>;
     fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<Self::Lifted> {
         match *self {
+            super::ReturnNoExpression => Some(super::ReturnNoExpression),
             super::MiscObligation => Some(super::MiscObligation),
             super::SliceOrArrayElem => Some(super::SliceOrArrayElem),
             super::TupleElem => Some(super::TupleElem),
@@ -489,6 +490,7 @@ impl<'tcx> TypeFoldable<'tcx> for traits::ObligationCauseCode<'tcx> {
             super::StructInitializerSized |
             super::VariableType(_) |
             super::ReturnType |
+            super::ReturnNoExpression |
             super::RepeatVec |
             super::FieldSized |
             super::ConstSized |
@@ -533,6 +535,7 @@ impl<'tcx> TypeFoldable<'tcx> for traits::ObligationCauseCode<'tcx> {
             super::StructInitializerSized |
             super::VariableType(_) |
             super::ReturnType |
+            super::ReturnNoExpression |
             super::RepeatVec |
             super::FieldSized |
             super::ConstSized |