prefer the (associated) const's type over the type hint
This commit is contained in:
parent
bba1596c71
commit
a48bd17183
1 changed files with 6 additions and 10 deletions
|
@ -854,16 +854,12 @@ pub fn eval_const_expr_partial<'tcx>(tcx: &TyCtxt<'tcx>,
|
||||||
Some(actual_e) => actual_e,
|
Some(actual_e) => actual_e,
|
||||||
None => signal!(e, NonConstPath)
|
None => signal!(e, NonConstPath)
|
||||||
};
|
};
|
||||||
let item_hint = if let UncheckedExprNoHint = ty_hint {
|
let item_hint = match const_ty {
|
||||||
match const_ty {
|
Some(ty) => match ast_ty_to_prim_ty(tcx, ty) {
|
||||||
Some(ty) => match ast_ty_to_prim_ty(tcx, ty) {
|
Some(ty) => ty_hint.checked_or(ty),
|
||||||
Some(ty) => UncheckedExprHint(ty),
|
None => ty_hint.erase_hint(),
|
||||||
None => UncheckedExprNoHint
|
},
|
||||||
},
|
None => ty_hint.erase_hint(),
|
||||||
None => UncheckedExprNoHint
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ty_hint
|
|
||||||
};
|
};
|
||||||
try!(eval_const_expr_partial(tcx, const_expr, item_hint, fn_args))
|
try!(eval_const_expr_partial(tcx, const_expr, item_hint, fn_args))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue