@@ -5,6 +5,7 @@ use std::iter::FromIterator;
5
5
use syntax:: source_map:: Span ;
6
6
use crate :: ty:: subst:: GenericArg ;
7
7
use crate :: ty:: { self , Ty , TyCtxt } ;
8
+ use crate :: ty:: query:: Providers ;
8
9
9
10
impl < ' cx , ' tcx > At < ' cx , ' tcx > {
10
11
/// Given a type `ty` of some value being dropped, computes a set
@@ -33,7 +34,7 @@ impl<'cx, 'tcx> At<'cx, 'tcx> {
33
34
// Quick check: there are a number of cases that we know do not require
34
35
// any destructor.
35
36
let tcx = self . infcx . tcx ;
36
- if trivial_dropck_outlives ( tcx , ty) {
37
+ if tcx . trivial_dropck_outlives ( ty) {
37
38
return InferOk {
38
39
value : vec ! [ ] ,
39
40
obligations : vec ! [ ] ,
@@ -207,15 +208,15 @@ pub fn trivial_dropck_outlives<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> bool {
207
208
| ty:: Error => true ,
208
209
209
210
// [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) ,
211
212
212
213
// (T1..Tn) and closures have same properties as T1..Tn --
213
214
// 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 ( ) ) ) ,
215
216
ty:: Closure ( def_id, ref substs) => substs
216
217
. as_closure ( )
217
218
. upvar_tys ( def_id, tcx)
218
- . all ( |t| trivial_dropck_outlives ( tcx , t) ) ,
219
+ . all ( |t| tcx . trivial_dropck_outlives ( t) ) ,
219
220
220
221
ty:: Adt ( def, _) => {
221
222
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 {
243
244
ty:: UnnormalizedProjection ( ..) => bug ! ( "only used with chalk-engine" ) ,
244
245
}
245
246
}
247
+
248
+ crate fn provide ( p : & mut Providers < ' _ > ) {
249
+ * p = Providers {
250
+ trivial_dropck_outlives,
251
+ ..* p
252
+ } ;
253
+ }
0 commit comments