@@ -66,13 +66,71 @@ Let's look at some of the biggest plans in each of these categories.
66
66
67
67
#### Doubling down: infrastructure investments
68
68
69
- ** Crater** .
70
-
71
- ** Incremental compilation** . [ MIR] [ mir ]
69
+ ** Crater** . One of our big goals with Rust is that upgrades between
70
+ versions should be "hassle-free". An important part of this story is
71
+ detecting compiler bugs that cause code to stop working. Naturally,
72
+ the compiler has its own large test suite, but that is only a small
73
+ fraction of the code that's out there "in the wild". [ Crater] is a
74
+ tool that aims to close that gap by testing the compiler against all
75
+ the packages found in [ crates.io] , giving us a much better idea
76
+ whether any code has stopped compiling recently.
77
+
78
+ We've been using the current version of crater for some time. For
79
+ example, we regularly compare the nightly release against the latest
80
+ stable build. We also use crater to check in-progress branches and
81
+ estimate the impact of a change.
82
+
83
+ Interestingly, we have often found that when code stops compiling,
84
+ it's not because of a bug in the compiler. Rather, it's because we
85
+ * fixed* a bug, and that code happened to be relying on the older
86
+ behavior. Even in those cases, using crater lets us improve the
87
+ experience. For example, for changes that affect a lot of projects,
88
+ we've often chosen to phase in the change gradually. In such cases, we
89
+ issue one release where users get warnings, and only start issuing
90
+ errors on the next release, giving people time to migrate their code.
91
+
92
+ Over the next year or so, we plan to improve crater in numerous ways.
93
+ For example, we'd like to extend the coverage to other platforms (not
94
+ just linux). We'd also like to make it smoother to use, and include
95
+ code from other sources beyond [ crates.io] .
96
+
97
+ [ Crater ] : https://github.com/brson/taskcluster-crater
98
+
99
+ ** Incremental compilation** . Rust has always had a "crate-wide"
100
+ compilation model. This means that the Rust compiler reads in all of
101
+ the source files in your crate at once. These are type-checked and
102
+ then given to LLVM for optimization. This approach is really great for
103
+ doing deep optimization, because it gives LLVM full access to the
104
+ entire set of code, allowing for more better inlining, more precise
105
+ analysis, and so forth. However, it can mean that turnaround is slow:
106
+ even if you only edit one function, we will recompile everything. When
107
+ projects get large, this can be a burden.
108
+
109
+ The incremental compilation project aims to change this by having the
110
+ Rust compiler save intermediate by-products and re-use them. This way,
111
+ when you're debugging a problem, or tweaking a code path, you only
112
+ have to recompile those things that you have changed, which should
113
+ make the "edit-compile-test" cycle much faster.
114
+
115
+ Part of this project is restructuring the compiler to introduce a new
116
+ intermediate representation, which we call [ MIR] [ mir ] . MIR is a kind
117
+ of simplified form of Rust code that hides a lot of the details from
118
+ full Rust. This is a crucial enabler for language changes like
119
+ non-lexical lifetimes (discussing in the next section).
72
120
73
121
[ mir ] : https://github.com/rust-lang/rfcs/pull/1211
74
122
75
- ** IDE integration** .
123
+ ** IDE integration** . Top-notch IDE support can help to make Rust even
124
+ more productive. Up until now, pioneering projects like
125
+ [ Racer] [ racer ] , [ Visual Rust] [ visualrust ] , and [ Rust DT] [ rustdt ] have
126
+ been working largely without compiler support. We intend to extend the
127
+ compiler to permit deeper integration; the plan is to focus initially
128
+ on two IDEs, and then grow from there.
129
+
130
+ [ syntax highlighting ] : https://github.com/rust-lang/rust/blob/master/src/etc/CONFIGS.md
131
+ [ racer ] : https://github.com/phildawes/racer
132
+ [ visualrust ] : https://github.com/PistonDevelopers/VisualRust
133
+ [ rustdt ] : https://github.com/RustDT/RustDT
76
134
77
135
#### Zeroing in: closing key gaps in our features
78
136
@@ -117,7 +175,7 @@ match map.find(&key) {
117
175
Some (... ) => { ... }
118
176
None => {
119
177
map . insert (key , new_value );
120
- }
178
+ }
121
179
}
122
180
~~~~
123
181
@@ -143,16 +201,49 @@ macro expansion as well.
143
201
144
202
#### Branching out: taking Rust to new places
145
203
146
- ** Cross-compilation** .
147
-
148
- ** Cargo install** . [ RFC] [ cargoinstall ]
149
-
150
- [ cargoinstall ] : https://github.com/rust-lang/rfcs/pull/1200
151
-
152
- ** Tracing hooks** . One of the most promising way of using Rust is by "embedding"
153
- Rust code into systems written in higher-level languages like [ Ruby] [ skylight ]
154
- or Python. This embedding is usually done by giving the Rust code a C API, and
155
- works reasonably well when the target sports a "C friendly" memory management
156
- scheme like reference counting or conservative GC.
204
+ ** Cross-compilation** . While cross-compiling with Rust is possible
205
+ today, it involves a lot of manual configuration. We're shooting to
206
+ make it a streamlined, simple process. The idea is that compiling Rust code
207
+ for another target should be easy:
208
+
209
+ 1 . Download a precompiled version of ` libstd ` for the target in question,
210
+ if you don't already have it.
211
+ 2 . Execute ` cargo build --target=foo ` .
212
+ 3 . There is no step 3.
213
+
214
+ ** Cargo install** . Cargo and [ crates.io] is a really great tool for
215
+ distributing libaries, but it lacks any means to install executables.
216
+ [ RFC 1200] describes a simple addition to cargo, the ` cargo install `
217
+ command. Much like the conventional ` make install ` , ` cargo install `
218
+ will place an executable in your path so that you can run it. This can
219
+ serve as a simple distribution channel, and is particularly useful for
220
+ people writing tools that target Rust developers (who are likely to be
221
+ familiar with running cargo).
222
+
223
+ [ RFC 1200 ] : https://github.com/rust-lang/rfcs/pull/1200
224
+
225
+ ** Tracing hooks** . One of the most promising way of using Rust is by
226
+ "embedding" Rust code into systems written in higher-level languages
227
+ like [ Ruby] [ skylight ] or Python. This embedding is usually done by
228
+ giving the Rust code a C API, and works reasonably well when the
229
+ target sports a "C friendly" memory management scheme like reference
230
+ counting or conservative GC. However, integrating with an environment
231
+ that uses a more advanced GC can be quite challenging. Perhaps the
232
+ most prominent examples are JavaScript engines like V8 (used by
233
+ [ node.js] ) and SpiderMonkey (used by [ Firefox] and
234
+ [ Servo] ). Integrating with those engines requires very careful coding
235
+ to ensure that all objects are properly rooted; small mistakes can
236
+ easily lead to crashes. These are precisely the kind of memory
237
+ management problems that Rust is intended to eliminate. To address
238
+ this gap, we plan to extend the compiler with the ability to generate
239
+ "trace hooks". These hooks can be used by a GC to sweep the stack and
240
+ identify roots, making it possible to write code that integrates with
241
+ advanced VMs smoothly and easily. Naturally, the design will respect
242
+ Rust's "pay for what you use" policy, so that code which does not
243
+ integrate with a GC is unaffected.
157
244
158
245
[ skylight ] : http://blog.skylight.io/bending-the-curve-writing-safe-fast-native-gems-with-rust/
246
+ [ crates.io ] : https://crates.io
247
+ [ nodejs ] : https://nodejs.org/
248
+ [ Servo ] : https://github.com/servo/servo
249
+ [ Firefox ] : http://firefox.com/
0 commit comments