Skip to content

Record type-dependent defs in item signatures#157194

Draft
mu001999 wants to merge 3 commits into
rust-lang:mainfrom
mu001999-contrib:type-dep-defs
Draft

Record type-dependent defs in item signatures#157194
mu001999 wants to merge 3 commits into
rust-lang:mainfrom
mu001999-contrib:type-dep-defs

Conversation

@mu001999
Copy link
Copy Markdown
Member

@mu001999 mu001999 commented May 31, 2026

Tracking: #156711

Attempt to record type-dependent defs in ItemCtxt, and expose recorded results through new queries.

TODO:

cc @fmease

@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 31, 2026
@fmease fmease self-assigned this May 31, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer
Copy link
Copy Markdown
Collaborator

The job aarch64-gnu-llvm-21-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)

failures:

---- [ui] tests/rustdoc-ui/private-type-cycle-dyn-110629.rs stdout ----
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/rustdoc-ui/private-type-cycle-dyn-110629/private-type-cycle-dyn-110629.stderr`
diff of stderr:

1 error[E0391]: cycle detected when expanding type alias `Bar`
+   --> $DIR/private-type-cycle-dyn-110629.rs:3:1
+    |
+ LL | type Bar<'a, 'b> = Box<dyn PartialEq<Bar<'a, 'b>>>;
+    | ^^^^^^^^^^^^^^^^
+    |
+ note: ...which requires computing type and type-dependent definitions of `Bar`...
2   --> $DIR/private-type-cycle-dyn-110629.rs:3:38
3    |
4 LL | type Bar<'a, 'b> = Box<dyn PartialEq<Bar<'a, 'b>>>;

5    |                                      ^^^^^^^^^^^
-    |
-    = note: ...which immediately requires expanding type alias `Bar` again
-    = note: type aliases cannot be recursive
-    = help: consider using a struct, enum, or union instead to break the cycle
-    = help: see <https://doc.rust-lang.org/reference/types.html#recursive-types> for more information
+    = note: ...which again requires expanding type alias `Bar`, completing the cycle
11 note: cycle used when checking that `Bar` is well-formed
12   --> $DIR/private-type-cycle-dyn-110629.rs:3:1
13    |

Note: some mismatched output was normalized before being compared
-   --> /checkout/tests/rustdoc-ui/private-type-cycle-dyn-110629.rs:3:1
+   --> $DIR/private-type-cycle-dyn-110629.rs:3:1
+    |
+ LL | type Bar<'a, 'b> = Box<dyn PartialEq<Bar<'a, 'b>>>;
+    | ^^^^^^^^^^^^^^^^
+    |
+ note: ...which requires computing type and type-dependent definitions of `Bar`...
+    = note: ...which again requires expanding type alias `Bar`, completing the cycle


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args private-type-cycle-dyn-110629.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustdoc" "/checkout/tests/rustdoc-ui/private-type-cycle-dyn-110629.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-o" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/rustdoc-ui/private-type-cycle-dyn-110629" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Cdebuginfo=0"
stdout: none
--- stderr -------------------------------
error[E0391]: cycle detected when expanding type alias `Bar`
##[error]  --> /checkout/tests/rustdoc-ui/private-type-cycle-dyn-110629.rs:3:1
   |
LL | type Bar<'a, 'b> = Box<dyn PartialEq<Bar<'a, 'b>>>;
   | ^^^^^^^^^^^^^^^^
   |
note: ...which requires computing type and type-dependent definitions of `Bar`...
  --> /checkout/tests/rustdoc-ui/private-type-cycle-dyn-110629.rs:3:38
   |
LL | type Bar<'a, 'b> = Box<dyn PartialEq<Bar<'a, 'b>>>;
   |                                      ^^^^^^^^^^^
   = note: ...which again requires expanding type alias `Bar`, completing the cycle
note: cycle used when checking that `Bar` is well-formed
  --> /checkout/tests/rustdoc-ui/private-type-cycle-dyn-110629.rs:3:1
   |
LL | type Bar<'a, 'b> = Box<dyn PartialEq<Bar<'a, 'b>>>;
   | ^^^^^^^^^^^^^^^^
   = 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

error: aborting due to 1 previous error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

4 participants