Skip to content

Static cyclic references not compiled in current nightly rust version #62189

Closed

Description

@chabapok

Let's tying to compile this code.This code compiled ok on stable and on nightly-2019-06-17 (for example at rust play site)

struct Foo {
    foo: Option<&'static Foo>
}

static FOO: Foo = Foo {
    foo: Some(&FOO),
};

fn main() {
    println!("Hello, world!");
}

But in current rustc 1.37.0-nightly (d3e2cec 2019-06-26) compilation fails with message:

error[E0391]: cycle detected when const-evaluating `FOO`
 --> src/main.rs:6:1
  |
6 | static FOO: Foo = Foo {
  | ^^^^^^^^^^^^^^^^^^^^^
  |
note: ...which requires const-evaluating `FOO`...
 --> src/main.rs:6:1
  |
6 | static FOO: Foo = Foo {
  | ^^^^^^^^^^^^^^^^^^^^^
  = note: ...which again requires const-evaluating `FOO`, completing the cycle
note: cycle used when const-evaluating + checking `FOO`
 --> src/main.rs:6:1
  |
6 | static FOO: Foo = Foo {
  | ^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0391`.

Activity

  1. changed the title [-]Static cyclic references compiled not compiled in current nightly rust version[/-] [+]Static cyclic references not compiled in current nightly rust version[/+] on Jun 27, 2019
  2. added
    A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)
    C-bugCategory: This is a bug.
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Jun 27, 2019
  3. added
    E-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc
    on Jun 27, 2019
  4. wesleywiser commented on Jun 28, 2019

    @wesleywiser
    Member

    Bisected to:

    • nightly-2019-06-19 Ok
    • nightly-2019-06-20 Fail

    04a3dd8...2fe7b33

  5. removed
    E-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc
    on Jun 28, 2019
  6. cuviper commented on Jun 28, 2019

    @cuviper
    Member

    I bisected to #58351, which is also part of the range @wesleywiser identified. I get build failures when I try to bisect further into the commits of that PR. cc @oli-obk @RalfJung

  7. oli-obk commented on Jun 28, 2019

    @oli-obk
    Contributor

    Hmm curious, we do have tests for such situations. I'll investigate, but it'll drop into beta today. It's probably an easy fix

  8. RalfJung commented on Jun 28, 2019

    @RalfJung
    Member

    it'll drop into beta today

    Today? Beta cutoff is on Tuesday.

  9. oli-obk commented on Jun 28, 2019

    @oli-obk
    Contributor

    Not this time I believe

  10. pnkfelix commented on Jul 4, 2019

    @pnkfelix
    Contributor

    triage: P-high, remove nomination, assign to @oli-obk

  11. RalfJung commented on Jul 4, 2019

    @RalfJung
    Member

    FYI, Oli is on vacation for 2 weeks.

  12. RalfJung commented on Jul 10, 2019

    @RalfJung
    Member

    Should this be marked regression-from-stable-to-beta now?

  13. added and removed on Jul 25, 2019
  14. added a commit that references this issue on Jul 27, 2019
    b25d74f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)C-bugCategory: This is a bug.P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions