+![Compiler Flowchart][flow]{:class="center"}
That is, we are introducing a new intermediate representation (IR) of
your program that we call **MIR**: MIR stands for *mid-level* IR, because
@@ -262,9 +260,7 @@ of that cycle.
Here is the running example from the previous section, expressed as a
control-flow graph:
-
-![Control-flow-graph][cfg]
-
+![Control-flow-graph][cfg]{:class="center"}
Building a control-flow graph is typically a first step for any kind
of flow-sensitive analysis. It's also a natural match for LLVM IR,
@@ -345,9 +341,7 @@ break:
Of course, the actual MIR is based on a control-flow-graph, so it
would look something like this:
-
-![Loop-break control-flow graph][loop-break]
-
+![Loop-break control-flow graph][loop-break]{:class="center"}
### Explicit drops and panics
@@ -394,18 +388,14 @@ control-flow-graph to show explicitly where the `iterator` value gets
freed. Take a look at the new graph, and in particular what happens
when a `None` variant is found:
-
-![Drop control-flow graph][drop]
-
+![Drop control-flow graph][drop]{:class="center"}
Here we see that, when the loop exits normally, we will drop the
iterator once it has finished. But what about if a panic occurs? Any
of the function calls we see here could panic, after all. To account
for that, we introduce panic edges into the graph:
-
-![Panic control-flow graph][drop-unwind]
-
+![Panic control-flow graph][drop-unwind]{:class="center"}
Here we have introduced `panic` edges onto each of the function
calls. By looking at these edges, you can see that if the call to
@@ -522,9 +512,7 @@ like the current overwriting semantics. So this means that the MIR for
`send_if` might look like this (for simplicity, I'll ignore unwinding
edges).
-
-![Non-zeroing drop example][nzd]
-
+![Non-zeroing drop example][nzd]{:class="center"}
We can then transform this graph by identifying each place where
`data` is moved or dropped and checking whether any of those places
@@ -532,9 +520,7 @@ can reach one another. In this case, the `send_to_other_thread(data)` block can
reach `drop(data)`. This indicates that we will need to introduce a
flag, which can be done rather mechanically:
-
-![Non-zeroing drop with flags][nzd-flags]
-
+![Non-zeroing drop with flags][nzd-flags]{:class="center"}
Finally, we can apply standard compiler techniques to optimize this
flag (but in this case, the flag is needed, and so the final result
@@ -558,26 +544,20 @@ fn send_if2(data: Vec) {
This would generate MIR like:
-
-![Control-flow graph for send_if2][send_if2]
-
+![Control-flow graph for send_if2][send_if2]{:class="center"}
As before, we still generate the drops of `data` in all cases, at
least to start. Since there are still moves that can later reach a
drop, we could now introduce a stack flag variable, just as before:
-
-![send_if2 with flags][send_if2-flags]
-
+![send_if2 with flags][send_if2-flags]{:class="center"}
But in this case, if we apply constant propagation, we can see that at
each point where we test `data_is_owned`, we know statically whether
it is true or false, which would allow us to remove the stack flag and
optimize the graph above, yielding this result:
-
-![Optimized send_if2][send_if2-opt]
-
+![Optimized send_if2][send_if2-opt]{:class="center"}
### Conclusion
diff --git a/_posts/2016-06-30-State-of-Rust-Survey-2016.md b/_posts/2016-06-30-State-of-Rust-Survey-2016.md
index 9a08d6674..0fa856ad3 100644
--- a/_posts/2016-06-30-State-of-Rust-Survey-2016.md
+++ b/_posts/2016-06-30-State-of-Rust-Survey-2016.md
@@ -14,17 +14,13 @@ We plan to run a similar survey each year to track how we're progressing and spo
We wanted to make sure the survey was open to both users of Rust and to people who didn't use Rust. Rust users give us a sense of how the current language and tools are working and where we need to improve. Rust non-users shed light on missing use-cases and obstacles for Rust’s adoption.
-
-![Do you use Rust][do-you-use-rust]
-
+![Do you use Rust][do-you-use-rust]{:class="center"}
We're happy to report that more than a third of the responses were from people not using Rust. These respondents gave a lot of great feedback on adoption roadblocks, which we'll talk about later in this blog post.
## Growing numbers trying Rust
-
-![Time using Rust][time-using-rust]
-
+![Time using Rust][time-using-rust]{:class="center"}
Almost 2,000 people responded saying they were Rust users. Of these, almost 24% were new users. This is encouraging to see. The community is growing, with a healthy portion of newcomers playing with Rust now that could become long-term users.
@@ -34,29 +30,21 @@ Equally encouraging is seeing that once someone has become a Rust user, they ten
We asked a number of questions trying to get a clear picture of what it's like to use Rust today. The first questions focused on the Rust compiler.
-
-![Versions of Rust you use][versions-of-rust]
-
+![Versions of Rust you use][versions-of-rust]{:class="center"}
In the above chart, you see the top five rustc version combinations for users writing Rust. At the time of the survey, version 1.8 was the latest stable release. This factors strongly in the results as the most popular version of Rust to use. Perhaps surprisingly is how much the nightly also plays a key role in for many developers, with over 400 using it as their only Rust compiler version. Stabilizing features and APIs, and thereby encouraging transition to the stable channel, continues to be a priority for the team.
-
-![Has an upgrade broken code][after_1_0_broke_code]
-
+![Has an upgrade broken code][after_1_0_broke_code]{:class="center"}
In the pre-1.0 days, Rust releases would regularly break user's code. In reaching 1.0, we began releasing versions that maintained backwards compatibility with 1.0. For stable Rust, 83.6% of users did not experience any breakage in their project as they upgraded to the next stable version. Previous research based on automated testing against the ecosystem put this number [closer to 96%](https://internals.rust-lang.org/t/rust-regressions-2015-year-end-report/2993), which is more in line with expectations.
Why the discrepancy? Looking at the data more closely, it seems people used this question as a catch-all for any kind of breakage, including packages in cargo, compiler plugins needing updates, and the changes to libc. We'll be sure to word this question more clearly in the future. But we also plan to launch a forum discussion digging further into the details, to make sure that there’s not something missing from the test automation that runs against crates.io.
-
-![Fixing broken code][easy_to_fix]
-
+![Fixing broken code][easy_to_fix]{:class="center"}
Luckily, regardless of what bucket the breakage fell into, they were largely easy to solve as people upgraded.
-
-![Do you like Cargo][like_cargo]
-
+![Do you like Cargo][like_cargo]{:class="center"}
Another big piece of the Rust development experience is using the Cargo tool. Here we saw overwhelming support for Cargo, with 94.1% of people saying they would rate it a 4 or 5. This helps to emphasize that Cargo continues to be a core part of what it means to write Rust (and that people enjoy using it!)
@@ -64,35 +52,25 @@ Another big piece of the Rust development experience is using the Cargo tool. H
An important part of a programming language's success is that it's used for "real" work. We asked a few questions to understand how Rust was doing in the workplace. Were people using it in their day jobs? How much was it being used?
-
-![Using Rust at work][rust_at_work]
-
+![Using Rust at work][rust_at_work]{:class="center"}
We were pleasantly surprised to see that already, in Rust's first year, 16.1% of Rust users are using Rust at work part-time and 3.7% are using at work full-time. Combined, **nearly 1/5th of Rust users are using Rust commercially**. We're seeing this reflected in the growing number of [companies using Rust](https://www.rust-lang.org/friends.html).
We also asked about the size of the codebases that Rust developers were building.
-
-![Size of part-time codebases][part_time]
-
+![Size of part-time codebases][part_time]{:class="center"}
-
-![Size of full-time codebases][full_time]
-
+![Size of full-time codebases][full_time]{:class="center"}
We see strong numbers in project size as developers put more time into Rust at work. Over half of the Rust users using Rust full-time at work have codebases that are tens or hundreds of thousands of lines of code.
Equally encouraging is the growth we expect to see in Rust in the workplace, as we see in the next chart.
-
-![Using Rust at work in future][rust_at_work_future]
-
+![Using Rust at work in future][rust_at_work_future]{:class="center"}
Of those not currently using Rust at work, more than 40% plan on being able to use Rust at work. This will help carry Rust to more places and in more areas. Speaking of carrying to more areas, we saw a wide variety of job domains represented in the survey:
-
-![Demographics of work areas][demo_areas]
-
+![Demographics of work areas][demo_areas]{:class="center"}
It's encouraging to see people from so many different backgrounds interested in Rust. It underscores Rust’s potential across a broad spectrum of programming tasks and the need for libraries to support these areas.
@@ -150,23 +128,17 @@ We've also been investing in other tooling muscles, including a [new installer w
## Survey Demographics
-
-![Popular meetup locations][meetup_locations]
-
+![Popular meetup locations][meetup_locations]{:class="center"}
Today, Rust has a worldwide audience. Rather than being lumped in one place, we see Rust users in Europe, Japan, Australia, with new meetups popping up everyday. We also asked where people who responded lived, and over 1000 of the 3000 survey responses mentioned living in Europe (with USA following it up at 835).
-
-![Demographics on programming language background][what_languages]
-
+![Demographics on programming language background][what_languages]{:class="center"}
The parents of most modern languages, C and C++, show strongly in terms of the programming languages that people are most comfortable with. Close by are Java and JavaScript. Perhaps one surprising point here is the large number of Python users attracted to Rust.
For those who already have existing projects in other languages but want to use Rust, it's worth mentioning here the on-going efforts to aide in using Rust with other languages, including work to [integrate with Ruby](https://github.com/rustbridge/helix) and [integrate with JavaScript/Node.js](https://github.com/rustbridge/neon).
-
-![Members of underrepresented groups][underrepresented]
-
+![Members of underrepresented groups][underrepresented]{:class="center"}
Rust strives to be a [warm, welcoming and inclusive community](https://www.rust-lang.org/conduct.html). The survey shows that, despite that spirit, we have a ways to go in terms of diversity. We have nascent efforts, like [RustBridge](https://github.com/rust-community/rustbridge), to more proactively reach out to underrepresented groups and make Rust more accessible, but there is a lot more work to be done. We'll be watching the results of this part of the survey closely and continue to invest in outreach, mentoring, and leadership to foster inclusivity.
diff --git a/css/center-img.css b/css/center-img.css
new file mode 100644
index 000000000..8715bfa3b
--- /dev/null
+++ b/css/center-img.css
@@ -0,0 +1,5 @@
+.center {
+ display: block;
+ margin-left: auto;
+ margin-right: auto;
+}