Repository navigation
Conversation
This comment has been minimized.
This comment has been minimized.
c29ef89 to
e8381f1
Compare
|
HIR ty lowering was modified cc @fmease |
|
rustbot has assigned @petrochenkov. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
r? lcnr |
|
Reworked this to avoid using type relations in ItemCtxt |
| } | ||
|
|
||
| ty::DeepRejectCtxt::relate_rigid_infer(tcx) | ||
| .types_may_unify_with_depth(value, impl_ty, usize::MAX) |
There was a problem hiding this comment.
hmm, this is a lot of complexity for a kind of minor diagnostic. But also, this code is weird. why do you both have an infcx.is_none() check and then do an if let. feels nicer to only match on infcx once. We never have infcx and not a param_env, do we? so maybe we should have a single get_ctxt_if_in_body or something that returns both InferCtxt and ParamEnv
fold_regions to replace all regions with erased is wrong. We must not replace bound regions as doing so changes types.
I feel like ideally we wouldn't try to do anything interesting when in an ItemCtxt 🤔 idk what I want here. How bad is it if you always just use the deepreject check and never try a proper can_eq?
There was a problem hiding this comment.
I think using DeepRejectCtxt everywhere makes sense here
we might get some false positives, like (u8, u16) matching impl<T> HasItem for (T, T) but that seems acceptable for a diagnostic
we'd need to reconsider MachineApplicable though
I'll simplify the code
There was a problem hiding this comment.
I noticed that DeepRejectCtxt matches unresolved projections against quite a few unrelated impls
may skipping them also loses some useful suggestions in function bodies but I think that is better than suggesting traits that do not actually apply
f666945 to
b3eee23
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| return Vec::new(); | ||
| } | ||
|
|
||
| // FIXME: Support non-lifetime binders without suggesting unrelated traits. |
There was a problem hiding this comment.
| // FIXME: Support non-lifetime binders without suggesting unrelated traits. | |
| // FIXME(non_lifetime_binders): Support non-lifetime binders without suggesting unrelated traits. |
| let value = fold_regions(tcx, qself_ty, |_, _| tcx.lifetimes.re_erased); | ||
| // FIXME: Don't bother dealing with non-lifetime binders here... | ||
| if value.has_escaping_bound_vars() { | ||
| if header.polarity == ty::ImplPolarity::Negative { |
There was a problem hiding this comment.
instead explicitly filter for positive impls 🤔 this currently accepts reservation impls?
| .skip_norm_wip() | ||
| .self_ty(); | ||
|
|
||
| ty::DeepRejectCtxt::relate_rigid_infer(tcx) |
There was a problem hiding this comment.
comment why we use deep reject
There was a problem hiding this comment.
check-fail is unnecessary. can you also change these tests to use revisions for old and new
There was a problem hiding this comment.
don't think this test is too useful, i wouldn't add it
Signed-off-by: Amirhossein Akhlaghpour <m9.akhlaghpoor@gmail.com>
Signed-off-by: Amirhossein Akhlaghpour <m9.akhlaghpoor@gmail.com>
Signed-off-by: Amirhossein Akhlaghpour <m9.akhlaghpoor@gmail.com>
Signed-off-by: Amirhossein Akhlaghpour <m9.akhlaghpoor@gmail.com>
Signed-off-by: Amirhossein Akhlaghpour <m9.akhlaghpoor@gmail.com>
Signed-off-by: Amirhossein Akhlaghpour <m9.akhlaghpoor@gmail.com>
60b0999 to
338ae87
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
fixes #163320
the associated type suggestion probe uses an empty param-env which leaves the next solver without the const parameter's type information
we can add necessary clauses while avoiding queries for a generic parameter's type during its own lowering