TypeId constant in patterns has confusing error message
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
- 48/100
Hướng nghiên cứu
Start with the pattern-matching diagnostic path and the related pull request #166205 mentioned in the issue. Reproduce the example with the reported nightly compiler, then trace why matching the TypeId constant produces the raw-pointer unpredictability error instead of a StructuralPartialEq error. Done when the diagnostic reports the expected reason and relevant compiler tests cover the case.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I tried this code:
use std::any::TypeId;
const abc: TypeId = TypeId::of::<i32>();
fn main() {
match TypeId::of::<i32>() {
abc => {},
_ => {},
}
}
I expected to see this happen: It gives an error mentioning that TypeId is not StructuralPartialEq
Instead, this happened: I get an error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon
Meta
rustc --version --verbose:
rustc 1.102.0-nightly (5df8c02af 2026-11-16)
binary: rustc
commit-hash: 5df8c02afdf6b882bc301442cea70f026e3d3974
commit-date: 2026-11-16
host: x86_64-unknown-linux-gnu
release: 1.102.0-nightly
LLVM version: 23.1.5
From what I can tell, it seems to think that TypeId is a function pointer, but not other structs. Not related to the provenience either as copying the data field from TypeId into a local struct doesn't reproduce. I was told that this issue may be relevant as well.
- Ngôn ngữ chính
- Rust
- Star
- 123k
- Fork
- 16.6k
- Merge trung bình
- 2 ngày 17 giờ
- Pull request đã merge (30 ngày)
- 532
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của rust-lang/rust
-
strictly_dominates missing a `=`Đang mởC-bug needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
rust-lang/rust#166722 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
A-attributes relnotes relnotes-needs-review relnotes-tracking-issue T-compiler T-lang
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
A-run-make C-bug T-bootstrap
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Tracking issue for release notes of #161531: Remove `T: Send + Sync` bound from `Arc::downcast`Đang mởrelnotes relnotes-tracking-issue T-libs
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
A-str A-Unicode relnotes relnotes-tracking-issue T-libs
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của rust-lang/rust
Issue tương tự
-
bug P2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Windows microphone listing treats words in a device name as DirectShow labelsCó thể đã có người làm @Sujal-chaudhary đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
clipy-recorder/clipy#447 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
nightly-cleanup
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
max-sixty/worktrunk#4939 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Flaky Test] tests::signer::v0::miner_recovers_when_broadcast_block_delay_across_tenures_occursĐang mởflaky
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
stacks-network/stacks-core#7918 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày