Skip to content

Commit a48bd17

Browse files
committed
prefer the (associated) const's type over the type hint
1 parent bba1596 commit a48bd17

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/librustc/middle/const_eval.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -854,16 +854,12 @@ pub fn eval_const_expr_partial<'tcx>(tcx: &TyCtxt<'tcx>,
854854
Some(actual_e) => actual_e,
855855
None => signal!(e, NonConstPath)
856856
};
857-
let item_hint = if let UncheckedExprNoHint = ty_hint {
858-
match const_ty {
859-
Some(ty) => match ast_ty_to_prim_ty(tcx, ty) {
860-
Some(ty) => UncheckedExprHint(ty),
861-
None => UncheckedExprNoHint
862-
},
863-
None => UncheckedExprNoHint
864-
}
865-
} else {
866-
ty_hint
857+
let item_hint = match const_ty {
858+
Some(ty) => match ast_ty_to_prim_ty(tcx, ty) {
859+
Some(ty) => ty_hint.checked_or(ty),
860+
None => ty_hint.erase_hint(),
861+
},
862+
None => ty_hint.erase_hint(),
867863
};
868864
try!(eval_const_expr_partial(tcx, const_expr, item_hint, fn_args))
869865
}

0 commit comments

Comments
 (0)