use syntax::ast;
use syntax::symbol::Symbol;
-#[derive(Debug, Clone, PartialEq, Eq)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum ErrorHandled {
/// Already reported a lint or an error for this evaluation
Reported,
}
// already reported in the query
- ConstEvalFailure => {
+ ConstEvalFailure(_) => {
self.tcx.sess.delay_span_bug(span, "constant in type had an ignored error");
return;
}
// except according to those terms.
use infer::InferCtxt;
-use mir::interpret::GlobalId;
+use mir::interpret::{GlobalId, ErrorHandled};
use ty::{self, Ty, TypeFoldable, ToPolyTraitRef, ToPredicate};
use ty::error::ExpectedFound;
use rustc_data_structures::obligation_forest::{Error, ForestObligation, ObligationForest};
match self.selcx.tcx().at(obligation.cause.span)
.const_eval(param_env.and(cid)) {
Ok(_) => ProcessResult::Changed(vec![]),
- Err(_) => ProcessResult::Error(
- CodeSelectionError(ConstEvalFailure))
+ Err(err) => ProcessResult::Error(
+ CodeSelectionError(ConstEvalFailure(err)))
}
} else {
- ProcessResult::Error(CodeSelectionError(ConstEvalFailure))
+ ProcessResult::Error(CodeSelectionError(
+ ConstEvalFailure(ErrorHandled::TooGeneric)
+ ))
}
},
None => {
use infer::SuppressRegionErrors;
use infer::outlives::env::OutlivesEnvironment;
use middle::region;
+use mir::interpret::ErrorHandled;
use ty::subst::Substs;
use ty::{self, AdtKind, List, Ty, TyCtxt, GenericParamDefKind, ToPredicate};
use ty::error::{ExpectedFound, TypeError};
ty::PolyTraitRef<'tcx>,
ty::error::TypeError<'tcx>),
TraitNotObjectSafe(DefId),
- ConstEvalFailure,
+ ConstEvalFailure(ErrorHandled),
Overflow,
}
)
}
super::TraitNotObjectSafe(def_id) => Some(super::TraitNotObjectSafe(def_id)),
- super::ConstEvalFailure(ref err) => Some(super::ConstEvalFailure),
+ super::ConstEvalFailure(err) => Some(super::ConstEvalFailure(err)),
super::Overflow => Some(super::Overflow),
}
}