Auto merge of #118685 - compiler-errors:stack-dependent, r=lcnr
`EvaluatedToUnknown` -> `EvaluatedToAmbigStackDependent`, `EvaluatedToRecur` -> `EvaluatedToErrStackDependent` Less confusing names, since the only difference between them and their parallel `EvalutedTo..` is that they are stack dependent. r? lcnr
This commit is contained in:
commit
f90f898fa5
@ -180,8 +180,8 @@ pub enum SelectionCandidate<'tcx> {
|
|||||||
///
|
///
|
||||||
/// The evaluation results are ordered:
|
/// The evaluation results are ordered:
|
||||||
/// - `EvaluatedToOk` implies `EvaluatedToOkModuloRegions`
|
/// - `EvaluatedToOk` implies `EvaluatedToOkModuloRegions`
|
||||||
/// implies `EvaluatedToAmbig` implies `EvaluatedToUnknown`
|
/// implies `EvaluatedToAmbig` implies `EvaluatedToAmbigStackDependent`
|
||||||
/// - `EvaluatedToErr` implies `EvaluatedToRecur`
|
/// - `EvaluatedToErr` implies `EvaluatedToErrStackDependent`
|
||||||
/// - the "union" of evaluation results is equal to their maximum -
|
/// - the "union" of evaluation results is equal to their maximum -
|
||||||
/// all the "potential success" candidates can potentially succeed,
|
/// all the "potential success" candidates can potentially succeed,
|
||||||
/// so they are noops when unioned with a definite error, and within
|
/// so they are noops when unioned with a definite error, and within
|
||||||
@ -199,7 +199,7 @@ pub enum EvaluationResult {
|
|||||||
/// Evaluation is known to be ambiguous -- it *might* hold for some
|
/// Evaluation is known to be ambiguous -- it *might* hold for some
|
||||||
/// assignment of inference variables, but it might not.
|
/// assignment of inference variables, but it might not.
|
||||||
///
|
///
|
||||||
/// While this has the same meaning as `EvaluatedToUnknown` -- we can't
|
/// While this has the same meaning as `EvaluatedToAmbigStackDependent` -- we can't
|
||||||
/// know whether this obligation holds or not -- it is the result we
|
/// know whether this obligation holds or not -- it is the result we
|
||||||
/// would get with an empty stack, and therefore is cacheable.
|
/// would get with an empty stack, and therefore is cacheable.
|
||||||
EvaluatedToAmbig,
|
EvaluatedToAmbig,
|
||||||
@ -207,8 +207,8 @@ pub enum EvaluationResult {
|
|||||||
/// variables. We are somewhat imprecise there, so we don't actually
|
/// variables. We are somewhat imprecise there, so we don't actually
|
||||||
/// know the real result.
|
/// know the real result.
|
||||||
///
|
///
|
||||||
/// This can't be trivially cached for the same reason as `EvaluatedToRecur`.
|
/// This can't be trivially cached for the same reason as `EvaluatedToErrStackDependent`.
|
||||||
EvaluatedToUnknown,
|
EvaluatedToAmbigStackDependent,
|
||||||
/// Evaluation failed because we encountered an obligation we are already
|
/// Evaluation failed because we encountered an obligation we are already
|
||||||
/// trying to prove on this branch.
|
/// trying to prove on this branch.
|
||||||
///
|
///
|
||||||
@ -247,12 +247,12 @@ pub enum EvaluationResult {
|
|||||||
/// does not hold, because of the bound (which can indeed be satisfied
|
/// does not hold, because of the bound (which can indeed be satisfied
|
||||||
/// by `SomeUnsizedType` from another crate).
|
/// by `SomeUnsizedType` from another crate).
|
||||||
//
|
//
|
||||||
// FIXME: when an `EvaluatedToRecur` goes past its parent root, we
|
// FIXME: when an `EvaluatedToErrStackDependent` goes past its parent root, we
|
||||||
// ought to convert it to an `EvaluatedToErr`, because we know
|
// ought to convert it to an `EvaluatedToErr`, because we know
|
||||||
// there definitely isn't a proof tree for that obligation. Not
|
// there definitely isn't a proof tree for that obligation. Not
|
||||||
// doing so is still sound -- there isn't any proof tree, so the
|
// doing so is still sound -- there isn't any proof tree, so the
|
||||||
// branch still can't be a part of a minimal one -- but does not re-enable caching.
|
// branch still can't be a part of a minimal one -- but does not re-enable caching.
|
||||||
EvaluatedToRecur,
|
EvaluatedToErrStackDependent,
|
||||||
/// Evaluation failed.
|
/// Evaluation failed.
|
||||||
EvaluatedToErr,
|
EvaluatedToErr,
|
||||||
}
|
}
|
||||||
@ -276,15 +276,15 @@ impl EvaluationResult {
|
|||||||
| EvaluatedToOk
|
| EvaluatedToOk
|
||||||
| EvaluatedToOkModuloRegions
|
| EvaluatedToOkModuloRegions
|
||||||
| EvaluatedToAmbig
|
| EvaluatedToAmbig
|
||||||
| EvaluatedToUnknown => true,
|
| EvaluatedToAmbigStackDependent => true,
|
||||||
|
|
||||||
EvaluatedToErr | EvaluatedToRecur => false,
|
EvaluatedToErr | EvaluatedToErrStackDependent => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_stack_dependent(self) -> bool {
|
pub fn is_stack_dependent(self) -> bool {
|
||||||
match self {
|
match self {
|
||||||
EvaluatedToUnknown | EvaluatedToRecur => true,
|
EvaluatedToAmbigStackDependent | EvaluatedToErrStackDependent => true,
|
||||||
|
|
||||||
EvaluatedToOkModuloOpaqueTypes
|
EvaluatedToOkModuloOpaqueTypes
|
||||||
| EvaluatedToOk
|
| EvaluatedToOk
|
||||||
|
@ -29,7 +29,7 @@ pub trait InferCtxtExt<'tcx> {
|
|||||||
/// - the parameter environment
|
/// - the parameter environment
|
||||||
///
|
///
|
||||||
/// Invokes `evaluate_obligation`, so in the event that evaluating
|
/// Invokes `evaluate_obligation`, so in the event that evaluating
|
||||||
/// `Ty: Trait` causes overflow, EvaluatedToRecur (or EvaluatedToUnknown)
|
/// `Ty: Trait` causes overflow, EvaluatedToErrStackDependent (or EvaluatedToAmbigStackDependent)
|
||||||
/// will be returned.
|
/// will be returned.
|
||||||
fn type_implements_trait(
|
fn type_implements_trait(
|
||||||
&self,
|
&self,
|
||||||
|
@ -222,8 +222,8 @@ pub enum TreatInductiveCycleAs {
|
|||||||
impl From<TreatInductiveCycleAs> for EvaluationResult {
|
impl From<TreatInductiveCycleAs> for EvaluationResult {
|
||||||
fn from(treat: TreatInductiveCycleAs) -> EvaluationResult {
|
fn from(treat: TreatInductiveCycleAs) -> EvaluationResult {
|
||||||
match treat {
|
match treat {
|
||||||
TreatInductiveCycleAs::Ambig => EvaluatedToUnknown,
|
TreatInductiveCycleAs::Ambig => EvaluatedToAmbigStackDependent,
|
||||||
TreatInductiveCycleAs::Recur => EvaluatedToRecur,
|
TreatInductiveCycleAs::Recur => EvaluatedToErrStackDependent,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1231,7 +1231,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||||||
})
|
})
|
||||||
{
|
{
|
||||||
debug!("evaluate_stack --> unbound argument, recursive --> giving up",);
|
debug!("evaluate_stack --> unbound argument, recursive --> giving up",);
|
||||||
return Ok(EvaluatedToUnknown);
|
return Ok(EvaluatedToAmbigStackDependent);
|
||||||
}
|
}
|
||||||
|
|
||||||
match self.candidate_from_obligation(stack) {
|
match self.candidate_from_obligation(stack) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user