rollup merge of #23091: japaric/phantom

r? @nikomatsakis See the cfail test, it compiles without this patch
cc #13231
This commit is contained in:
Alex Crichton 2015-03-06 15:37:51 -08:00
commit 31af63748b
2 changed files with 48 additions and 0 deletions

View file

@ -1692,6 +1692,13 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
}
}
// for `PhantomData<T>`, we pass `T`
ty::ty_struct(def_id, substs)
if Some(def_id) == self.tcx().lang_items.phantom_data() =>
{
Some(substs.types.get_slice(TypeSpace).to_vec())
}
ty::ty_struct(def_id, substs) => {
Some(ty::struct_fields(self.tcx(), def_id, substs).iter()
.map(|f| f.mt.ty)