Skip to content
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

Evaluate caches stack-dependent results #123403

Open
lcnr opened this issue Apr 3, 2024 · 0 comments
Open

Evaluate caches stack-dependent results #123403

lcnr opened this issue Apr 3, 2024 · 0 comments
Labels
A-trait-system Area: Trait system fixed-by-next-solver Fixed by the next-generation trait solver, `-Znext-solver`.

Comments

@lcnr
Copy link
Contributor

lcnr commented Apr 3, 2024

struct W<T: ?Sized>(*const T);
trait Foo {}
trait Bar {}

impl<T: Bar + NotImplemented> Foo for T {}
impl Foo for W<u32> {}

impl<T: Foo + AssertInferenceConstraintsApplied> Bar for T {}
trait AssertInferenceConstraintsApplied {}
trait GuideFromEnv {}
trait ErrOnGuidance {}
impl<T: GuideFromEnv + ErrOnGuidance> AssertInferenceConstraintsApplied for T {}
impl<T> GuideFromEnv for T {}
impl ErrOnGuidance for W<u32> {}

impl<T> Bar for T
where
    W<T>: NotImplemented {}
trait NotImplemented {}

fn impls_foo<T: Foo>() {}
fn impls_bar<T: Bar>() {}

fn with_bound()
where
    W<u64>: GuideFromEnv,
{
    impls_foo::<W<_>>(); // commenting this line changes the next one to OK
    impls_bar::<W<_>>(); // ERROR
}

fn main() {
    with_bound();
}

cc @compiler-errors #123303 this should be broken even after #122791

THe idea is from #123303 (comment)

  • GoalA
    • CandA1
      • GoalB
        • CandB1
          • GoalA (inductive cycle -> ambig)
          • AssertInferenceConstraintsApplied (fails due to incompleteness if the inference constraints from CandA2 have not yet been applied)
        • CandB2
          • Impossible (necessary to evaluate nested goals of CandB1 during selection)
    • CandA2
      • guide inference ~> Ok, but inference constraints
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Apr 3, 2024
@lcnr lcnr added A-trait-system Area: Trait system I-unsound Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness labels Apr 3, 2024
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Apr 3, 2024
@lcnr lcnr added P-medium Medium priority fixed-by-next-solver Fixed by the next-generation trait solver, `-Znext-solver`. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. I-prioritize Issue: Indicates that prioritization has been requested for this issue. P-medium Medium priority I-unsound Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness labels Apr 3, 2024
@obeis obeis removed their assignment Jun 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-trait-system Area: Trait system fixed-by-next-solver Fixed by the next-generation trait solver, `-Znext-solver`.
Projects
None yet
Development

No branches or pull requests

3 participants