-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Unknown types implement all traits #10454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
|
I guess this happened after #10373 ? 😄 |
Yes.
No, that's fine. Note that the type of |
Something like: diff --git i/crates/hir_ty/src/method_resolution.rs w/crates/hir_ty/src/method_resolution.rs
index 8e6ab8af0..5ba637ef4 100644
--- i/crates/hir_ty/src/method_resolution.rs
+++ w/crates/hir_ty/src/method_resolution.rs
@@ -581,6 +581,10 @@ fn iterate_method_candidates_by_receiver(
name: Option<&Name>,
mut callback: &mut dyn FnMut(&Canonical<Ty>, AssocItemId) -> ControlFlow<()>,
) -> ControlFlow<()> {
+ match receiver_ty.value.kind(&Interner) {
+ chalk_ir::TyKind::BoundVar(_) => return ControlFlow::Break(()),
+ _ => {}
+ }
// We're looking for methods with *receiver* type receiver_ty. These could
// be found in any of the derefs of receiver_ty, so we have to go through
// that. Helps in this case, but seems to break for integral types. (Not sure if that's supposed to be a |
Yeah, it's supposed to be a bound var. We can check on the |
From my limited understanding Chalk treats bound vars as existentially quantified and placeholders as universally quantified, right? Since Cant remember but I saw somewhere talking about special handling of sized bound on type vars (or errors?) on Chalk side. So could we hack it on RA side with Thinking on how the hack could break, the |
Bound vars can be existentially or universally quantified, it depends on what they refer to. And no, we shouldn't add hacks for the error type; replacing the errors back with variables, which is what they were during type inference, is the correct thing to do. |
Please consider special-casing this for #8468 by disabling auto-imports. Auto-complete suggestions of potentially irrelevant methods isn't a big deal. However, auto-import of definitely incorrect traits that break correctly-picked inherent methods is a real problem. |
11805: fix: Don't try to resolve methods on unknown types r=Veykril a=flodiebold Fixes #10454, and some type mismatches. Co-authored-by: Florian Diebold <[email protected]>
The text was updated successfully, but these errors were encountered: