Skip to content

Commit f90f898

Browse files
committed
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
2 parents 568f6a8 + d732c3b commit f90f898

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

compiler/rustc_middle/src/traits/select.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ pub enum SelectionCandidate<'tcx> {
180180
///
181181
/// The evaluation results are ordered:
182182
/// - `EvaluatedToOk` implies `EvaluatedToOkModuloRegions`
183-
/// implies `EvaluatedToAmbig` implies `EvaluatedToUnknown`
184-
/// - `EvaluatedToErr` implies `EvaluatedToRecur`
183+
/// implies `EvaluatedToAmbig` implies `EvaluatedToAmbigStackDependent`
184+
/// - `EvaluatedToErr` implies `EvaluatedToErrStackDependent`
185185
/// - the "union" of evaluation results is equal to their maximum -
186186
/// all the "potential success" candidates can potentially succeed,
187187
/// so they are noops when unioned with a definite error, and within
@@ -199,16 +199,16 @@ pub enum EvaluationResult {
199199
/// Evaluation is known to be ambiguous -- it *might* hold for some
200200
/// assignment of inference variables, but it might not.
201201
///
202-
/// While this has the same meaning as `EvaluatedToUnknown` -- we can't
202+
/// While this has the same meaning as `EvaluatedToAmbigStackDependent` -- we can't
203203
/// know whether this obligation holds or not -- it is the result we
204204
/// would get with an empty stack, and therefore is cacheable.
205205
EvaluatedToAmbig,
206206
/// Evaluation failed because of recursion involving inference
207207
/// variables. We are somewhat imprecise there, so we don't actually
208208
/// know the real result.
209209
///
210-
/// This can't be trivially cached for the same reason as `EvaluatedToRecur`.
211-
EvaluatedToUnknown,
210+
/// This can't be trivially cached for the same reason as `EvaluatedToErrStackDependent`.
211+
EvaluatedToAmbigStackDependent,
212212
/// Evaluation failed because we encountered an obligation we are already
213213
/// trying to prove on this branch.
214214
///
@@ -247,12 +247,12 @@ pub enum EvaluationResult {
247247
/// does not hold, because of the bound (which can indeed be satisfied
248248
/// by `SomeUnsizedType` from another crate).
249249
//
250-
// FIXME: when an `EvaluatedToRecur` goes past its parent root, we
250+
// FIXME: when an `EvaluatedToErrStackDependent` goes past its parent root, we
251251
// ought to convert it to an `EvaluatedToErr`, because we know
252252
// there definitely isn't a proof tree for that obligation. Not
253253
// doing so is still sound -- there isn't any proof tree, so the
254254
// branch still can't be a part of a minimal one -- but does not re-enable caching.
255-
EvaluatedToRecur,
255+
EvaluatedToErrStackDependent,
256256
/// Evaluation failed.
257257
EvaluatedToErr,
258258
}
@@ -276,15 +276,15 @@ impl EvaluationResult {
276276
| EvaluatedToOk
277277
| EvaluatedToOkModuloRegions
278278
| EvaluatedToAmbig
279-
| EvaluatedToUnknown => true,
279+
| EvaluatedToAmbigStackDependent => true,
280280

281-
EvaluatedToErr | EvaluatedToRecur => false,
281+
EvaluatedToErr | EvaluatedToErrStackDependent => false,
282282
}
283283
}
284284

285285
pub fn is_stack_dependent(self) -> bool {
286286
match self {
287-
EvaluatedToUnknown | EvaluatedToRecur => true,
287+
EvaluatedToAmbigStackDependent | EvaluatedToErrStackDependent => true,
288288

289289
EvaluatedToOkModuloOpaqueTypes
290290
| EvaluatedToOk

compiler/rustc_trait_selection/src/infer.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub trait InferCtxtExt<'tcx> {
2929
/// - the parameter environment
3030
///
3131
/// Invokes `evaluate_obligation`, so in the event that evaluating
32-
/// `Ty: Trait` causes overflow, EvaluatedToRecur (or EvaluatedToUnknown)
32+
/// `Ty: Trait` causes overflow, EvaluatedToErrStackDependent (or EvaluatedToAmbigStackDependent)
3333
/// will be returned.
3434
fn type_implements_trait(
3535
&self,

compiler/rustc_trait_selection/src/traits/select/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,8 @@ pub enum TreatInductiveCycleAs {
222222
impl From<TreatInductiveCycleAs> for EvaluationResult {
223223
fn from(treat: TreatInductiveCycleAs) -> EvaluationResult {
224224
match treat {
225-
TreatInductiveCycleAs::Ambig => EvaluatedToUnknown,
226-
TreatInductiveCycleAs::Recur => EvaluatedToRecur,
225+
TreatInductiveCycleAs::Ambig => EvaluatedToAmbigStackDependent,
226+
TreatInductiveCycleAs::Recur => EvaluatedToErrStackDependent,
227227
}
228228
}
229229
}
@@ -1231,7 +1231,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
12311231
})
12321232
{
12331233
debug!("evaluate_stack --> unbound argument, recursive --> giving up",);
1234-
return Ok(EvaluatedToUnknown);
1234+
return Ok(EvaluatedToAmbigStackDependent);
12351235
}
12361236

12371237
match self.candidate_from_obligation(stack) {

0 commit comments

Comments
 (0)