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

Cycle error involving Freeze when testing time crate #119273

Open
jhpratt opened this issue Dec 24, 2023 · 2 comments
Open

Cycle error involving Freeze when testing time crate #119273

jhpratt opened this issue Dec 24, 2023 · 2 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. I-cycle Issue: A query cycle occurred while none was expected P-medium Medium priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@jhpratt
Copy link
Member

jhpratt commented Dec 24, 2023

For roughly a month, I have been getting an error in CI when performing code coverage. This is due to a stderr diff (I'm using trybuild). By itself, that is acceptable breakage, but the cause is a cycle error. Given the most recent successful and earliest failing CI runs, I bisected the compiler. The results are below. I have not attempted to minimize the error in any way.

In my opinion, a cycle error like this should be a proper ICE in terms of diagnostics, which would tell the user to file an issue. I only know to do this because of my involvement with rustc.

This change will land on stable in just a few days. I have reproduced it on the 1.75.0 binary from the pre-release server.

cc @compiler-errors as author of the PR apparently causing regression (#117418)

The diff in question:

diff --git a/tests/compile-fail/invalid_serializer.stderr b/tests/compile-fail/invalid_serializer.stderr
index 2f73f41..3579ac3 100644
--- a/tests/compile-fail/invalid_serializer.stderr
+++ b/tests/compile-fail/invalid_serializer.stderr
@@ -79,3 +79,35 @@ error[E0432]: unresolved import `not_string`
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no external crate `not_string`
    |
    = note: this error originates in the macro `serde::format_description` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0391]: cycle detected when computing type of opaque `my_format::description::{opaque#0}`
+  --> ../tests/compile-fail/invalid_serializer.rs:14:1
+   |
+14 | serde::format_description!(my_format, OffsetDateTime, not_string); // string format wrong type
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+note: ...which requires borrow-checking `my_format::description`...
+  --> ../tests/compile-fail/invalid_serializer.rs:14:1
+   |
+14 | serde::format_description!(my_format, OffsetDateTime, not_string); // string format wrong type
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: ...which requires promoting constants in MIR for `my_format::description`...
+  --> ../tests/compile-fail/invalid_serializer.rs:14:1
+   |
+14 | serde::format_description!(my_format, OffsetDateTime, not_string); // string format wrong type
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: ...which requires const checking `my_format::description`...
+  --> ../tests/compile-fail/invalid_serializer.rs:14:1
+   |
+14 | serde::format_description!(my_format, OffsetDateTime, not_string); // string format wrong type
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   = note: ...which requires computing whether `my_format::description::{opaque#0}` is freeze...
+   = note: ...which requires evaluating trait selection obligation `my_format::description::{opaque#0}: core::marker::Freeze`...
+   = note: ...which again requires computing type of opaque `my_format::description::{opaque#0}`, completing the cycle
+note: cycle used when computing type of `my_format::description::{opaque#0}`
+  --> ../tests/compile-fail/invalid_serializer.rs:14:1
+   |
+14 | serde::format_description!(my_format, OffsetDateTime, not_string); // string format wrong type
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   = 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
+   = note: this error originates in the macro `serde::format_description` (in Nightly builds, run with -Z macro-backtrace for more info)

@rustbot label +C-bug +regression-from-stable-to-beta +T-compiler


searched nightlies: from nightly-2023-10-20 to nightly-2023-11-19
regressed nightly: nightly-2023-11-08
searched commit range: 189d6c7...7adc89b
regressed commit: 504f63e

bisected with cargo-bisect-rustc v0.6.7

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc --start 2023-10-20 --end 2023-11-19 --script ./test.sh 

./test.sh contains:

#!/bin/sh

RUSTFLAGS="--cfg __ui_tests" cargo test --all-features
@rustbot rustbot added needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. C-bug Category: This is a bug. 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. I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Dec 24, 2023
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Dec 25, 2023
@apiraino
Copy link
Contributor

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-medium +A-diagnostics

@rustbot rustbot added A-diagnostics Area: Messages for errors, warnings, and lints P-medium Medium priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Dec 26, 2023
@jhpratt

This comment was marked as resolved.

@rustbot rustbot added regression-from-stable-to-stable Performance or correctness regression from one stable version to another. and removed regression-from-stable-to-beta Performance or correctness regression from stable to beta. labels Dec 28, 2023
@fmease fmease added the I-cycle Issue: A query cycle occurred while none was expected label Jan 25, 2024
jhpratt added a commit to time-rs/time that referenced this issue Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. I-cycle Issue: A query cycle occurred while none was expected P-medium Medium priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants