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

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

Closed
chabapok opened this issue Jun 27, 2019 · 9 comments · Fixed by #62982
Closed

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

chabapok opened this issue Jun 27, 2019 · 9 comments · Fixed by #62982
Assignees
Labels
A-const-eval Area: Constant evaluation (MIR interpretation) C-bug Category: This is a bug. P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@chabapok
Copy link

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`.
@chabapok chabapok changed the title Static cyclic references compiled not compiled in current nightly rust version Static cyclic references not compiled in current nightly rust version Jun 27, 2019
@jonas-schievink jonas-schievink added A-const-eval Area: Constant evaluation (MIR interpretation) C-bug Category: This is a bug. regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. I-nominated labels Jun 27, 2019
@pnkfelix pnkfelix added the E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc label Jun 27, 2019
@wesleywiser
Copy link
Member

Bisected to:

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

04a3dd8...2fe7b33

@wesleywiser wesleywiser removed the E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc label Jun 28, 2019
@cuviper
Copy link
Member

cuviper commented Jun 28, 2019

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

@oli-obk
Copy link
Contributor

oli-obk commented Jun 28, 2019

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

@RalfJung
Copy link
Member

it'll drop into beta today

Today? Beta cutoff is on Tuesday.

@oli-obk
Copy link
Contributor

oli-obk commented Jun 28, 2019

Not this time I believe

@wesleywiser
Copy link
Member

@pnkfelix
Copy link
Member

pnkfelix commented Jul 4, 2019

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

@pnkfelix pnkfelix added P-high High priority and removed I-nominated labels Jul 4, 2019
@RalfJung
Copy link
Member

RalfJung commented Jul 4, 2019

FYI, Oli is on vacation for 2 weeks.

@RalfJung
Copy link
Member

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

@oli-obk oli-obk 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 Jul 25, 2019
Centril added a commit to Centril/rust that referenced this issue Jul 27, 2019
Don't access a static just for its size and alignment

cc @RalfJung

fixes rust-lang#62189
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-eval Area: Constant evaluation (MIR interpretation) C-bug Category: This is a bug. P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. 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