This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +56
-0
lines changed
src/doc/rustc-dev-guide/src Expand file tree Collapse file tree 2 files changed +56
-0
lines changed Original file line number Diff line number Diff line change 124124- [ rustc_driver and rustc_interface] ( ./rustc-driver/intro.md )
125125 - [ Example: Type checking] ( ./rustc-driver/interacting-with-the-ast.md )
126126 - [ Example: Getting diagnostics] ( ./rustc-driver/getting-diagnostics.md )
127+ - [ Remarks on perma-unstable features] ( ./rustc-driver/remarks-on-perma-unstable-features.md )
127128- [ Errors and Lints] ( diagnostics.md )
128129 - [ Diagnostic and subdiagnostic structs] ( ./diagnostics/diagnostic-structs.md )
129130 - [ Translation] ( ./diagnostics/translation.md )
Original file line number Diff line number Diff line change 1+
2+ # Remarks on perma unstable features
3+
4+ ## ` rustc_private `
5+
6+ ### Overview
7+
8+ The ` rustc_private ` feature allows external crates to use compiler internals.
9+
10+ ### Using ` rustc-private ` with Official Toolchains
11+
12+ When using the ` rustc_private ` feature with official Rust toolchains distributed via rustup, you need to install two additional components:
13+
14+ 1 . ** ` rustc-dev ` ** : Provides compiler libraries
15+ 2 . ** ` llvm-tools ` ** : Provides LLVM libraries required for linking
16+
17+ #### Installation Steps
18+
19+ Install both components using rustup:
20+
21+ ``` bash
22+ rustup component add rustc-dev llvm-tools
23+ ```
24+
25+ #### Common Error
26+
27+ Without the ` llvm-tools ` component, you'll encounter linking errors like:
28+
29+ ```
30+ error: linking with `cc` failed: exit status: 1
31+ |
32+ = note: rust-lld: error: unable to find library -lLLVM-{version}
33+ ```
34+
35+ ### Using ` rustc-private ` with Custom Toolchains
36+
37+ For custom-built toolchains or environments not using rustup, additional configuration is typically required:
38+
39+ #### Requirements
40+
41+ - LLVM libraries must be available in your system's library search paths
42+ - The LLVM version must match the one used to build your Rust toolchain
43+
44+ #### Troubleshooting Steps
45+
46+ 1 . ** Check LLVM installation** : Verify LLVM is installed and accessible
47+ 2 . ** Configure library paths** : You may need to set environment variables:
48+ ``` bash
49+ export LD_LIBRARY_PATH=/path/to/llvm/lib:$LD_LIBRARY_PATH
50+ ```
51+ 3 . ** Check version compatibility** : Ensure your LLVM version is compatible with your Rust toolchain
52+
53+ ### Additional Resources
54+
55+ - [ GitHub Issue #137421 ] ( https://github.com/rust-lang/rust/issues/137421 ) : Explains that ` rustc_private ` linker failures often occur because ` llvm-tools ` is not installed
You can’t perform that action at this time.
0 commit comments