File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -1223,7 +1223,23 @@ fn check_expr(&fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
1223
1223
case ( ast. expr_unary ( ?unop, ?oper, _) ) {
1224
1224
auto oper_1 = check_expr ( fcx, oper) ;
1225
1225
auto oper_t = expr_ty ( oper_1) ;
1226
- // FIXME: Unops have a bit more subtlety than this.
1226
+ alt ( unop) {
1227
+ case ( ast. box ) { oper_t = plain_ty ( ty_box ( oper_t) ) ; }
1228
+ case ( ast. deref ) {
1229
+ alt ( oper_t. struct ) {
1230
+ case ( ty_box ( ?inner_t) ) {
1231
+ oper_t = inner_t;
1232
+ }
1233
+ case ( _) {
1234
+ fcx. ccx . sess . span_err
1235
+ ( expr. span ,
1236
+ "dereferencing non-box type: "
1237
+ + ty_to_str ( oper_t) ) ;
1238
+ }
1239
+ }
1240
+ }
1241
+ case ( _) { /* fall through */ }
1242
+ }
1227
1243
ret @fold. respan [ ast. expr_ ] ( expr. span ,
1228
1244
ast. expr_unary ( unop, oper_1,
1229
1245
ast. ann_type ( oper_t) ) ) ;
You can’t perform that action at this time.
0 commit comments