Skip to content

leptos regression #173

@compiler-errors

Description

@compiler-errors
Member

edit: While this looks like a regression with tachys, turns out that leptos has its own fork of tachys: https://github.com/leptos-rs/leptos/tree/main/tachys

Not yet minimized.

https://crater-reports.s3.amazonaws.com/pr-133502-1/try%23fa8e241660363f48d64b66b05eea58c93ab828fb/reg/leptos-0.7.8/log.txt

[INFO] [stdout] error[E0391]: cycle detected when computing type of `reactive_graph::<impl at /opt/rustwide/cargo-home/registry/src/index.crates.io-1949cf8c6b5b557f/tachys-0.1.8/src/reactive_graph/mod.rs:124:1: 128:23>::{synthetic#0}`
[INFO] [stdout]    --> /opt/rustwide/cargo-home/registry/src/index.crates.io-1949cf8c6b5b557f/tachys-0.1.8/src/reactive_graph/mod.rs:138:5
[INFO] [stdout]     |
[INFO] [stdout] 138 |     async fn resolve(mut self) -> Self::AsyncOutput {
[INFO] [stdout]     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [stdout]     |
[INFO] [stdout] note: ...which requires comparing an impl and trait method signature, inferring any hidden `impl Trait` types in the process...
[INFO] [stdout]    --> /opt/rustwide/cargo-home/registry/src/index.crates.io-1949cf8c6b5b557f/tachys-0.1.8/src/reactive_graph/mod.rs:138:5
[INFO] [stdout]     |
[INFO] [stdout] 138 |     async fn resolve(mut self) -> Self::AsyncOutput {
[INFO] [stdout]     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [stdout] note: ...which requires computing type of `reactive_graph::<impl at /opt/rustwide/cargo-home/registry/src/index.crates.io-1949cf8c6b5b557f/tachys-0.1.8/src/reactive_graph/mod.rs:124:1: 128:23>::resolve::{opaque#0}`...
[INFO] [stdout]    --> /opt/rustwide/cargo-home/registry/src/index.crates.io-1949cf8c6b5b557f/tachys-0.1.8/src/reactive_graph/mod.rs:138:5
[INFO] [stdout]     |
[INFO] [stdout] 138 |     async fn resolve(mut self) -> Self::AsyncOutput {
[INFO] [stdout]     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [stdout] note: ...which requires computing type of opaque `reactive_graph::<impl at /opt/rustwide/cargo-home/registry/src/index.crates.io-1949cf8c6b5b557f/tachys-0.1.8/src/reactive_graph/mod.rs:124:1: 128:23>::resolve::{opaque#0}`...
[INFO] [stdout]    --> /opt/rustwide/cargo-home/registry/src/index.crates.io-1949cf8c6b5b557f/tachys-0.1.8/src/reactive_graph/mod.rs:138:5
[INFO] [stdout]     |
[INFO] [stdout] 138 |     async fn resolve(mut self) -> Self::AsyncOutput {
[INFO] [stdout]     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [stdout] note: ...which requires borrow-checking `reactive_graph::<impl at /opt/rustwide/cargo-home/registry/src/index.crates.io-1949cf8c6b5b557f/tachys-0.1.8/src/reactive_graph/mod.rs:124:1: 128:23>::resolve`...
[INFO] [stdout]    --> /opt/rustwide/cargo-home/registry/src/index.crates.io-1949cf8c6b5b557f/tachys-0.1.8/src/reactive_graph/mod.rs:138:5
[INFO] [stdout]     |
[INFO] [stdout] 138 |     async fn resolve(mut self) -> Self::AsyncOutput {
[INFO] [stdout]     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [stdout] note: ...which requires promoting constants in MIR for `reactive_graph::<impl at /opt/rustwide/cargo-home/registry/src/index.crates.io-1949cf8c6b5b557f/tachys-0.1.8/src/reactive_graph/mod.rs:124:1: 128:23>::resolve`...
[INFO] [stdout]    --> /opt/rustwide/cargo-home/registry/src/index.crates.io-1949cf8c6b5b557f/tachys-0.1.8/src/reactive_graph/mod.rs:138:5
[INFO] [stdout]     |
[INFO] [stdout] 138 |     async fn resolve(mut self) -> Self::AsyncOutput {
[INFO] [stdout]     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [stdout] note: ...which requires checking if `reactive_graph::<impl at /opt/rustwide/cargo-home/registry/src/index.crates.io-1949cf8c6b5b557f/tachys-0.1.8/src/reactive_graph/mod.rs:124:1: 128:23>::resolve` contains FFI-unwind calls...
[INFO] [stdout]    --> /opt/rustwide/cargo-home/registry/src/index.crates.io-1949cf8c6b5b557f/tachys-0.1.8/src/reactive_graph/mod.rs:138:5
[INFO] [stdout]     |
[INFO] [stdout] 138 |     async fn resolve(mut self) -> Self::AsyncOutput {
[INFO] [stdout]     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [stdout] note: ...which requires building MIR for `reactive_graph::<impl at /opt/rustwide/cargo-home/registry/src/index.crates.io-1949cf8c6b5b557f/tachys-0.1.8/src/reactive_graph/mod.rs:124:1: 128:23>::resolve`...
[INFO] [stdout]    --> /opt/rustwide/cargo-home/registry/src/index.crates.io-1949cf8c6b5b557f/tachys-0.1.8/src/reactive_graph/mod.rs:138:5
[INFO] [stdout]     |
[INFO] [stdout] 138 |     async fn resolve(mut self) -> Self::AsyncOutput {
[INFO] [stdout]     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [stdout] note: ...which requires match-checking `reactive_graph::<impl at /opt/rustwide/cargo-home/registry/src/index.crates.io-1949cf8c6b5b557f/tachys-0.1.8/src/reactive_graph/mod.rs:124:1: 128:23>::resolve`...
[INFO] [stdout]    --> /opt/rustwide/cargo-home/registry/src/index.crates.io-1949cf8c6b5b557f/tachys-0.1.8/src/reactive_graph/mod.rs:138:5
[INFO] [stdout]     |
[INFO] [stdout] 138 |     async fn resolve(mut self) -> Self::AsyncOutput {
[INFO] [stdout]     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [stdout] note: ...which requires type-checking `reactive_graph::<impl at /opt/rustwide/cargo-home/registry/src/index.crates.io-1949cf8c6b5b557f/tachys-0.1.8/src/reactive_graph/mod.rs:124:1: 128:23>::resolve`...
[INFO] [stdout]    --> /opt/rustwide/cargo-home/registry/src/index.crates.io-1949cf8c6b5b557f/tachys-0.1.8/src/reactive_graph/mod.rs:138:5
[INFO] [stdout]     |
[INFO] [stdout] 138 |     async fn resolve(mut self) -> Self::AsyncOutput {
[INFO] [stdout]     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [stdout]     = note: ...which again requires computing type of `reactive_graph::<impl at /opt/rustwide/cargo-home/registry/src/index.crates.io-1949cf8c6b5b557f/tachys-0.1.8/src/reactive_graph/mod.rs:124:1: 128:23>::{synthetic#0}`, completing the cycle
[INFO] [stdout] note: cycle used when checking assoc item `html::<impl at /opt/rustwide/cargo-home/registry/src/index.crates.io-1949cf8c6b5b557f/tachys-0.1.8/src/html/mod.rs:53:1: 53:28>::resolve` is compatible with trait definition
[INFO] [stdout]    --> /opt/rustwide/cargo-home/registry/src/index.crates.io-1949cf8c6b5b557f/tachys-0.1.8/src/html/mod.rs:60:5
[INFO] [stdout]     |
[INFO] [stdout] 60  |     async fn resolve(self) -> Self::AsyncOutput {
[INFO] [stdout]     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [stdout]     = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information

Activity

compiler-errors

compiler-errors commented on Apr 11, 2025

@compiler-errors
MemberAuthor

Smells like #158 though.

edit: possibly not. IDK.

compiler-errors

compiler-errors commented on Apr 11, 2025

@compiler-errors
MemberAuthor

Edit: THIS IS ON CRATES.IO'S VERSION OF TACHYS, NOT THE FORK!

Interestingly enough, there are more/different regressions when building tachys on nightly with the new solver:

error[E0275]: overflow evaluating the requirement `<InertElement as AddAnyAttr>::Output<NewAttr>: RenderHtml`
   --> src/html/mod.rs:141:32
    |
141 |         Self::Output<NewAttr>: RenderHtml,
    |                                ^^^^^^^^^^
    |
note: the requirement `<InertElement as AddAnyAttr>::Output<NewAttr>: RenderHtml` appears on the `impl`'s method `add_any_attr` but not on the corresponding trait's method
   --> src/view/add_attr.rs:16:8
    |
11  | pub trait AddAnyAttr {
    |           ---------- in this trait
...
16  |     fn add_any_attr<NewAttr: Attribute>(
    |        ^^^^^^^^^^^^ this trait's method doesn't have the requirement `<InertElement as AddAnyAttr>::Output<NewAttr>: RenderHtml`

error[E0275]: overflow evaluating the requirement `<InertElement as AddAnyAttr>::Output<NewAttr>: RenderHtml`
   --> src/html/mod.rs:141:32
    |
141 |         Self::Output<NewAttr>: RenderHtml,
    |                                ^^^^^^^^^^

error[E0275]: overflow evaluating the requirement `<InertElement as AddAnyAttr>::Output<NewAttr>: Sized`
   --> src/html/mod.rs:139:10
    |
139 |     ) -> Self::Output<NewAttr>
    |          ^^^^^^^^^^^^^^^^^^^^^
    |
    = note: the return type of a function must have a statically known size

error[E0275]: overflow evaluating the requirement `<InertElement as AddAnyAttr>::Output<NewAttr> well-formed`
   --> src/html/mod.rs:139:10
    |
139 |     ) -> Self::Output<NewAttr>
    |          ^^^^^^^^^^^^^^^^^^^^^

error[E0275]: overflow evaluating the requirement `<InertElement as AddAnyAttr>::Output<NewAttr> well-formed`
   --> src/html/mod.rs:141:32
    |
141 |         Self::Output<NewAttr>: RenderHtml,
    |                                ^^^^^^^^^^

error[E0275]: overflow evaluating the requirement `<AnyView as AddAnyAttr>::Output<NewAttr>: RenderHtml`
   --> src/view/any_view.rs:346:32
    |
346 |         Self::Output<NewAttr>: RenderHtml,
    |                                ^^^^^^^^^^
    |
note: the requirement `<AnyView as AddAnyAttr>::Output<NewAttr>: RenderHtml` appears on the `impl`'s method `add_any_attr` but not on the corresponding trait's method
   --> src/view/add_attr.rs:16:8
    |
11  | pub trait AddAnyAttr {
    |           ---------- in this trait
...
16  |     fn add_any_attr<NewAttr: Attribute>(
    |        ^^^^^^^^^^^^ this trait's method doesn't have the requirement `<AnyView as AddAnyAttr>::Output<NewAttr>: RenderHtml`

error[E0275]: overflow evaluating the requirement `<AnyView as AddAnyAttr>::Output<NewAttr>: RenderHtml`
   --> src/view/any_view.rs:346:32
    |
346 |         Self::Output<NewAttr>: RenderHtml,
    |                                ^^^^^^^^^^

error[E0275]: overflow evaluating the requirement `<AnyView as AddAnyAttr>::Output<NewAttr>: Sized`
   --> src/view/any_view.rs:344:10
    |
344 |     ) -> Self::Output<NewAttr>
    |          ^^^^^^^^^^^^^^^^^^^^^
    |
    = note: the return type of a function must have a statically known size

error[E0275]: overflow evaluating the requirement `<AnyView as AddAnyAttr>::Output<NewAttr> well-formed`
   --> src/view/any_view.rs:344:10
    |
344 |     ) -> Self::Output<NewAttr>
    |          ^^^^^^^^^^^^^^^^^^^^^

error[E0275]: overflow evaluating the requirement `<AnyView as AddAnyAttr>::Output<NewAttr> well-formed`
   --> src/view/any_view.rs:346:32
    |
346 |         Self::Output<NewAttr>: RenderHtml,
changed the title [-]tachys regression[/-] [+]leptos ~~tachys~~ regression[/+] on Apr 11, 2025
compiler-errors

compiler-errors commented on Apr 11, 2025

@compiler-errors
MemberAuthor

Minimal-ish:

//@ check-pass
//@ edition: 2018
//@ revisions: current next
//@[next] compile-flags: -Znext-solver
//@ ignore-compare-mode-next-solver (explicit revisions)

// Regression test for leptos when building it with the new solver. Unlike
// avoid-query-cycle-via-item-bound.rs we never actually use the auto trait bound
// of the opaque here, as that one is only necessary when trying to normalize the
// `<V as AttributeValue>::{synthetic#0}` RPITIT via the impl. Given the explicit
// `V: AttributeValue` where-bound, this associated item is rigid and we don't
// care whether the impl may apply.

use std::future::Future;

pub trait ReactiveFunction: Send {
    type Output;

    fn invoke(self) -> Self::Output;
}

trait AttributeValue {
    fn resolve(self) -> impl Future<Output = ()> + Send;
}

impl<F, V> AttributeValue for F
where
    F: ReactiveFunction<Output = V>,
    V: AttributeValue,
{
    async fn resolve(self) {
        // this require `Self::Output: `
        self.invoke().resolve().await
    }
}

fn main() {}
compiler-errors

compiler-errors commented on Apr 11, 2025

@compiler-errors
MemberAuthor

So, it seems that we're doing "unnecessary work" when normalizing the <V as AttributeValue>::{synthetic#0} RPITIT. Although the V: AttributeValue where clause in the impl should keep that associated type as rigid, we're still assembling the impl candidate which inevitably leads to a cycle error.

We could perhaps rework candidate assembly for NormalizesTo goals to only assemble param-env/alias-bound candidates when the trait goal is TraitGoalProvenVia::ParamEnv/AliasBound. 🤷

changed the title [-]leptos ~~tachys~~ regression[/-] [+]leptos regression[/+] on Apr 11, 2025
added
from-craterA regression found via a crater run, not part of our test suite
on Apr 14, 2025
moved this from unknown to todo in -Znext-solver=globallyon Apr 14, 2025
added a commit that references this issue on Apr 15, 2025
b2897d0

12 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

from-craterA regression found via a crater run, not part of our test suite

Type

No type

Projects

Status

done

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @compiler-errors@lcnr

    Issue actions

      leptos regression · Issue #173 · rust-lang/trait-system-refactor-initiative