Skip to content

Commit a416685

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

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

compiler/rustc_middle/src/mir/query.rs

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

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

0 commit comments

Comments
 (0)