Add CoroutineClosure to TyKind, AggregateKind, UpvarArgs
This commit is contained in:
parent
a20421734b
commit
c567eddec2
91 changed files with 579 additions and 101 deletions
|
@ -215,6 +215,7 @@ fn resolve_associated_item<'tcx>(
|
|||
ty::Coroutine(..)
|
||||
| ty::CoroutineWitness(..)
|
||||
| ty::Closure(..)
|
||||
| ty::CoroutineClosure(..)
|
||||
| ty::Tuple(..) => {}
|
||||
_ => return Ok(None),
|
||||
};
|
||||
|
|
|
@ -328,6 +328,17 @@ fn layout_of_uncached<'tcx>(
|
|||
)?
|
||||
}
|
||||
|
||||
ty::CoroutineClosure(_, args) => {
|
||||
let tys = args.as_coroutine_closure().upvar_tys();
|
||||
univariant(
|
||||
&tys.iter()
|
||||
.map(|ty| Ok(cx.layout_of(ty)?.layout))
|
||||
.try_collect::<IndexVec<_, _>>()?,
|
||||
&ReprOptions::default(),
|
||||
StructKind::AlwaysSized,
|
||||
)?
|
||||
}
|
||||
|
||||
ty::Tuple(tys) => {
|
||||
let kind =
|
||||
if tys.len() == 0 { StructKind::AlwaysSized } else { StructKind::MaybeUnsized };
|
||||
|
|
|
@ -172,6 +172,12 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
ty::CoroutineClosure(_, args) => {
|
||||
for upvar in args.as_coroutine_closure().upvar_tys() {
|
||||
queue_type(self, upvar);
|
||||
}
|
||||
}
|
||||
|
||||
// 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`.
|
||||
|
|
|
@ -18,7 +18,9 @@ fn sized_constraint_for_ty<'tcx>(
|
|||
|
||||
let result = match ty.kind() {
|
||||
Bool | Char | Int(..) | Uint(..) | Float(..) | RawPtr(..) | Ref(..) | FnDef(..)
|
||||
| FnPtr(_) | Array(..) | Closure(..) | Coroutine(..) | Never => vec![],
|
||||
| FnPtr(_) | Array(..) | Closure(..) | CoroutineClosure(..) | Coroutine(..) | Never => {
|
||||
vec![]
|
||||
}
|
||||
|
||||
Str | Dynamic(..) | Slice(_) | Foreign(..) | Error(_) | CoroutineWitness(..) => {
|
||||
// these are never sized - return the target type
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue