Skip to content

Commit 2dba316

Browse files
nikomatsakissgrif
authored andcommitted
add some comments to Obligation
1 parent 70f7d58 commit 2dba316

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/librustc/traits/mod.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,21 @@ pub enum IntercrateMode {
7575
/// scope. The eventual result is usually a `Selection` (defined below).
7676
#[derive(Clone, PartialEq, Eq)]
7777
pub struct Obligation<'tcx, T> {
78+
/// Why do we have to prove this thing?
7879
pub cause: ObligationCause<'tcx>,
80+
81+
/// In which environment should we prove this thing?
7982
pub param_env: ty::ParamEnv<'tcx>,
80-
pub recursion_depth: usize,
83+
84+
/// What are we trying to prove?
8185
pub predicate: T,
86+
87+
/// If we started proving this as a result of trying to prove
88+
/// something else, track the total depth to ensure termination.
89+
/// If this goes over a certain threshold, we abort compilation --
90+
/// in such cases, we can not say whether or not the predicate
91+
/// holds for certain. Stupid halting problem. Such a drag.
92+
pub recursion_depth: usize,
8293
}
8394

8495
pub type PredicateObligation<'tcx> = Obligation<'tcx, ty::Predicate<'tcx>>;

0 commit comments

Comments
 (0)