Skip to content

Commit e7efce2

Browse files
nikomatsakissgrif
authored andcommitted
add some comments to Obligation
1 parent 803bd76 commit e7efce2

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
@@ -77,10 +77,21 @@ pub enum IntercrateMode {
7777
/// scope. The eventual result is usually a `Selection` (defined below).
7878
#[derive(Clone, PartialEq, Eq, Hash)]
7979
pub struct Obligation<'tcx, T> {
80+
/// Why do we have to prove this thing?
8081
pub cause: ObligationCause<'tcx>,
82+
83+
/// In which environment should we prove this thing?
8184
pub param_env: ty::ParamEnv<'tcx>,
82-
pub recursion_depth: usize,
85+
86+
/// What are we trying to prove?
8387
pub predicate: T,
88+
89+
/// If we started proving this as a result of trying to prove
90+
/// something else, track the total depth to ensure termination.
91+
/// If this goes over a certain threshold, we abort compilation --
92+
/// in such cases, we can not say whether or not the predicate
93+
/// holds for certain. Stupid halting problem. Such a drag.
94+
pub recursion_depth: usize,
8495
}
8596

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

0 commit comments

Comments
 (0)