File tree 3 files changed +40
-1
lines changed
3 files changed +40
-1
lines changed Original file line number Diff line number Diff line change 19
19
- [ Profiling the compiler] ( ./profiling.md )
20
20
- [ with the linux perf tool] ( ./profiling/with_perf.md )
21
21
- [ Coding conventions] ( ./conventions.md )
22
+ - [ crates.io Dependencies] ( ./crates-io.md )
22
23
23
24
---
24
25
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ rustc is slowly moving towards the [Rust standard coding style][fmt];
11
11
at the moment, however, it follows a rather more * chaotic* style. We
12
12
do have some mandatory formatting conventions, which are automatically
13
13
enforced by a script we affectionately call the "tidy" script. The
14
- tidy script runs automatically when you do ` ./x.py test ` and can be run
14
+ tidy script runs automatically when you do ` ./x.py test ` and can be run
15
15
in isolation with ` ./x.py test src/tools/tidy ` .
16
16
17
17
[ fmt ] : https://github.com/rust-lang-nursery/fmt-rfcs
@@ -133,3 +133,18 @@ require that every intermediate commit successfully builds – we only
133
133
expect to be able to bisect at a PR level. However, if you * can* make
134
134
individual commits build, that is always helpful.
135
135
136
+ # Naming conventions
137
+
138
+ Apart from normal Rust style/naming conventions, there are also some specific
139
+ to the compiler.
140
+
141
+ - ` cx ` tends to be short for "context" and is often used as a suffix. For
142
+ example, ` tcx ` is a common name for the [ Typing Context] [ tcx ] .
143
+
144
+ - [ ` 'tcx ` and ` 'gcx ` ] [ tcx ] are used as the lifetime names for the Typing
145
+ Context.
146
+
147
+ - Because ` crate ` is a keyword, if you need a variable to represent something
148
+ crate-related, often the spelling is changed to ` krate ` .
149
+
150
+ [ tcx ] : ./ty.md
Original file line number Diff line number Diff line change
1
+ # crates.io Dependencies
2
+
3
+ The rust compiler supports building with some dependencies from ` crates.io ` .
4
+ For example, ` log ` and ` env_logger ` come from ` crates.io ` .
5
+
6
+ In general, you should avoid adding dependencies to the compiler for several
7
+ reasons:
8
+
9
+ - The dependency may not be high quality or well-maintained, whereas we want
10
+ the compiler to be high-quality.
11
+ - The dependency may not be using a compatible license.
12
+ - The dependency may have transitive dependencies that have one of the above
13
+ problems.
14
+
15
+ TODO: what is the vetting process?
16
+
17
+ ## Whitelist
18
+
19
+ The ` tidy ` tool has a [ whitelist] of crates that are allowed. To add a
20
+ dependency that is not already in the compiler, you will need to add it to this
21
+ whitelist.
22
+
23
+ [ whitelist ] : https://github.com/rust-lang/rust/blob/659994627234ce7d95a1a52ad8756ce661059adf/src/tools/tidy/src/deps.rs#L56
You can’t perform that action at this time.
0 commit comments