// let's recurse and find out
ty::TyStruct(def, substs) => {
for (j, field) in def.struct_variant().fields.iter().enumerate() {
- // TODO(#27532)
- let field_ty = field.ty(tcx, substs);
+ let field_ty = monomorphize::field_ty(tcx, substs, field);
if let Some(mut fpath) = find_discr_field_candidate(tcx, field_ty, path.clone()) {
fpath.push(j);
return Some(fpath);
use std::sync::Arc;
trait Trait { fn dummy(&self) { } }
+trait Mirror { type Image; }
+impl<T> Mirror for T { type Image = T; }
+struct ParamTypeStruct<T>(T);
+struct AssocTypeStruct<T>(<T as Mirror>::Image);
fn main() {
// Functions
// Should apply to types that have NonZero transitively
assert_eq!(size_of::<String>(), size_of::<Option<String>>());
+ // Should apply to types where the pointer is substituted
+ assert_eq!(size_of::<&u8>(), size_of::<Option<ParamTypeStruct<&u8>>>());
+ assert_eq!(size_of::<&u8>(), size_of::<Option<AssocTypeStruct<&u8>>>());
}