rust-lang / rust-lang/rust

cargo gets stuck compiling nlist crate

Open
#148,076 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug I-hang needs-triage
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

cargo fails to compile the latest version of nlist. This happens because rustc gets stuck in rustc_trait_selection::traits::project::normalize_projection_term.

This only happens at opt-level 2 and only when inline-mir is enabled. It successfully compiles with the following command:

cargo +nightly rustc --release -- -Z inline-mir=no

I used perf to see where the compiler is getting stuck. The following is the relevant part of the perf report:

Samples: 120K of event 'cycles', Event count (approx.): 111444101575
  Children      Self  Command  Shared Object                        Symbol
+   79.78%    79.71%  rustc    librustc_driver-24ace9b62cb3ceb9.so  [.] rustc_trait_selection::traits::project::normalize_projection_term
+   42.68%     0.00%  rustc    [unknown]                            [.] 0000000000000000
+   20.22%    20.20%  rustc    librustc_driver-24ace9b62cb3ceb9.so  [.] <rustc_trait_selection::traits::normalize::AssocTypeNormalizer as rustc_type_ir::fold::TypeFolder<rustc_middle::ty::context::TyCtxt>>::fold_ty
+    5.93%     0.00%  rustc    [unknown]                            [.] 0x0000000e00000000
+    5.59%     0.00%  rustc    [unknown]                            [.] 0x00007f498ef69da0
+    5.49%     0.00%  rustc    [unknown]                            [.] 0x00007f498ef72010
+    5.37%     0.00%  rustc    [unknown]                            [k] 0x0000001f00000021
+    2.87%     0.00%  rustc    [unknown]                            [.] 0x00007f498ef71fd0
+    2.77%     0.00%  rustc    [unknown]                            [.] 0x0000001c00000000
+    2.67%     0.00%  rustc    [unknown]                            [.] 0x0000000000000001
+    1.45%     0.00%  rustc    [unknown]                            [.] 0x00007f498ef6bc20
+    1.40%     0.00%  rustc    [unknown]                            [.] 0x00007f4990d71158
+    1.37%     0.00%  rustc    [unknown]                            [.] 0x00007f4990658190
+    1.28%     0.00%  rustc    [unknown]                            [.] 0x00007f498ef62600
+    0.75%     0.00%  rustc    [unknown]                            [.] 0x00007f498ef6a830
+    0.70%     0.00%  rustc    [unknown]                            [.] 0x00007f498ef61210
+    0.67%     0.00%  rustc    [unknown]                            [.] 0x00007f498ef6d050
+    0.66%     0.00%  rustc    [unknown]                            [.] 0x0000000100000003
     0.39%     0.00%  rustc    [unknown]                            [.] 0x00007f498ef73ca0
     0.33%     0.00%  rustc    [unknown]                            [.] 0x000d2829ffffff01
     0.32%     0.00%  rustc    [unknown]                            [.] 0x00007f498ef69440

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the nlist build with cargo +nightly rustc --release at opt-level 2 and inline-mir enabled, then inspect the reported rustc_trait_selection::traits::project::normalize_projection_term path using the perf report as a guide. Done means the latest nlist version compiles without requiring -Z inline-mir=no.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.