Skip to content

Commit d35ad8d

Browse files
committedApr 7, 2025
add negative impl
1 parent 474ec7a commit d35ad8d

File tree

1 file changed

+8
-4
lines changed
  • compiler/rustc_borrowck/src

1 file changed

+8
-4
lines changed
 

‎compiler/rustc_borrowck/src/lib.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#![feature(file_buffered)]
1010
#![feature(if_let_guard)]
1111
#![feature(let_chains)]
12+
#![feature(negative_impls)]
1213
#![feature(never_type)]
1314
#![feature(rustc_attrs)]
1415
#![feature(rustdoc_internals)]
@@ -36,7 +37,9 @@ use rustc_infer::infer::{
3637
};
3738
use rustc_middle::mir::*;
3839
use rustc_middle::query::Providers;
39-
use rustc_middle::ty::{self, ParamEnv, RegionVid, Ty, TyCtxt, TypingMode, fold_regions};
40+
use rustc_middle::ty::{
41+
self, ParamEnv, RegionVid, Ty, TyCtxt, TypeFoldable, TypeVisitable, TypingMode, fold_regions,
42+
};
4043
use rustc_middle::{bug, span_bug};
4144
use rustc_mir_dataflow::impls::{
4245
EverInitializedPlaces, MaybeInitializedPlaces, MaybeUninitializedPlaces,
@@ -236,13 +239,14 @@ pub enum ClosureOutlivesSubject<'tcx> {
236239
/// This abstraction is necessary because the type may include `ReVar` regions,
237240
/// which is what we use internally within NLL code, and they can't be used in
238241
/// a query response.
239-
///
240-
/// DO NOT implement `TypeVisitable` or `TypeFoldable` traits, because this
241-
/// type is not recognized as a binder for late-bound region.
242242
#[derive(Copy, Clone, Debug)]
243243
pub struct ClosureOutlivesSubjectTy<'tcx> {
244244
inner: Ty<'tcx>,
245245
}
246+
// DO NOT implement `TypeVisitable` or `TypeFoldable` traits, because this
247+
// type is not recognized as a binder for late-bound region.
248+
impl<'tcx, I> !TypeVisitable<I> for ClosureOutlivesSubjectTy<'tcx> {}
249+
impl<'tcx, I> !TypeFoldable<I> for ClosureOutlivesSubjectTy<'tcx> {}
246250

247251
impl<'tcx> ClosureOutlivesSubjectTy<'tcx> {
248252
/// All regions of `ty` must be of kind `ReVar` and must represent

0 commit comments

Comments
 (0)