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

fix cycle error when a static and a promoted are mutually recursive #120960

Merged
merged 1 commit into from
Feb 12, 2024

Conversation

RalfJung
Copy link
Member

This also now allows promoteds everywhere to point to 'extern static', because why not? We still check that constants cannot transitively reach 'extern static' through references. (We allow it through raw pointers.)

r? @oli-obk
Fixes #120949

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 12, 2024
@rustbot
Copy link
Collaborator

rustbot commented Feb 12, 2024

Some changes occurred to the CTFE / Miri engine

cc @rust-lang/miri

This also now allows promoteds everywhere to point to 'extern static', because why not?
We still check that constants cannot transitively reach 'extern static' through references.
(We allow it through raw pointers.)
@oli-obk
Copy link
Contributor

oli-obk commented Feb 12, 2024

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Feb 12, 2024

📌 Commit 5fa69de has been approved by oli-obk

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 12, 2024
@RalfJung
Copy link
Member Author

@bors p=1
fixes a stable-to-nightly regression / a P-high bug, let's try to get this into the next nightly

@bors
Copy link
Contributor

bors commented Feb 12, 2024

⌛ Testing commit 5fa69de with merge ed19532...

@nvzqz
Copy link
Contributor

nvzqz commented Feb 12, 2024

@RalfJung can you please check if this also fixes #120968?

@bors
Copy link
Contributor

bors commented Feb 12, 2024

☀️ Test successful - checks-actions
Approved by: oli-obk
Pushing ed19532 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Feb 12, 2024
@bors bors merged commit ed19532 into rust-lang:master Feb 12, 2024
12 checks passed
@rustbot rustbot added this to the 1.78.0 milestone Feb 12, 2024
@RalfJung
Copy link
Member Author

@RalfJung can you please check if this also fixes #120968?

Yes it does, see #120970.

@RalfJung RalfJung deleted the static-promoted-cycle branch February 12, 2024 14:31
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (ed19532): comparison URL.

Overall result: ❌ regressions - no action needed

@rustbot label: -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.4% [0.4%, 0.4%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.4% [0.4%, 0.4%] 1

Max RSS (memory usage)

This benchmark run did not return any relevant results for this metric.

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 663.718s -> 661.706s (-0.30%)
Artifact size: 308.26 MiB -> 308.30 MiB (0.01%)

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 12, 2024
…li-obk

add another test for promoteds-in-static

rust-lang#119614 led to validation of promoteds recursing into statics. These statics can point to `static mut` and interior mutable `static` and do other things we don't allow in `const`, but promoteds are validated as `const`, so we get strange errors (saying "in `const`" when there is no const) and surprising validation failures.

rust-lang#120960 fixes that; this here adds another test.

r? `@oli-obk`
Fixes rust-lang#120968
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 12, 2024
…li-obk

add another test for promoteds-in-static

rust-lang#119614 led to validation of promoteds recursing into statics. These statics can point to `static mut` and interior mutable `static` and do other things we don't allow in `const`, but promoteds are validated as `const`, so we get strange errors (saying "in `const`" when there is no const) and surprising validation failures.

rust-lang#120960 fixes that; this here adds another test.

r? ``@oli-obk``
Fixes rust-lang#120968
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Feb 13, 2024
Rollup merge of rust-lang#120970 - RalfJung:static-promoted-test, r=oli-obk

add another test for promoteds-in-static

rust-lang#119614 led to validation of promoteds recursing into statics. These statics can point to `static mut` and interior mutable `static` and do other things we don't allow in `const`, but promoteds are validated as `const`, so we get strange errors (saying "in `const`" when there is no const) and surprising validation failures.

rust-lang#120960 fixes that; this here adds another test.

r? ``@oli-obk``
Fixes rust-lang#120968
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Feb 13, 2024
add another test for promoteds-in-static

rust-lang/rust#119614 led to validation of promoteds recursing into statics. These statics can point to `static mut` and interior mutable `static` and do other things we don't allow in `const`, but promoteds are validated as `const`, so we get strange errors (saying "in `const`" when there is no const) and surprising validation failures.

rust-lang/rust#120960 fixes that; this here adds another test.

r? ``@oli-obk``
Fixes rust-lang/rust#120968
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regression: Fail to evaluate self-referential static slices
6 participants