1
Fork 0

Rollup merge of #129417 - compiler-errors:refine-err, r=lqd

Don't trigger refinement lint if predicates reference errors

Fixes #129404
This commit is contained in:
Matthias Krüger 2024-08-23 06:26:54 +02:00 committed by GitHub
commit 32821b9f8a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 30 additions and 20 deletions

View file

@ -7,7 +7,8 @@ use rustc_lint_defs::builtin::{REFINING_IMPL_TRAIT_INTERNAL, REFINING_IMPL_TRAIT
use rustc_middle::span_bug;
use rustc_middle::traits::{ObligationCause, Reveal};
use rustc_middle::ty::{
self, Ty, TyCtxt, TypeFoldable, TypeFolder, TypeSuperVisitable, TypeVisitable, TypeVisitor,
self, Ty, TyCtxt, TypeFoldable, TypeFolder, TypeSuperVisitable, TypeVisitable,
TypeVisitableExt, TypeVisitor,
};
use rustc_span::Span;
use rustc_trait_selection::regions::InferCtxtRegionExt;
@ -177,6 +178,10 @@ pub(super) fn check_refining_return_position_impl_trait_in_trait<'tcx>(
return;
};
if trait_bounds.references_error() || impl_bounds.references_error() {
return;
}
// For quicker lookup, use an `IndexSet` (we don't use one earlier because
// it's not foldable..).
// Also, We have to anonymize binders in these types because they may contain