diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2017-07-15 06:47:30 -0400 |
|---|---|---|
| committer | Sean Griffin <sean@seantheprogrammer.com> | 2018-03-01 08:04:26 -0700 |
| commit | e7efce23618adcc9c960e1518d00883da8a8c444 (patch) | |
| tree | ac4ec83c8324dec978fddbd7bb23506d28951de1 | |
| parent | 803bd761278e6e06baabfd5aa1aa15e75c4a16a4 (diff) | |
| download | rust-e7efce23618adcc9c960e1518d00883da8a8c444.tar.gz rust-e7efce23618adcc9c960e1518d00883da8a8c444.zip | |
add some comments to `Obligation`
| -rw-r--r-- | src/librustc/traits/mod.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/librustc/traits/mod.rs b/src/librustc/traits/mod.rs index c1ffc10c3c0..027ad4174bd 100644 --- a/src/librustc/traits/mod.rs +++ b/src/librustc/traits/mod.rs @@ -77,10 +77,21 @@ pub enum IntercrateMode { /// scope. The eventual result is usually a `Selection` (defined below). #[derive(Clone, PartialEq, Eq, Hash)] pub struct Obligation<'tcx, T> { + /// Why do we have to prove this thing? pub cause: ObligationCause<'tcx>, + + /// In which environment should we prove this thing? pub param_env: ty::ParamEnv<'tcx>, - pub recursion_depth: usize, + + /// What are we trying to prove? pub predicate: T, + + /// If we started proving this as a result of trying to prove + /// something else, track the total depth to ensure termination. + /// If this goes over a certain threshold, we abort compilation -- + /// in such cases, we can not say whether or not the predicate + /// holds for certain. Stupid halting problem. Such a drag. + pub recursion_depth: usize, } pub type PredicateObligation<'tcx> = Obligation<'tcx, ty::Predicate<'tcx>>; |
