Skip to content

typestrong const integers #30587

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Mar 14, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
prefer the (associated) const's type over the type hint
  • Loading branch information
oli-obk committed Mar 10, 2016
commit a48bd1718356cdcc4204b57ed282ff8111df5427
16 changes: 6 additions & 10 deletions src/librustc/middle/const_eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down