2020-01-30 14:28:16 -06:00
|
|
|
//! Check whether a type has (potentially) non-trivial drop glue.
|
|
|
|
|
2020-03-29 10:19:48 -05:00
|
|
|
use rustc_data_structures::fx::FxHashSet;
|
|
|
|
use rustc_hir::def_id::DefId;
|
2021-09-21 04:06:19 -05:00
|
|
|
use rustc_middle::ty::subst::SubstsRef;
|
2020-03-29 09:41:09 -05:00
|
|
|
use rustc_middle::ty::util::{needs_drop_components, AlwaysRequiresDrop};
|
2022-05-08 00:17:58 -05:00
|
|
|
use rustc_middle::ty::{self, EarlyBinder, Ty, TyCtxt};
|
2020-05-26 13:48:08 -05:00
|
|
|
use rustc_session::Limit;
|
2021-04-13 02:43:11 -05:00
|
|
|
use rustc_span::{sym, DUMMY_SP};
|
2020-01-30 14:28:16 -06:00
|
|
|
|
2022-08-18 18:04:31 -05:00
|
|
|
use crate::errors::NeedsDropOverflow;
|
|
|
|
|
2020-01-30 14:28:16 -06:00
|
|
|
type NeedsDropResult<T> = Result<T, AlwaysRequiresDrop>;
|
|
|
|
|
2021-09-02 06:04:29 -05:00
|
|
|
fn needs_drop_raw<'tcx>(tcx: TyCtxt<'tcx>, query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool {
|
2020-02-09 04:16:57 -06:00
|
|
|
// If we don't know a type doesn't need drop, for example if it's a type
|
|
|
|
// parameter without a `Copy` bound, then we conservatively return that it
|
|
|
|
// needs drop.
|
2021-10-23 05:47:17 -05:00
|
|
|
let adt_has_dtor =
|
2022-03-04 14:28:41 -06:00
|
|
|
|adt_def: ty::AdtDef<'tcx>| adt_def.destructor(tcx).map(|_| DtorType::Significant);
|
2021-11-12 15:39:44 -06:00
|
|
|
let res =
|
|
|
|
drop_tys_helper(tcx, query.value, query.param_env, adt_has_dtor, false).next().is_some();
|
2021-09-01 06:06:15 -05:00
|
|
|
|
2020-01-30 14:28:16 -06:00
|
|
|
debug!("needs_drop_raw({:?}) = {:?}", query, res);
|
|
|
|
res
|
|
|
|
}
|
|
|
|
|
2021-04-13 02:43:11 -05:00
|
|
|
fn has_significant_drop_raw<'tcx>(
|
|
|
|
tcx: TyCtxt<'tcx>,
|
|
|
|
query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>,
|
|
|
|
) -> bool {
|
2021-11-12 15:39:44 -06:00
|
|
|
let res = drop_tys_helper(
|
|
|
|
tcx,
|
|
|
|
query.value,
|
|
|
|
query.param_env,
|
|
|
|
adt_consider_insignificant_dtor(tcx),
|
|
|
|
true,
|
|
|
|
)
|
|
|
|
.next()
|
|
|
|
.is_some();
|
2021-04-13 02:43:11 -05:00
|
|
|
debug!("has_significant_drop_raw({:?}) = {:?}", query, res);
|
|
|
|
res
|
|
|
|
}
|
|
|
|
|
2020-01-30 14:28:16 -06:00
|
|
|
struct NeedsDropTypes<'tcx, F> {
|
|
|
|
tcx: TyCtxt<'tcx>,
|
|
|
|
param_env: ty::ParamEnv<'tcx>,
|
|
|
|
query_ty: Ty<'tcx>,
|
|
|
|
seen_tys: FxHashSet<Ty<'tcx>>,
|
2020-02-09 04:16:57 -06:00
|
|
|
/// A stack of types left to process, and the recursion depth when we
|
|
|
|
/// pushed that type. Each round, we pop something from the stack and check
|
|
|
|
/// if it needs drop. If the result depends on whether some other types
|
|
|
|
/// need drop we push them onto the stack.
|
2020-01-30 14:28:16 -06:00
|
|
|
unchecked_tys: Vec<(Ty<'tcx>, usize)>,
|
2020-05-26 13:48:08 -05:00
|
|
|
recursion_limit: Limit,
|
2020-01-30 14:28:16 -06:00
|
|
|
adt_components: F,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'tcx, F> NeedsDropTypes<'tcx, F> {
|
|
|
|
fn new(
|
|
|
|
tcx: TyCtxt<'tcx>,
|
|
|
|
param_env: ty::ParamEnv<'tcx>,
|
|
|
|
ty: Ty<'tcx>,
|
|
|
|
adt_components: F,
|
|
|
|
) -> Self {
|
|
|
|
let mut seen_tys = FxHashSet::default();
|
|
|
|
seen_tys.insert(ty);
|
|
|
|
Self {
|
|
|
|
tcx,
|
|
|
|
param_env,
|
|
|
|
seen_tys,
|
|
|
|
query_ty: ty,
|
|
|
|
unchecked_tys: vec![(ty, 0)],
|
2021-07-04 13:02:51 -05:00
|
|
|
recursion_limit: tcx.recursion_limit(),
|
2020-01-30 14:28:16 -06:00
|
|
|
adt_components,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'tcx, F, I> Iterator for NeedsDropTypes<'tcx, F>
|
|
|
|
where
|
2022-03-04 14:28:41 -06:00
|
|
|
F: Fn(ty::AdtDef<'tcx>, SubstsRef<'tcx>) -> NeedsDropResult<I>,
|
2020-01-30 14:28:16 -06:00
|
|
|
I: Iterator<Item = Ty<'tcx>>,
|
|
|
|
{
|
|
|
|
type Item = NeedsDropResult<Ty<'tcx>>;
|
|
|
|
|
|
|
|
fn next(&mut self) -> Option<NeedsDropResult<Ty<'tcx>>> {
|
|
|
|
let tcx = self.tcx;
|
|
|
|
|
|
|
|
while let Some((ty, level)) = self.unchecked_tys.pop() {
|
2020-05-26 13:48:08 -05:00
|
|
|
if !self.recursion_limit.value_within_limit(level) {
|
2020-01-30 14:28:16 -06:00
|
|
|
// Not having a `Span` isn't great. But there's hopefully some other
|
|
|
|
// recursion limit error as well.
|
2022-08-18 18:04:31 -05:00
|
|
|
tcx.sess.emit_err(NeedsDropOverflow { query_ty: self.query_ty });
|
2020-01-30 14:28:16 -06:00
|
|
|
return Some(Err(AlwaysRequiresDrop));
|
|
|
|
}
|
|
|
|
|
2020-01-31 16:22:30 -06:00
|
|
|
let components = match needs_drop_components(ty, &tcx.data_layout) {
|
2020-01-30 14:28:16 -06:00
|
|
|
Err(e) => return Some(Err(e)),
|
|
|
|
Ok(components) => components,
|
|
|
|
};
|
|
|
|
debug!("needs_drop_components({:?}) = {:?}", ty, components);
|
|
|
|
|
2020-01-31 16:22:30 -06:00
|
|
|
let queue_type = move |this: &mut Self, component: Ty<'tcx>| {
|
|
|
|
if this.seen_tys.insert(component) {
|
|
|
|
this.unchecked_tys.push((component, level + 1));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-01-30 14:28:16 -06:00
|
|
|
for component in components {
|
2020-08-02 17:49:11 -05:00
|
|
|
match *component.kind() {
|
2022-09-11 10:22:38 -05:00
|
|
|
// The information required to determine whether a generator has drop is
|
2023-01-21 04:12:11 -06:00
|
|
|
// computed on MIR, while this very method is used to build MIR.
|
|
|
|
// To avoid cycles, we consider that generators always require drop.
|
2022-09-11 10:22:38 -05:00
|
|
|
ty::Generator(..) if tcx.sess.opts.unstable_opts.drop_tracking_mir => {
|
|
|
|
return Some(Err(AlwaysRequiresDrop));
|
|
|
|
}
|
|
|
|
|
2022-10-27 05:45:02 -05:00
|
|
|
_ if component.is_copy_modulo_regions(tcx, self.param_env) => (),
|
2020-01-30 14:28:16 -06:00
|
|
|
|
2020-03-12 20:23:38 -05:00
|
|
|
ty::Closure(_, substs) => {
|
2020-11-07 00:04:27 -06:00
|
|
|
queue_type(self, substs.as_closure().tupled_upvars_ty());
|
2020-01-30 14:28:16 -06:00
|
|
|
}
|
|
|
|
|
2020-05-29 20:04:15 -05:00
|
|
|
ty::Generator(def_id, substs, _) => {
|
2020-03-14 18:24:47 -05:00
|
|
|
let substs = substs.as_generator();
|
2020-11-07 00:04:27 -06:00
|
|
|
queue_type(self, substs.tupled_upvars_ty());
|
2020-03-14 18:24:47 -05:00
|
|
|
|
2020-03-14 20:28:48 -05:00
|
|
|
let witness = substs.witness();
|
2020-08-02 17:49:11 -05:00
|
|
|
let interior_tys = match witness.kind() {
|
2020-10-23 19:21:18 -05:00
|
|
|
&ty::GeneratorWitness(tys) => tcx.erase_late_bound_regions(tys),
|
2020-05-29 20:04:15 -05:00
|
|
|
_ => {
|
|
|
|
tcx.sess.delay_span_bug(
|
|
|
|
tcx.hir().span_if_local(def_id).unwrap_or(DUMMY_SP),
|
Restrict `From<S>` for `{D,Subd}iagnosticMessage`.
Currently a `{D,Subd}iagnosticMessage` can be created from any type that
impls `Into<String>`. That includes `&str`, `String`, and `Cow<'static,
str>`, which are reasonable. It also includes `&String`, which is pretty
weird, and results in many places making unnecessary allocations for
patterns like this:
```
self.fatal(&format!(...))
```
This creates a string with `format!`, takes a reference, passes the
reference to `fatal`, which does an `into()`, which clones the
reference, doing a second allocation. Two allocations for a single
string, bleh.
This commit changes the `From` impls so that you can only create a
`{D,Subd}iagnosticMessage` from `&str`, `String`, or `Cow<'static,
str>`. This requires changing all the places that currently create one
from a `&String`. Most of these are of the `&format!(...)` form
described above; each one removes an unnecessary static `&`, plus an
allocation when executed. There are also a few places where the existing
use of `&String` was more reasonable; these now just use `clone()` at
the call site.
As well as making the code nicer and more efficient, this is a step
towards possibly using `Cow<'static, str>` in
`{D,Subd}iagnosticMessage::{Str,Eager}`. That would require changing
the `From<&'a str>` impls to `From<&'static str>`, which is doable, but
I'm not yet sure if it's worthwhile.
2023-04-19 22:26:58 -05:00
|
|
|
format!("unexpected generator witness type {:?}", witness),
|
2020-05-29 20:04:15 -05:00
|
|
|
);
|
|
|
|
return Some(Err(AlwaysRequiresDrop));
|
|
|
|
}
|
2020-03-14 18:24:47 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
for interior_ty in interior_tys {
|
|
|
|
queue_type(self, interior_ty);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-30 14:28:16 -06:00
|
|
|
// Check for a `Drop` impl and whether this is a union or
|
|
|
|
// `ManuallyDrop`. If it's a struct or enum without a `Drop`
|
|
|
|
// impl then check whether the field types need `Drop`.
|
|
|
|
ty::Adt(adt_def, substs) => {
|
2021-09-21 04:06:19 -05:00
|
|
|
let tys = match (self.adt_components)(adt_def, substs) {
|
2020-01-30 14:28:16 -06:00
|
|
|
Err(e) => return Some(Err(e)),
|
|
|
|
Ok(tys) => tys,
|
|
|
|
};
|
|
|
|
for required_ty in tys {
|
2021-12-02 13:30:35 -06:00
|
|
|
let required = tcx
|
|
|
|
.try_normalize_erasing_regions(self.param_env, required_ty)
|
|
|
|
.unwrap_or(required_ty);
|
|
|
|
|
2021-11-12 15:39:44 -06:00
|
|
|
queue_type(self, required);
|
2020-01-30 14:28:16 -06:00
|
|
|
}
|
|
|
|
}
|
2022-11-27 11:52:17 -06:00
|
|
|
ty::Array(..) | ty::Alias(..) | ty::Param(_) => {
|
2020-01-30 14:28:16 -06:00
|
|
|
if ty == component {
|
2020-01-31 16:22:30 -06:00
|
|
|
// Return the type to the caller: they may be able
|
|
|
|
// to normalize further than we can.
|
2020-01-30 14:28:16 -06:00
|
|
|
return Some(Ok(component));
|
2020-01-31 16:22:30 -06:00
|
|
|
} else {
|
2020-01-30 14:28:16 -06:00
|
|
|
// Store the type for later. We can't return here
|
|
|
|
// because we would then lose any other components
|
|
|
|
// of the type.
|
2020-01-31 16:22:30 -06:00
|
|
|
queue_type(self, component);
|
2020-01-30 14:28:16 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
_ => return Some(Err(AlwaysRequiresDrop)),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-20 09:03:11 -05:00
|
|
|
None
|
2020-01-30 14:28:16 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-21 03:04:21 -05:00
|
|
|
enum DtorType {
|
|
|
|
/// Type has a `Drop` but it is considered insignificant.
|
|
|
|
/// Check the query `adt_significant_drop_tys` for understanding
|
|
|
|
/// "significant" / "insignificant".
|
|
|
|
Insignificant,
|
|
|
|
|
2022-03-16 07:12:30 -05:00
|
|
|
/// Type has a `Drop` implantation.
|
2021-09-21 03:04:21 -05:00
|
|
|
Significant,
|
|
|
|
}
|
|
|
|
|
2021-04-13 02:43:11 -05:00
|
|
|
// This is a helper function for `adt_drop_tys` and `adt_significant_drop_tys`.
|
2022-03-16 07:12:30 -05:00
|
|
|
// Depending on the implantation of `adt_has_dtor`, it is used to check if the
|
2021-04-13 02:43:11 -05:00
|
|
|
// ADT has a destructor or if the ADT only has a significant destructor. For
|
|
|
|
// understanding significant destructor look at `adt_significant_drop_tys`.
|
2021-10-23 05:47:17 -05:00
|
|
|
fn drop_tys_helper<'tcx>(
|
2021-09-21 04:06:19 -05:00
|
|
|
tcx: TyCtxt<'tcx>,
|
2021-10-23 05:47:17 -05:00
|
|
|
ty: Ty<'tcx>,
|
|
|
|
param_env: rustc_middle::ty::ParamEnv<'tcx>,
|
2022-03-04 14:28:41 -06:00
|
|
|
adt_has_dtor: impl Fn(ty::AdtDef<'tcx>) -> Option<DtorType>,
|
2021-11-12 15:39:44 -06:00
|
|
|
only_significant: bool,
|
2021-10-23 05:47:17 -05:00
|
|
|
) -> impl Iterator<Item = NeedsDropResult<Ty<'tcx>>> {
|
2021-11-12 15:39:44 -06:00
|
|
|
fn with_query_cache<'tcx>(
|
|
|
|
tcx: TyCtxt<'tcx>,
|
|
|
|
iter: impl IntoIterator<Item = Ty<'tcx>>,
|
|
|
|
) -> NeedsDropResult<Vec<Ty<'tcx>>> {
|
|
|
|
iter.into_iter().try_fold(Vec::new(), |mut vec, subty| {
|
|
|
|
match subty.kind() {
|
|
|
|
ty::Adt(adt_id, subst) => {
|
2022-03-04 14:28:41 -06:00
|
|
|
for subty in tcx.adt_drop_tys(adt_id.did())? {
|
2022-05-08 00:17:58 -05:00
|
|
|
vec.push(EarlyBinder(subty).subst(tcx, subst));
|
2021-11-12 15:39:44 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
_ => vec.push(subty),
|
|
|
|
};
|
|
|
|
Ok(vec)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2022-03-04 14:28:41 -06:00
|
|
|
let adt_components = move |adt_def: ty::AdtDef<'tcx>, substs: SubstsRef<'tcx>| {
|
2020-01-30 14:28:16 -06:00
|
|
|
if adt_def.is_manually_drop() {
|
2021-10-25 19:45:46 -05:00
|
|
|
debug!("drop_tys_helper: `{:?}` is manually drop", adt_def);
|
2021-11-12 15:39:44 -06:00
|
|
|
Ok(Vec::new())
|
2021-09-21 03:04:21 -05:00
|
|
|
} else if let Some(dtor_info) = adt_has_dtor(adt_def) {
|
|
|
|
match dtor_info {
|
|
|
|
DtorType::Significant => {
|
2021-10-25 19:45:46 -05:00
|
|
|
debug!("drop_tys_helper: `{:?}` implements `Drop`", adt_def);
|
2021-11-12 15:39:44 -06:00
|
|
|
Err(AlwaysRequiresDrop)
|
2021-09-21 03:04:21 -05:00
|
|
|
}
|
|
|
|
DtorType::Insignificant => {
|
2021-10-25 19:45:46 -05:00
|
|
|
debug!("drop_tys_helper: `{:?}` drop is insignificant", adt_def);
|
2021-09-21 04:06:19 -05:00
|
|
|
|
|
|
|
// Since the destructor is insignificant, we just want to make sure all of
|
|
|
|
// the passed in type parameters are also insignificant.
|
|
|
|
// Eg: Vec<T> dtor is insignificant when T=i32 but significant when T=Mutex.
|
2022-01-28 20:24:54 -06:00
|
|
|
Ok(substs.types().collect())
|
2021-09-21 03:04:21 -05:00
|
|
|
}
|
|
|
|
}
|
2020-01-30 14:28:16 -06:00
|
|
|
} else if adt_def.is_union() {
|
2021-10-25 19:45:46 -05:00
|
|
|
debug!("drop_tys_helper: `{:?}` is a union", adt_def);
|
2021-11-12 15:39:44 -06:00
|
|
|
Ok(Vec::new())
|
|
|
|
} else {
|
2022-01-28 20:24:54 -06:00
|
|
|
let field_tys = adt_def.all_fields().map(|field| {
|
2023-02-07 02:29:48 -06:00
|
|
|
let r = tcx.type_of(field.did).subst(tcx, substs);
|
2023-04-09 16:35:02 -05:00
|
|
|
debug!("drop_tys_helper: Subst into {:?} with {:?} getting {:?}", field, substs, r);
|
2022-01-28 20:24:54 -06:00
|
|
|
r
|
|
|
|
});
|
|
|
|
if only_significant {
|
|
|
|
// We can't recurse through the query system here because we might induce a cycle
|
|
|
|
Ok(field_tys.collect())
|
|
|
|
} else {
|
|
|
|
// We can use the query system if we consider all drops significant. In that case,
|
|
|
|
// ADTs are `needs_drop` exactly if they `impl Drop` or if any of their "transitive"
|
|
|
|
// fields do. There can be no cycles here, because ADTs cannot contain themselves as
|
|
|
|
// fields.
|
|
|
|
with_query_cache(tcx, field_tys)
|
|
|
|
}
|
2020-01-30 14:28:16 -06:00
|
|
|
}
|
2021-11-12 15:39:44 -06:00
|
|
|
.map(|v| v.into_iter())
|
2020-01-30 14:28:16 -06:00
|
|
|
};
|
|
|
|
|
2021-10-23 05:47:17 -05:00
|
|
|
NeedsDropTypes::new(tcx, param_env, ty, adt_components)
|
2020-01-30 14:28:16 -06:00
|
|
|
}
|
|
|
|
|
2021-10-23 05:47:17 -05:00
|
|
|
fn adt_consider_insignificant_dtor<'tcx>(
|
|
|
|
tcx: TyCtxt<'tcx>,
|
2022-03-04 14:28:41 -06:00
|
|
|
) -> impl Fn(ty::AdtDef<'tcx>) -> Option<DtorType> + 'tcx {
|
|
|
|
move |adt_def: ty::AdtDef<'tcx>| {
|
|
|
|
let is_marked_insig = tcx.has_attr(adt_def.did(), sym::rustc_insignificant_dtor);
|
2021-09-22 04:17:30 -05:00
|
|
|
if is_marked_insig {
|
|
|
|
// In some cases like `std::collections::HashMap` where the struct is a wrapper around
|
|
|
|
// a type that is a Drop type, and the wrapped type (eg: `hashbrown::HashMap`) lies
|
2022-10-13 11:25:34 -05:00
|
|
|
// outside stdlib, we might choose to still annotate the wrapper (std HashMap) with
|
2021-09-22 04:17:30 -05:00
|
|
|
// `rustc_insignificant_dtor`, even if the type itself doesn't have a `Drop` impl.
|
|
|
|
Some(DtorType::Insignificant)
|
|
|
|
} else if adt_def.destructor(tcx).is_some() {
|
|
|
|
// There is a Drop impl and the type isn't marked insignificant, therefore Drop must be
|
|
|
|
// significant.
|
|
|
|
Some(DtorType::Significant)
|
|
|
|
} else {
|
|
|
|
// No destructor found nor the type is annotated with `rustc_insignificant_dtor`, we
|
|
|
|
// treat this as the simple case of Drop impl for type.
|
|
|
|
None
|
|
|
|
}
|
2021-10-23 05:47:17 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-04 14:28:41 -06:00
|
|
|
fn adt_drop_tys<'tcx>(
|
|
|
|
tcx: TyCtxt<'tcx>,
|
|
|
|
def_id: DefId,
|
|
|
|
) -> Result<&ty::List<Ty<'tcx>>, AlwaysRequiresDrop> {
|
2021-10-23 05:47:17 -05:00
|
|
|
// This is for the "adt_drop_tys" query, that considers all `Drop` impls, therefore all dtors are
|
|
|
|
// significant.
|
|
|
|
let adt_has_dtor =
|
2022-03-04 14:28:41 -06:00
|
|
|
|adt_def: ty::AdtDef<'tcx>| adt_def.destructor(tcx).map(|_| DtorType::Significant);
|
2021-11-12 15:39:44 -06:00
|
|
|
// `tcx.type_of(def_id)` identical to `tcx.make_adt(def, identity_substs)`
|
2023-02-06 18:48:12 -06:00
|
|
|
drop_tys_helper(
|
|
|
|
tcx,
|
2023-02-07 02:29:48 -06:00
|
|
|
tcx.type_of(def_id).subst_identity(),
|
2023-02-06 18:48:12 -06:00
|
|
|
tcx.param_env(def_id),
|
|
|
|
adt_has_dtor,
|
|
|
|
false,
|
|
|
|
)
|
|
|
|
.collect::<Result<Vec<_>, _>>()
|
2023-02-16 21:33:08 -06:00
|
|
|
.map(|components| tcx.mk_type_list(&components))
|
2021-10-23 05:47:17 -05:00
|
|
|
}
|
2021-11-12 15:39:44 -06:00
|
|
|
// If `def_id` refers to a generic ADT, the queries above and below act as if they had been handed
|
2022-03-16 07:12:30 -05:00
|
|
|
// a `tcx.make_ty(def, identity_substs)` and as such it is legal to substitute the generic parameters
|
2021-11-12 15:39:44 -06:00
|
|
|
// of the ADT into the outputted `ty`s.
|
2021-10-23 05:47:17 -05:00
|
|
|
fn adt_significant_drop_tys(
|
|
|
|
tcx: TyCtxt<'_>,
|
|
|
|
def_id: DefId,
|
|
|
|
) -> Result<&ty::List<Ty<'_>>, AlwaysRequiresDrop> {
|
|
|
|
drop_tys_helper(
|
|
|
|
tcx,
|
2023-02-07 02:29:48 -06:00
|
|
|
tcx.type_of(def_id).subst_identity(), // identical to `tcx.make_adt(def, identity_substs)`
|
2021-10-23 05:47:17 -05:00
|
|
|
tcx.param_env(def_id),
|
|
|
|
adt_consider_insignificant_dtor(tcx),
|
2021-11-12 15:39:44 -06:00
|
|
|
true,
|
2021-10-23 05:47:17 -05:00
|
|
|
)
|
|
|
|
.collect::<Result<Vec<_>, _>>()
|
2023-02-16 21:33:08 -06:00
|
|
|
.map(|components| tcx.mk_type_list(&components))
|
2021-04-13 02:43:11 -05:00
|
|
|
}
|
|
|
|
|
2020-07-05 15:00:14 -05:00
|
|
|
pub(crate) fn provide(providers: &mut ty::query::Providers) {
|
2021-04-13 02:43:11 -05:00
|
|
|
*providers = ty::query::Providers {
|
2021-09-02 06:04:29 -05:00
|
|
|
needs_drop_raw,
|
2021-04-13 02:43:11 -05:00
|
|
|
has_significant_drop_raw,
|
|
|
|
adt_drop_tys,
|
|
|
|
adt_significant_drop_tys,
|
|
|
|
..*providers
|
|
|
|
};
|
2020-01-30 14:28:16 -06:00
|
|
|
}
|