Skip to content

Commit

Permalink
Actually use probes when needed and stop relying on existing outer pr…
Browse files Browse the repository at this point in the history
…obes
  • Loading branch information
compiler-errors committed Apr 29, 2024
1 parent 5776aec commit 7cf1c54
Show file tree
Hide file tree
Showing 11 changed files with 350 additions and 335 deletions.
5 changes: 5 additions & 0 deletions compiler/rustc_middle/src/traits/solve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,4 +332,9 @@ pub enum CandidateSource {
/// }
/// ```
AliasBound,
/// A candidate that is registered only during coherence to represent some
/// yet-unknown impl that could be produced downstream without violating orphan
/// rules.
// FIXME: Merge this with the forced ambiguity candidates, so those don't use `Misc`.
CoherenceUnknowable,
}
6 changes: 2 additions & 4 deletions compiler/rustc_middle/src/traits/solve/inspect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,6 @@ pub enum ProbeKind<'tcx> {
TryNormalizeNonRigid { result: QueryResult<'tcx> },
/// Probe entered when normalizing the self ty during candidate assembly
NormalizedSelfTyAssembly,
/// Some candidate to prove the current goal.
///
/// FIXME: Remove this in favor of always using more strongly typed variants.
MiscCandidate { name: &'static str, result: QueryResult<'tcx> },
/// A candidate for proving a trait or alias-relate goal.
TraitCandidate { source: CandidateSource, result: QueryResult<'tcx> },
/// Used in the probe that wraps normalizing the non-self type for the unsize
Expand All @@ -154,4 +150,6 @@ pub enum ProbeKind<'tcx> {
/// do a probe to find out what projection type(s) may be used to prove that
/// the source type upholds all of the target type's object bounds.
UpcastProjectionCompatibility,
/// Try to unify an opaque type with an existing
OpaqueTypeStorageLookup,
}
4 changes: 2 additions & 2 deletions compiler/rustc_middle/src/traits/solve/inspect/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ impl<'a, 'b> ProofTreeFormatter<'a, 'b> {
ProbeKind::UpcastProjectionCompatibility => {
write!(self.f, "PROBING FOR PROJECTION COMPATIBILITY FOR UPCASTING:")
}
ProbeKind::MiscCandidate { name, result } => {
write!(self.f, "CANDIDATE {name}: {result:?}")
ProbeKind::OpaqueTypeStorageLookup => {
write!(self.f, "PROBING FOR AN EXISTING OPAQUE:")
}
ProbeKind::TraitCandidate { source, result } => {
write!(self.f, "CANDIDATE {source:?}: {result:?}")
Expand Down
Loading

0 comments on commit 7cf1c54

Please sign in to comment.