@@ -3869,13 +3869,18 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
3869
3869
check_expr_with_expectation_and_lvalue_pref (
3870
3870
fcx, & * * oprnd, expected_inner, lvalue_pref) ;
3871
3871
let mut oprnd_t = fcx. expr_ty ( & * * oprnd) ;
3872
- if !ty:: type_is_error ( oprnd_t) && !ty:: type_is_bot ( oprnd_t) {
3872
+
3873
+ if !ty:: type_is_error ( oprnd_t) {
3873
3874
match unop {
3874
3875
ast:: UnBox => {
3875
- oprnd_t = ty:: mk_box ( tcx, oprnd_t)
3876
+ if !ty:: type_is_bot ( oprnd_t) {
3877
+ oprnd_t = ty:: mk_box ( tcx, oprnd_t)
3878
+ }
3876
3879
}
3877
3880
ast:: UnUniq => {
3878
- oprnd_t = ty:: mk_uniq ( tcx, oprnd_t) ;
3881
+ if !ty:: type_is_bot ( oprnd_t) {
3882
+ oprnd_t = ty:: mk_uniq ( tcx, oprnd_t) ;
3883
+ }
3879
3884
}
3880
3885
ast:: UnDeref => {
3881
3886
oprnd_t = structurally_resolved_type ( fcx, expr. span , oprnd_t) ;
@@ -3912,23 +3917,27 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
3912
3917
} ;
3913
3918
}
3914
3919
ast:: UnNot => {
3915
- oprnd_t = structurally_resolved_type ( fcx, oprnd. span ,
3916
- oprnd_t) ;
3917
- if !( ty:: type_is_integral ( oprnd_t) ||
3918
- ty:: get ( oprnd_t) . sty == ty:: ty_bool) {
3919
- oprnd_t = check_user_unop ( fcx, "!" , "not" ,
3920
- tcx. lang_items . not_trait ( ) ,
3921
- expr, & * * oprnd, oprnd_t) ;
3920
+ if !ty:: type_is_bot ( oprnd_t) {
3921
+ oprnd_t = structurally_resolved_type ( fcx, oprnd. span ,
3922
+ oprnd_t) ;
3923
+ if !( ty:: type_is_integral ( oprnd_t) ||
3924
+ ty:: get ( oprnd_t) . sty == ty:: ty_bool) {
3925
+ oprnd_t = check_user_unop ( fcx, "!" , "not" ,
3926
+ tcx. lang_items . not_trait ( ) ,
3927
+ expr, & * * oprnd, oprnd_t) ;
3928
+ }
3922
3929
}
3923
3930
}
3924
3931
ast:: UnNeg => {
3925
- oprnd_t = structurally_resolved_type ( fcx, oprnd. span ,
3926
- oprnd_t) ;
3927
- if !( ty:: type_is_integral ( oprnd_t) ||
3928
- ty:: type_is_fp ( oprnd_t) ) {
3929
- oprnd_t = check_user_unop ( fcx, "-" , "neg" ,
3930
- tcx. lang_items . neg_trait ( ) ,
3931
- expr, & * * oprnd, oprnd_t) ;
3932
+ if !ty:: type_is_bot ( oprnd_t) {
3933
+ oprnd_t = structurally_resolved_type ( fcx, oprnd. span ,
3934
+ oprnd_t) ;
3935
+ if !( ty:: type_is_integral ( oprnd_t) ||
3936
+ ty:: type_is_fp ( oprnd_t) ) {
3937
+ oprnd_t = check_user_unop ( fcx, "-" , "neg" ,
3938
+ tcx. lang_items . neg_trait ( ) ,
3939
+ expr, & * * oprnd, oprnd_t) ;
3940
+ }
3932
3941
}
3933
3942
}
3934
3943
}
0 commit comments