@@ -5,6 +5,7 @@ use std::iter::FromIterator;
55use syntax:: source_map:: Span ;
66use crate :: ty:: subst:: GenericArg ;
77use crate :: ty:: { self , Ty , TyCtxt } ;
8+ use crate :: ty:: query:: Providers ;
89
910impl < ' cx , ' tcx > At < ' cx , ' tcx > {
1011 /// Given a type `ty` of some value being dropped, computes a set
@@ -33,7 +34,7 @@ impl<'cx, 'tcx> At<'cx, 'tcx> {
3334 // Quick check: there are a number of cases that we know do not require
3435 // any destructor.
3536 let tcx = self . infcx . tcx ;
36- if trivial_dropck_outlives ( tcx , ty) {
37+ if tcx . trivial_dropck_outlives ( ty) {
3738 return InferOk {
3839 value : vec ! [ ] ,
3940 obligations : vec ! [ ] ,
@@ -207,15 +208,15 @@ pub fn trivial_dropck_outlives<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> bool {
207208 | ty:: Error => true ,
208209
209210 // [T; N] and [T] have same properties as T.
210- ty:: Array ( ty, _) | ty:: Slice ( ty) => trivial_dropck_outlives ( tcx , ty) ,
211+ ty:: Array ( ty, _) | ty:: Slice ( ty) => tcx . trivial_dropck_outlives ( ty) ,
211212
212213 // (T1..Tn) and closures have same properties as T1..Tn --
213214 // check if *any* of those are trivial.
214- ty:: Tuple ( ref tys) => tys. iter ( ) . all ( |t| trivial_dropck_outlives ( tcx , t. expect_ty ( ) ) ) ,
215+ ty:: Tuple ( ref tys) => tys. iter ( ) . all ( |t| tcx . trivial_dropck_outlives ( t. expect_ty ( ) ) ) ,
215216 ty:: Closure ( def_id, ref substs) => substs
216217 . as_closure ( )
217218 . upvar_tys ( def_id, tcx)
218- . all ( |t| trivial_dropck_outlives ( tcx , t) ) ,
219+ . all ( |t| tcx . trivial_dropck_outlives ( t) ) ,
219220
220221 ty:: Adt ( def, _) => {
221222 if Some ( def. did ) == tcx. lang_items ( ) . manually_drop ( ) {
@@ -243,3 +244,10 @@ pub fn trivial_dropck_outlives<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> bool {
243244 ty:: UnnormalizedProjection ( ..) => bug ! ( "only used with chalk-engine" ) ,
244245 }
245246}
247+
248+ crate fn provide ( p : & mut Providers < ' _ > ) {
249+ * p = Providers {
250+ trivial_dropck_outlives,
251+ ..* p
252+ } ;
253+ }
0 commit comments