Skip to content

Commit 85551e7

Browse files
committed
mention regionck and nll's disagreement of region subtyping
1 parent 0c74b3d commit 85551e7

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

compiler/rustc_infer/src/infer/outlives/obligations.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,17 @@ where
450450
}
451451

452452
pub trait OutlivesHandlingDelegate<'tcx> {
453+
/// Subtle: this trait exists to abstract the outlives handling between
454+
/// regular regionck and NLL. Unfortunately, NLL and regionck don't agree
455+
/// on how subtyping works.
456+
///
457+
/// In NLL `'a sub 'b` means `'a outlives 'b`.
458+
/// In regionck `'a sub 'b` means the set of locations `'a` is live at is a subset
459+
/// of the locations that `'b` is, or in other words, `'b outlives 'a`.
460+
///
461+
/// This method will be called with the regionck meaning of subtyping. i.e. if
462+
/// there is some `&'b u32: 'static` constraint, we will give a `'b sub 'static`
463+
/// constraint.
453464
fn push_sub_region_constraint(
454465
&mut self,
455466
origin: SubregionOrigin<'tcx>,

0 commit comments

Comments
 (0)