no more Reveal :(

This commit is contained in:
lcnr
2024-11-20 11:31:49 +01:00
parent f4b516b10c
commit 319843d8cd
46 changed files with 112 additions and 299 deletions

View File

@@ -222,7 +222,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
/// Enables tracking of intercrate ambiguity causes. See
/// the documentation of [`Self::intercrate_ambiguity_causes`] for more.
pub fn enable_tracking_intercrate_ambiguity_causes(&mut self) {
assert_matches!(self.infcx.typing_mode_unchecked(), TypingMode::Coherence);
assert_matches!(self.infcx.typing_mode(), TypingMode::Coherence);
assert!(self.intercrate_ambiguity_causes.is_none());
self.intercrate_ambiguity_causes = Some(FxIndexSet::default());
debug!("selcx: enable_tracking_intercrate_ambiguity_causes");
@@ -234,7 +234,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
pub fn take_intercrate_ambiguity_causes(
&mut self,
) -> FxIndexSet<IntercrateAmbiguityCause<'tcx>> {
assert_matches!(self.infcx.typing_mode_unchecked(), TypingMode::Coherence);
assert_matches!(self.infcx.typing_mode(), TypingMode::Coherence);
self.intercrate_ambiguity_causes.take().unwrap_or_default()
}
@@ -1027,7 +1027,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
previous_stack: TraitObligationStackList<'o, 'tcx>,
mut obligation: PolyTraitObligation<'tcx>,
) -> Result<EvaluationResult, OverflowError> {
if !matches!(self.infcx.typing_mode(obligation.param_env), TypingMode::Coherence)
if !matches!(self.infcx.typing_mode(), TypingMode::Coherence)
&& obligation.is_global()
&& obligation.param_env.caller_bounds().iter().all(|bound| bound.has_param())
{
@@ -1459,7 +1459,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
fn is_knowable<'o>(&mut self, stack: &TraitObligationStack<'o, 'tcx>) -> Result<(), Conflict> {
let obligation = &stack.obligation;
match self.infcx.typing_mode(obligation.param_env) {
match self.infcx.typing_mode() {
TypingMode::Coherence => {}
TypingMode::Analysis { .. } | TypingMode::PostAnalysis => return Ok(()),
}
@@ -1489,7 +1489,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
return false;
}
match self.infcx.typing_mode(param_env) {
match self.infcx.typing_mode() {
// Avoid using the global cache during coherence and just rely
// on the local cache. It is really just a simplification to
// avoid us having to fear that coherence results "pollute"
@@ -2518,7 +2518,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
nested_obligations.extend(obligations);
if impl_trait_header.polarity == ty::ImplPolarity::Reservation
&& !matches!(self.infcx.typing_mode(obligation.param_env), TypingMode::Coherence)
&& !matches!(self.infcx.typing_mode(), TypingMode::Coherence)
{
debug!("reservation impls only apply in intercrate mode");
return Err(());