File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -1041,7 +1041,22 @@ fn get_nullable_type<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Option<Ty<'tcx>>
10411041 // must use an Option<fn(..) -> _> to represent it.
10421042 ty
10431043 }
1044+ ty:: Alias ( ty:: Projection , alias_ty) => {
1045+ let ty:: AliasTy { def_id, .. } = alias_ty;
1046+ debug ! ( "get_nullable_type: alias def_id: {:?}" , def_id) ;
10441047
1048+ let assoc_item = tcx. associated_item ( def_id) ;
1049+ debug ! ( "get_nullable_type: alias associated_item: {:?}" , assoc_item) ;
1050+
1051+ // FIXME: Call `get_nullable_type` with the resolved `alias_ty`.
1052+ if assoc_item. name . as_str ( ) == "NonZeroInner" {
1053+ // `<T as ZeroablePrimitive>::NonZeroInner`'s inner value is the same as `T`.
1054+ return Some ( args. type_at ( 0 ) ) ;
1055+ }
1056+
1057+ debug ! ( "get_nullable_type: unhandled alias: {:?} while checking {:?}" , alias_ty, ty) ;
1058+ return None ;
1059+ }
10451060 // We should only ever reach this case if ty_is_known_nonnull is extended
10461061 // to other types.
10471062 ref unhandled => {
You can’t perform that action at this time.
0 commit comments