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

Regression in nightly-2024-05-27 #126117

Closed
JonathanBrouwer opened this issue Jun 7, 2024 · 7 comments · Fixed by #126258
Closed

Regression in nightly-2024-05-27 #126117

JonathanBrouwer opened this issue Jun 7, 2024 · 7 comments · Fixed by #126258
Assignees
Labels
P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@JonathanBrouwer
Copy link

JonathanBrouwer commented Jun 7, 2024

The code in my hobby project Prism compiles on stable, but not on the latest nightly.
https://github.com/JonathanBrouwer/Prism/tree/222637a80cc2bb7794d0e4f649665fdd4ca23320
Sadly the codebase is quite large and I don't really see a good way to reduce it.

I ran cargo-bisect-rustc, which got the following output: (Which is a version bump commit, which confuses me)

searched nightlies: from nightly-2024-01-01 to nightly-2024-06-07
regressed nightly: nightly-2024-03-18
searched commit range: 766bdce...eb45c84
regressed commit: 4c1b9c3

The most interesting error that is returned on nightly is:

error[E0391]: cycle detected when computing type of opaque `parser::parser_rule_body::parser_body_sub_annotations::{opaque#0}`
   --> prism-parser/src/parser/parser_rule_body.rs:122:6
    |
122 | ) -> impl Parser<'arn, 'grm, Cow<'arn, ActionResult<'arn, 'grm>>, E> + 'a {
    |      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: ...which requires type-checking `parser::parser_rule_body::parser_body_sub_annotations`...
   --> prism-parser/src/parser/parser_rule_body.rs:125:27
    |
125 |             let mut res = parser_body_sub_annotations(rules, blocks, rest, expr, rule_args, vars)
    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: ...which requires evaluating trait selection obligation `parser::parser_rule_body::parser_body_sub_annotations::{opaque#0}: core::marker::Unpin`...
    = note: ...which again requires computing type of opaque `parser::parser_rule_body::parser_body_sub_annotations::{opaque#0}`, completing the cycle
note: cycle used when computing type of `parser::parser_rule_body::parser_body_sub_annotations::{opaque#0}`
   --> prism-parser/src/parser/parser_rule_body.rs:122:6
    |
122 | ) -> impl Parser<'arn, 'grm, Cow<'arn, ActionResult<'arn, 'grm>>, E> + 'a {
    |      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = 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

Though multiple errors are returned. The entire error log is:
https://gist.github.com/JonathanBrouwer/33d429eab435c266029b3a0828642760

@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jun 7, 2024
@lqd
Copy link
Member

lqd commented Jun 7, 2024

A simple bisect hits #124080 for me -- with the interesting comment "None of these can be reached from stable afaict."

A quick sanity check showed that the project built on nightly-2024-05-26 and failed on nightly-2024-05-27. That's further than your bisection so I assume it's that PR.

cc @oli-obk

@oli-obk oli-obk self-assigned this Jun 7, 2024
@oli-obk
Copy link
Contributor

oli-obk commented Jun 7, 2024

probably specifically 29a630e

@JonathanBrouwer JonathanBrouwer changed the title Regression in nightly-2024-03-18 Regression in nightly-2024-05-27 Jun 7, 2024
@workingjubilee workingjubilee added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jun 7, 2024
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Jun 7, 2024
@JonathanBrouwer
Copy link
Author

I managed to reduce the example a lot.

This code still shows the same behavior:

pub trait Parser<E> {
    fn parse(&self) -> E;
}

impl<E, T: Fn() -> E> Parser<E> for T {
    fn parse(&self) -> E {
        self()
    }
}

pub fn recursive_fn<E>() -> impl Parser<E> {
    move || {
        recursive_fn().parse()
    }
}

@lqd lqd added S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue and removed E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example labels Jun 8, 2024
@oli-obk
Copy link
Contributor

oli-obk commented Jun 11, 2024

oof, looks like this code will break with the new solver, too (cc @lcnr)

@apiraino
Copy link
Contributor

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-high

@rustbot rustbot added P-high High priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Jun 11, 2024
@lqd lqd added regression-from-stable-to-beta Performance or correctness regression from stable to beta. and removed regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. labels Jun 11, 2024
@bors bors closed this as completed in 2a94a5b Jun 11, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jun 11, 2024
Rollup merge of rust-lang#126258 - oli-obk:recursive_rpit, r=lcnr

Do not define opaque types when selecting impls

fixes rust-lang#126117

r? `@lcnr` for inconsistency with next solver
@lqd
Copy link
Member

lqd commented Jun 11, 2024

Reopening to track beta backport

@lqd lqd reopened this Jun 11, 2024
@wesleywiser
Copy link
Member

Backport was completed, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants