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>>
1041
1041
// must use an Option<fn(..) -> _> to represent it.
1042
1042
ty
1043
1043
}
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) ;
1044
1047
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
+ }
1045
1060
// We should only ever reach this case if ty_is_known_nonnull is extended
1046
1061
// to other types.
1047
1062
ref unhandled => {
You can’t perform that action at this time.
0 commit comments