librustc: Try looking in fixed sized arrays for nullable enum opt.
This commit is contained in:
parent
e6b6234e66
commit
5fb1e6b1e2
@ -390,6 +390,19 @@ fn find_discr_field_candidate<'tcx>(tcx: &ty::ctxt<'tcx>, ty: Ty<'tcx>) -> Optio
|
|||||||
None
|
None
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Is this a fixed-size array of something non-zero
|
||||||
|
// with at least one element?
|
||||||
|
ty::ty_vec(ety, Some(d)) if d > 0 => {
|
||||||
|
match find_discr_field_candidate(tcx, ety) {
|
||||||
|
Some(v) => {
|
||||||
|
let mut discrfield = vec![0];
|
||||||
|
discrfield.extend(v.into_iter());
|
||||||
|
return Some(discrfield);
|
||||||
|
}
|
||||||
|
None => None
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// Anything else is not a pointer
|
// Anything else is not a pointer
|
||||||
_ => None
|
_ => None
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user