import_trait_associated_functions: query cycle / `internal compiler error: query cycle when printing cycle detected`

オープン
#166,000 コメント 0 件 リアクション 1 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
rust
領域
compilers

調査の方向性

Start by building the minimized reproduction from the issue body and confirming the cycle with RUSTC_LOG or -Z query-dep-graph-style tracing; the query stack names the loop: getting owner for Test::Type -> lowering HIR -> resolving type relative delegations -> AST lowering -> lints. Read the rustc-dev-guide chapters on queries and the rustc_resolve type-relative path resolution, then find where pub use Test::Type (under #![feature(import_trait_associated_functions)]) triggers resolution before the owner/HIR is available. Done means the snippet either compiles or errors cleanly, with a regression test under tests/ui/.

索引モデルが issue の本文から書いたものです。

説明

C-bug F-import_trait_associated_functions I-cycle T-compiler

original:

#![feature(import_trait_associated_functions)]
trait Test {
    type Type;
}
pub use Test::Type;

fn main() {}

Version information

rustc 1.102.0-nightly (5f4effd57 2026-11-13)
binary: rustc
commit-hash: 5f4effd579500175af844241eb179e756190f1e7
commit-date: 2026-11-13
host: x86_64-unknown-linux-gnu
release: 1.102.0-nightly
LLVM version: 23.1.5

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

`--edition` is unspecified, defaulting to `2015` while the latest is `2024`; it must be one of: <2015|2018|2021|2024|future>

error: internal compiler error: query cycle when printing cycle detected
 |
 = note: ...when getting owner for `Test::Type`
 = note: ...which requires lowering HIR for `Test::Type`...
 = note: ...which requires resolving type relative delegations...
 = note: ...which requires getting the AST for lowering...
 = note: ...which requires perform lints prior to AST lowering...
 = note: ...which requires looking up span for `Test::Type`...
 = note: ...which again requires getting owner for `Test::Type`, completing the cycle
 = note: cycle used when computing associated item data for `Test::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

error[E0391]: cycle detected when getting the resolver for lowering
 |
 = note: ...which requires computing associated item data for `Test::Type`...
 = note: ...which requires getting owner for `Test::Type`...
 = note: ...which requires lowering HIR for `Test::Type`...
 = note: ...which requires resolving type relative delegations...
 = note: ...which requires getting the AST for lowering...
 = note: ...which requires perform lints prior to AST lowering...
 = note: ...which again requires getting the resolver for lowering, completing the cycle
 = note: for more information, see <https://rustc-dev-guide.rust-lang.org/overview.html#queries> and <https://rustc-dev-guide.rust-lang.org/query.html>

error: aborting due to 2 previous errors

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

@rustbot label +F-import_trait_associated_functions

主要言語
Rust
スター
122k
フォーク
16.7k
平均マージ
2日 16時間
マージ済み PR(30日)
515

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

rust-lang/rust のほかの issue

rust-lang/rust の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。