@@ -3869,13 +3869,18 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
38693869 check_expr_with_expectation_and_lvalue_pref (
38703870 fcx, & * * oprnd, expected_inner, lvalue_pref) ;
38713871 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) {
38733874 match unop {
38743875 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+ }
38763879 }
38773880 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+ }
38793884 }
38803885 ast:: UnDeref => {
38813886 oprnd_t = structurally_resolved_type ( fcx, expr. span , oprnd_t) ;
@@ -3912,23 +3917,27 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
39123917 } ;
39133918 }
39143919 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+ }
39223929 }
39233930 }
39243931 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+ }
39323941 }
39333942 }
39343943 }
0 commit comments