diff options
| author | Oliver Schneider <git-spam-no-reply9815368754983@oli-obk.de> | 2016-03-03 14:46:20 +0100 |
|---|---|---|
| committer | Oliver Schneider <git-spam-no-reply9815368754983@oli-obk.de> | 2016-03-10 12:50:13 +0100 |
| commit | a48bd1718356cdcc4204b57ed282ff8111df5427 (patch) | |
| tree | 994bbf3797b9234351713ca453cb5471dfb6caec | |
| parent | bba1596c71989bdbad19ec06b27fa0d81d5bc58f (diff) | |
| download | rust-a48bd1718356cdcc4204b57ed282ff8111df5427.tar.gz rust-a48bd1718356cdcc4204b57ed282ff8111df5427.zip | |
prefer the (associated) const's type over the type hint
| -rw-r--r-- | src/librustc/middle/const_eval.rs | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/librustc/middle/const_eval.rs b/src/librustc/middle/const_eval.rs index f56c42738e7..c02782b859c 100644 --- a/src/librustc/middle/const_eval.rs +++ b/src/librustc/middle/const_eval.rs @@ -854,16 +854,12 @@ pub fn eval_const_expr_partial<'tcx>(tcx: &TyCtxt<'tcx>, Some(actual_e) => actual_e, None => signal!(e, NonConstPath) }; - let item_hint = if let UncheckedExprNoHint = ty_hint { - match const_ty { - Some(ty) => match ast_ty_to_prim_ty(tcx, ty) { - Some(ty) => UncheckedExprHint(ty), - None => UncheckedExprNoHint - }, - None => UncheckedExprNoHint - } - } else { - ty_hint + let item_hint = match const_ty { + Some(ty) => match ast_ty_to_prim_ty(tcx, ty) { + Some(ty) => ty_hint.checked_or(ty), + None => ty_hint.erase_hint(), + }, + None => ty_hint.erase_hint(), }; try!(eval_const_expr_partial(tcx, const_expr, item_hint, fn_args)) } |
