|
2 | 2 | // refers to rules defined in RFC 1214 (`OutlivesFooBar`), so see that
|
3 | 3 | // RFC for reference.
|
4 | 4 |
|
5 |
| -use crate::ty::subst::{GenericArg, GenericArgKind}; |
6 |
| -use crate::ty::{self, Ty, TyCtxt, TypeFoldable}; |
7 | 5 | use rustc_data_structures::sso::SsoHashSet;
|
8 |
| -use smallvec::SmallVec; |
| 6 | +use rustc_middle::ty::subst::{GenericArg, GenericArgKind}; |
| 7 | +use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable}; |
| 8 | +use smallvec::{smallvec, SmallVec}; |
9 | 9 |
|
10 | 10 | #[derive(Debug)]
|
11 | 11 | pub enum Component<'tcx> {
|
@@ -47,14 +47,16 @@ pub enum Component<'tcx> {
|
47 | 47 | EscapingProjection(Vec<Component<'tcx>>),
|
48 | 48 | }
|
49 | 49 |
|
50 |
| -impl<'tcx> TyCtxt<'tcx> { |
51 |
| - /// Push onto `out` all the things that must outlive `'a` for the condition |
52 |
| - /// `ty0: 'a` to hold. Note that `ty0` must be a **fully resolved type**. |
53 |
| - pub fn push_outlives_components(self, ty0: Ty<'tcx>, out: &mut SmallVec<[Component<'tcx>; 4]>) { |
54 |
| - let mut visited = SsoHashSet::new(); |
55 |
| - compute_components(self, ty0, out, &mut visited); |
56 |
| - debug!("components({:?}) = {:?}", ty0, out); |
57 |
| - } |
| 50 | +/// Push onto `out` all the things that must outlive `'a` for the condition |
| 51 | +/// `ty0: 'a` to hold. Note that `ty0` must be a **fully resolved type**. |
| 52 | +pub fn push_outlives_components( |
| 53 | + tcx: TyCtxt<'tcx>, |
| 54 | + ty0: Ty<'tcx>, |
| 55 | + out: &mut SmallVec<[Component<'tcx>; 4]>, |
| 56 | +) { |
| 57 | + let mut visited = SsoHashSet::new(); |
| 58 | + compute_components(tcx, ty0, out, &mut visited); |
| 59 | + debug!("components({:?}) = {:?}", ty0, out); |
58 | 60 | }
|
59 | 61 |
|
60 | 62 | fn compute_components(
|
|
0 commit comments