Unnamed repository; edit this file 'description' to name the repository.
Merge pull request #22617 from ada4a/push-mtxzotmzskkx
fix(implements_trait_unique_with_infcx): only forbid the self type from being an error type
Chayim Refael Friedman 4 weeks ago
parent d1cfbe2 · parent 236121b · commit 72fee12
-rw-r--r--crates/hir-ty/src/traits.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/hir-ty/src/traits.rs b/crates/hir-ty/src/traits.rs
index 3b5890e5e4..2ca9ebe070 100644
--- a/crates/hir-ty/src/traits.rs
+++ b/crates/hir-ty/src/traits.rs
@@ -20,7 +20,7 @@ use hir_expand::name::Name;
use intern::sym;
use rustc_type_ir::{
TypeVisitableExt, TypingMode,
- inherent::{BoundExistentialPredicates, GenericArg as _, IntoKind, Ty as _},
+ inherent::{BoundExistentialPredicates, IntoKind, Ty as _},
};
use crate::{
@@ -153,10 +153,10 @@ pub fn implements_trait_unique_with_infcx<'db>(
let infcx = interner.infer_ctxt().build(TypingMode::non_body_analysis());
let args = create_args(&infcx);
- if args.iter().filter_map(|it| it.as_type()).any(|ty| ty.is_ty_error()) {
+ let trait_ref = rustc_type_ir::TraitRef::new_from_args(interner, trait_.into(), args);
+ if trait_ref.self_ty().is_ty_error() {
return false;
}
- let trait_ref = rustc_type_ir::TraitRef::new_from_args(interner, trait_.into(), args);
let obligation = Obligation::new(interner, ObligationCause::dummy(), env.param_env, trait_ref);
infcx.predicate_must_hold_modulo_regions(&obligation)