pub fn dropck_outlives(&self, ty: Ty<'tcx>) -> InferOk<'tcx, Vec<Kind<'tcx>>> {
        debug!(
            "dropck_outlives(ty={:?}, param_env={:?})",
            ty, self.param_env,
        );

        // Quick check: there are a number of cases that we know do not require
        // any destructor.
        let tcx = self.infcx.tcx;
        if trivial_dropck_outlives(tcx, ty) {
            return InferOk {
                value: vec![],
                obligations: vec![],
            };
        }

        let gcx = tcx.global_tcx();
        let mut orig_values = SmallVec::new();
        let c_ty = self.infcx.canonicalize_query(&self.param_env.and(ty), &mut orig_values);
        let span = self.cause.span;
        debug!("c_ty = {:?}", c_ty);
        match &gcx.dropck_outlives(c_ty) {
            Ok(result) if result.is_proven() => {
                match self.infcx.instantiate_query_result_and_region_obligations(
                    self.cause,
                    self.param_env,
                    &orig_values,
                    result,
                ) {
                    Ok(InferOk { value, obligations }) => {
                        let ty = self.infcx.resolve_type_vars_if_possible(&ty);
                        let kinds = value.into_kinds_reporting_overflows(tcx, span, ty);
                        return InferOk {
                            value: kinds,
                            obligations,
                        };
                    }

                    Err(_) => { /* fallthrough to error-handling code below */ }
                }
            }

            _ => { /* fallthrough to error-handling code below */ }
        }

        // Errors and ambiuity in dropck occur in two cases:
        // - unresolved inference variables at the end of typeck
        // - non well-formed types where projections cannot be resolved
        // Either of these should hvae created an error before.
        tcx.sess
            .delay_span_bug(span, "dtorck encountered internal error");
        return InferOk {
            value: vec![],
            obligations: vec![],
        };
    }
/// Given a type `ty` of some value being dropped, computes a set
/// of "kinds" (types, regions) that must be outlive the execution
/// of the destructor. These basically correspond to data that the
/// destructor might access. This is used during regionck to
/// impose "outlives" constraints on any lifetimes referenced
/// within.
///
/// The rules here are given by the "dropck" RFCs, notably [#1238]
/// and [#1327]. This is a fixed-point computation, where we
/// explore all the data that will be dropped (transitively) when
/// a value of type `ty` is dropped. For each type T that will be
/// dropped and which has a destructor, we must assume that all
/// the types/regions of T are live during the destructor, unless
/// they are marked with a special attribute (`#[may_dangle]`).
///
/// [#1238]: https://github.com/rust-lang/rfcs/blob/master/text/1238-nonparametric-dropck.md
/// [#1327]: https://github.com/rust-lang/rfcs/blob/master/text/1327-dropck-param-eyepatch.md
Given a type `ty` of some value being dropped, computes a set
of "kinds" (types, regions) that must be outlive the execution
of the destructor. These basically correspond to data that the
destructor might access. This is used during regionck to
impose "outlives" constraints on any lifetimes referenced
within.

The rules here are given by the "dropck" RFCs, notably [#1238]
and [#1327]. This is a fixed-point computation, where we
explore all the data that will be dropped (transitively) when
a value of type `ty` is dropped. For each type T that will be
dropped and which has a destructor, we must assume that all
the types/regions of T are live during the destructor, unless
they are marked with a special attribute (`#[may_dangle]`).


Given a type ` ty ` of some value being dropped computes a set of " kinds " ( types regions ) that must be outlive the execution of the destructor . These basically correspond to data that the destructor might access . This is used during regionck to impose " outlives " constraints on any lifetimes referenced within . The rules here are given by the " dropck " RFCs notably [ #1238 ] and [ #1327 ] . This is a fixed - point computation where we explore all the data that will be dropped ( transitively ) when a value of type ` ty ` is dropped . For each type T that will be dropped and which has a destructor we must assume that all the types / regions of T are live during the destructor unless they are marked with a special attribute ( ` # [ may_dangle ] ` ) .
pub fn dropck_outlives(&self, ty: Ty<'tcx>) -> InferOk<'tcx, Vec<Kind<'tcx>>> {
        debug!(
            "dropck_outlives(ty={:?}, param_env={:?})",
            ty, self.param_env,
        );
        // Quick check: there are a number of cases that we know do not require
        // any destructor.
        let tcx = self.infcx.tcx;
        if trivial_dropck_outlives(tcx, ty) {
            return InferOk {
                value: vec![],
                obligations: vec![],
            };
        }
        let gcx = tcx.global_tcx();
        let mut orig_values = SmallVec::new();
        let c_ty = self.infcx.canonicalize_query(&self.param_env.and(ty), &mut orig_values);
        let span = self.cause.span;
        debug!("c_ty = {:?}", c_ty);
        match &gcx.dropck_outlives(c_ty) {
            Ok(result) if result.is_proven() => {
                match self.infcx.instantiate_query_result_and_region_obligations(
                    self.cause,
                    self.param_env,
                    &orig_values,
                    result,
                ) {
                    Ok(InferOk { value, obligations }) => {
                        let ty = self.infcx.resolve_type_vars_if_possible(&ty);
                        let kinds = value.into_kinds_reporting_overflows(tcx, span, ty);
                        return InferOk {
                            value: kinds,
                            obligations,
                        };
                    }
                    Err(_) => { /* fallthrough to error-handling code below */ }
                }
            }
            _ => { /* fallthrough to error-handling code below */ }
        }
        // Errors and ambiuity in dropck occur in two cases:
        // - unresolved inference variables at the end of typeck
        // - non well-formed types where projections cannot be resolved
        // Either of these should hvae created an error before.
        tcx.sess
            .delay_span_bug(span, "dtorck encountered internal error");
        return InferOk {
            value: vec![],
            obligations: vec![],
        };
    }
pub fn dropck_outlives ( & self , ty : Ty < ' tcx > ) -> InferOk < ' tcx , Vec < Kind < ' tcx > > > { debug ! ( " " ty self param_env ) ; // Quick check: there are a number of cases that we know do not require // any destructor. let tcx = self . infcx . tcx ; if trivial_dropck_outlives ( tcx , ty ) { return InferOk { value : vec ! [ ] , obligations : vec ! [ ] , } ; } let gcx = tcx . global_tcx ( ) ; let mut orig_values = SmallVec :: new ( ) ; let c_ty = self . infcx . canonicalize_query ( & self . param_env . and ( ty ) , & mut orig_values ) ; let span = self . cause . span ; debug ! ( " " c_ty ) ; match & gcx . dropck_outlives ( c_ty ) { Ok ( result ) if result . is_proven ( ) => { match self . infcx . instantiate_query_result_and_region_obligations ( self . cause , self . param_env , & orig_values , result , ) { Ok ( InferOk { value , obligations } ) => { let ty = self . infcx . resolve_type_vars_if_possible ( & ty ) ; let kinds = value . into_kinds_reporting_overflows ( tcx , span , ty ) ; return InferOk { value : kinds , obligations , } ; } Err ( _ ) => { /* fallthrough to error-handling code below */ } } } _ => { /* fallthrough to error-handling code below */ } } // Errors and ambiuity in dropck occur in two cases: // - unresolved inference variables at the end of typeck // - non well-formed types where projections cannot be resolved // Either of these should hvae created an error before. tcx . sess . delay_span_bug ( span , " " ) ; return InferOk { value : vec ! [ ] , obligations : vec ! [ ] , } ; }
Given a type `ty` of some value being dropped, computes a set
of "kinds" (types, regions) that must be outlive the execution
of the destructor.
Given a type ` ty ` of some value being dropped computes a set of " kinds " ( types regions ) that must be outlive the execution of the destructor .
&self
ty
Ty<'tcx>
&self
ty
Ty<'tcx>