Skip to content

Commit

Permalink
rustc_const_eval: CallOn isn't needed, typeck/const-qualif handle tho…
Browse files Browse the repository at this point in the history
…se cases.
  • Loading branch information
eddyb committed Apr 23, 2017
1 parent e22873d commit 0ff828b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 0 additions & 2 deletions src/librustc/middle/const_val.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ pub enum ErrKind<'tcx> {
MissingStructField,
NegateOn(ConstVal<'tcx>),
NotOn(ConstVal<'tcx>),
CallOn(ConstVal<'tcx>),

NonConstPath,
UnimplementedConstVal(&'static str),
Expand Down Expand Up @@ -145,7 +144,6 @@ impl<'a, 'gcx, 'tcx> ConstEvalErr<'tcx> {
CannotCast => simple!("can't cast this type"),
NegateOn(ref const_val) => simple!("negate on {}", const_val.description()),
NotOn(ref const_val) => simple!("not on {}", const_val.description()),
CallOn(ref const_val) => simple!("call on {}", const_val.description()),

MissingStructField => simple!("nonexistent struct field"),
NonConstPath => simple!("non-constant path in constant expression"),
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_const_eval/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ fn eval_const_expr_partial<'a, 'tcx>(cx: &ConstContext<'a, 'tcx>,
hir::ExprCall(ref callee, ref args) => {
let (def_id, substs) = match cx.eval(callee)? {
Function(def_id, substs) => (def_id, substs),
callee => signal!(e, CallOn(callee)),
_ => signal!(e, TypeckError),
};

let body = if let Some(node_id) = tcx.hir.as_local_node_id(def_id) {
Expand Down

0 comments on commit 0ff828b

Please sign in to comment.