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

Đang mở
#166,000 0 bình luận 1 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust
Lĩnh vực
compilers

Hướng nghiên cứu

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/.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
Rust
Star
122k
Fork
16.7k
Merge trung bình
2 ngày 16 giờ
Pull request đã merge (30 ngày)
515

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của rust-lang/rust

Tất cả issue của rust-lang/rust

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.