Skip to content

Commit e26386f

Browse files
committed
Enforce ClosureOutlivesSubjectTy not traversable
Previously only enforced via comment, now via negative impls.
1 parent 3c332fe commit e26386f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

compiler/rustc_middle/src/mir/query.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -401,14 +401,16 @@ pub enum ClosureOutlivesSubject<'tcx> {
401401
/// This abstraction is necessary because the type may include `ReVar` regions,
402402
/// which is what we use internally within NLL code, and they can't be used in
403403
/// a query response.
404-
///
405-
/// DO NOT implement `TypeVisitable` or `TypeFoldable` traits, because this
406-
/// type is not recognized as a binder for late-bound region.
407404
#[derive(Copy, Clone, Debug, TyEncodable, TyDecodable, HashStable)]
408405
pub struct ClosureOutlivesSubjectTy<'tcx> {
409406
inner: Ty<'tcx>,
410407
}
411408

409+
/// DO NOT implement `TypeVisitable` or `TypeFoldable` traits, because this
410+
/// type is not recognized as a binder for late-bound region.
411+
impl<'tcx, I> !ty::TypeFoldable<I> for ClosureOutlivesSubjectTy<'tcx> {}
412+
impl<'tcx, I> !ty::TypeVisitable<I> for ClosureOutlivesSubjectTy<'tcx> {}
413+
412414
impl<'tcx> ClosureOutlivesSubjectTy<'tcx> {
413415
/// All regions of `ty` must be of kind `ReVar` and must represent
414416
/// universal regions *external* to the closure.

0 commit comments

Comments
 (0)