Repository navigation
Conversation
Signed-off-by: Amirhossein Akhlaghpour <m9.akhlaghpoor@gmail.com>
| if !matches!(c.source, CandidateSource::ParamEnv(_)) { | ||
| self.ignore_candidate_head_usages(std::mem::take(&mut c.head_usages)); | ||
| } | ||
| } |
There was a problem hiding this comment.
if you do this after the extract_if you don't need to check the candidate source?
|
I think this doesn't fix, as now all the impl candidates don't apply due to use std::marker::PhantomData;
trait Dependencies<D> {}
struct Graph<M, const STATE: u8>(PhantomData<M>);
fn impls<T: Dependencies<D>, D>() {}
trait NotImplemented {}
macro_rules! example {
($(($($dep:ident => $next:literal),+)),+ $(,)?) => {
fn hang<M>()
where
Graph<M, 0>: Dependencies<()>,
$($(Graph<M, $next>: Dependencies<()>,)+)+
{
impls::<Graph<M, 0>, _>();
}
$(
impl<M, const STATE: u8, $($dep,)+> Dependencies<($($dep,)+)>
for Graph<M, STATE>
where
$(Graph<M, $next>: Dependencies<$dep>,)+
Graph<M, STATE>: NotImplemented,
{}
)+
};
}
example! {
(D1 => 21, D2 => 22),
(D1 => 31, D2 => 32, D3 => 33),
(D1 => 41, D2 => 42, D3 => 43, D4 => 44),
(D1 => 51, D2 => 52, D3 => 53, D4 => 54, D5 => 55),
}
fn main() {}see https://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/.60hypospray-0.2E1.2E2.60.20minimization/near/618185915 on how to also ignore usages from impls which don't apply |
Signed-off-by: Amirhossein Akhlaghpour <m9.akhlaghpoor@gmail.com>
6e6bd29 to
c80a079
Compare
|
@lcnr thanks for catching that |
|
rustbot has assigned @JonathanBrouwer. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
r? types |
| /// However, we currently don't have any tests where this matters and the complexity of | ||
| /// doing so does not feel worth it for now. | ||
| /// Head usages of failed candidates which may be ignored when their results | ||
| /// do not affect the selected candidate. | ||
| #[derive(Debug)] | ||
| pub(super) struct FailedCandidateInfo { |
There was a problem hiding this comment.
I feel unsure here... I do somewhat dislike the current candidate assembly setup if we're tracking failed candidates anyways and need to explicitly track which candidates don't matter.
My current vague vibe is that it may actually be better to have a Candidates struct where we collect/discard candidates eagerly instead of collecting all of them and doing stuff at the end 🤔
in a way that'd be more similar to the existing behavior of
rust/compiler/rustc_trait_selection/src/traits/project.rs
Lines 66 to 139 in ce37c4f
🤔
|
☔ The latest upstream changes (presumably #165244) made this pull request unmergeable. Please resolve the merge conflicts by rebasing. |
Discarded impl candidates from non-global
ParamEnvpreferences can contribute candidate head usages causing unnecessary canonical cycle rerunsthose head usages can be ignored when the candidates are discarded
cc https://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/.60hypospray-0.2E1.2E2.60.20minimization/with/617255330