Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

$ cat ~/.profile GIT_AUTHOR_NAME=Florian Gilcher GIT_AUTHOR_EMAIL=florian.gilcher@asquera.de TWITTER_HANDLE=argorak GITHUB_HANDLE=skade BLOG=skade.me YAKS=yakshav.es

Slide 3

Slide 3 text

• Rust and Elasticsearch Trainer • Event organiser • Ruby Programmer since 2003 • Rust Programmer since 2013 • CEO asquera GmbH / rust- experts.com

Slide 4

Slide 4 text

• RustFest • Part of the global Rust community team • Leadership events team

Slide 5

Slide 5 text

As a hobby, I shoot arrows at stuff

Slide 6

Slide 6 text

I’m in management of a programming language.

Slide 7

Slide 7 text

Whatever that means.

Slide 8

Slide 8 text

Three Years of Rust

Slide 9

Slide 9 text

What is Rust?

Slide 10

Slide 10 text

• new systems programming language • powers and was developed in along with Servo, a new browser engine • by Mozilla and the Community • First stable release May 15th, 2015

Slide 11

Slide 11 text

Providing an alternative to C/C++, but also higher-level languages.

Slide 12

Slide 12 text

• Safe • Concurrent • Fast

Slide 13

Slide 13 text

It’s generally perceived that safety, especially memory-safety comes at a runtime cost.

Slide 14

Slide 14 text

• Safe • Concurrent • Fast

Slide 15

Slide 15 text

Pick Three

Slide 16

Slide 16 text

Core features

Slide 17

Slide 17 text

• Static type system with local type inference • Explicit mutability • Zero-cost abstractions • Runtime-independent concurrency safety

Slide 18

Slide 18 text

• Errors are values • No null • Static automatic memory manage- ment • No garbage collection

Slide 19

Slide 19 text

extern crate tempdir; use tempdir::*; use std::fs::File; fn main() { let tempdir = TempDir::new("accu"); let mut tempfile = match tempdir { Ok(dir) => { File::create( dir.path().join("tmpfile") ) } Err(_) => { panic!("Couldn’t open tempdir") } } do_something(&mut tempfile); // look, no close necessary! }

Slide 20

Slide 20 text

Base concept: Mutability

Slide 21

Slide 21 text

struct InnerData { val: i32 } struct Data { inner: InnerData } fn main() { let d = Data { inner: InnerData { val: 41 }}; d.inner.val = 42; // error: cannot assign to immutable field `d.inner.val` }

Slide 22

Slide 22 text

struct InnerData { val: i32 } struct Data { inner: InnerData } fn main() { let mut d = Data { inner: InnerData { val: 41 }}; d.inner.val = 42; }

Slide 23

Slide 23 text

Base concept: Ownership & Borrowing

Slide 24

Slide 24 text

• Every piece of data is uniquely owned • Ownership can be passed • When owned data reaches the end of a scope, it is destructed

Slide 25

Slide 25 text

use std::fs::File; use std::io::Write; fn main() { let file = File::open("test") .expect("Unable to open file, bailing!"); take_and_write_to_file(file); // take_and_write_to_file(file); // ^^ Illegal } fn take_and_write_to_file(mut file: File) { writeln!(file, "{}", "Hello #accuconf!"); }

Slide 26

Slide 26 text

• Access can be borrowed (mutable and immutable) • You can borrow mutably once • Or multiple times immutably • Exclusive: mutable or immutable, never both

Slide 27

Slide 27 text

use std::fs::File; use std::io::Write; fn main() { let mut file = File::open("test") .expect("Unable to open file, bailing!"); write_to_file(&mut file); write_to_file(&mut file); } fn write_to_file(file: &mut File) { writeln!(file, "{}", "Hello #gotober!"); }

Slide 28

Slide 28 text

Shared mutable state is an issue even single-threaded applications!

Slide 29

Slide 29 text

fn main() { let mut vector = vec![1,2,3]; let elem = &vector[1]; vector[2] = 4; }

Slide 30

Slide 30 text

error[E0502]: cannot borrow `vector` as mutable –> src/main.rs:4:5 | 3 | let elem = &vector[1]; | —— immutable borrow occurs h 4 | vector[2] = 4; | ^^^^^^ mutable borrow occurs here 5 | } | - immutable borrow ends here

Slide 31

Slide 31 text

Rust checks validity of all references at compile-time.

Slide 32

Slide 32 text

struct Data<’a> { inner: &’a i32 } fn return_reference<’a>() -> Data<’a> { let number = 4; Data { inner: &number } }

Slide 33

Slide 33 text

–> src/main.rs:8:20 | 8 | Data { inner: &number } | ^^^^^^ does not live long 9 | } | - borrowed value only lives until here |

Slide 34

Slide 34 text

All Rust function signatures not only signal data types, but also mutability, ownership and interconnections between input and output types.

Slide 35

Slide 35 text

100, 1000, 10.000 lines of called code, Rust keeps these properties!

Slide 36

Slide 36 text

Abstractions Rust provides higher-level abstractions through Generics and Traits, similar to C++ Templates or Java Generics.

Slide 37

Slide 37 text

Concurrency without fear

Slide 38

Slide 38 text

let counter = Counter { count: 0 }; for _ in 1..3 { std::thread::spawn(move || { increment(&mut counter); // capture of moved value: `counter` }); }

Slide 39

Slide 39 text

use std::rc::Rc; let rc = Rc::new(Counter { count: 0 }); for _ in 1..3 { let handle = rc.clone(); std::thread::spawn(move || { // `std::rc::Rc` cannot be sent between threads safely increment(&mut handle); }); }

Slide 40

Slide 40 text

use std::sync::{Arc,Mutex}; let rc = Arc::new(Mutex::new(Counter { count: 0 })); for _ in 1..3 { let handle = rc.clone(); std::thread::spawn(move || { increment(&mut handle); }); }

Slide 41

Slide 41 text

2015: Finally done!

Slide 42

Slide 42 text

Before Release

Slide 43

Slide 43 text

Removal of a lot of features: • All Runtime • stdlib trimming • Garbage collector • Error handling

Slide 44

Slide 44 text

Coming up with ergonomics and tooling around everything.

Slide 45

Slide 45 text

RFC process Rust has an RFC process under rust-lang/rfcs on GitHub. All language changes have to go through that.

Slide 46

Slide 46 text

Release: May 15th

Slide 47

Slide 47 text

The package

Slide 48

Slide 48 text

rustc The compiler, based on the LLVM.

Slide 49

Slide 49 text

Cargo A build and dependency management tool, along with a registry.

Slide 50

Slide 50 text

rustup A toolchain manager, covering the ability to run things side by side.

Slide 51

Slide 51 text

rustdoc A documentation tool, complete with API search and doc testing.

Slide 52

Slide 52 text

A book The Rust programming language, first edition.

Slide 53

Slide 53 text

Compatibility tooling • rust-gdb • vim plugin • VSCode Plugin

Slide 54

Slide 54 text

Interesting aspect The whole toolchain is cross-compile aware. This is hard to retrofit.

Slide 55

Slide 55 text

Release cycle • Nightly releases • All 6 weeks, nightly is promoted to beta • After 6 weeks, beta is promoted to stable

Slide 56

Slide 56 text

Stability Rust is backwards-compatibile, the stable compiler only exposes the stable interface. CLI interfaces are considered interface.

Slide 57

Slide 57 text

Project management • Anti-Benevolent Dictator For Life • Core is a tie-breaker, not much more • Most contributions are from non- Mozillians (75/100) • Rust had close to 1000 contributors in 2015

Slide 58

Slide 58 text

Teams Rust grows teams on need.

Slide 59

Slide 59 text

Initial teams Core, Infra, Language, Library, Compiler, Documentation, Community, Moderation

Slide 60

Slide 60 text

This raises awareness of peoples work and makes them addressable.

Slide 61

Slide 61 text

Low-friction community interaction • A meetup calendar • This week in Rust Newsletter • community@rust-lang.org • Forums/IRC channels

Slide 62

Slide 62 text

Low-friction contribution People want to contribute! But most projects have no tasks for people that just have 5 minutes at a time!

Slide 63

Slide 63 text

Avoid lingering tasks!

Slide 64

Slide 64 text

Conversational tone Friendly and focused, not very bikesheddy, non-insulting.

Slide 65

Slide 65 text

Stating issues is great, just be realistic about the fixes.

Slide 66

Slide 66 text

Being grumpy or in general stern is completely fine!

Slide 67

Slide 67 text

Usability Rust was a usable contenter in the systems programming space back then, but a lot of things were missing, notably: libraries.

Slide 68

Slide 68 text

Conclusions • Good tooling early helps • Establishing a productive environ- ment is work • Non-programming work is a sub- stantial amount • Credit it!

Slide 69

Slide 69 text

2016: Finding Adoption

Slide 70

Slide 70 text

Gathering Data

Slide 71

Slide 71 text

Survey We ran a users survey with 3000 respondents. • 20 percent of all users were using Rust at work • Half of them in projects over 10k LoC

Slide 72

Slide 72 text

Demographics Rustaceans are coming in equal parts from: • Dynamic languages • Classic systems programming • Functional programming

Slide 73

Slide 73 text

Demographics Rusts community is based in Europe! Other huge groups include China, Russia and India.

Slide 74

Slide 74 text

Production user survey We conducted a production users survey. Feedback was good, especially for reliability. Pain points were as expected.

Slide 75

Slide 75 text

Production uses • Alternative to plain C • Language to write shared libraries in • For heavily concurrent code, such as servers

Slide 76

Slide 76 text

Projects are rarely fully Rust, but important parts are!

Slide 77

Slide 77 text

Production user problems • Library maturity • Tooling maturity

Slide 78

Slide 78 text

People having problems with what’s not there is better then problems with things that are there!

Slide 79

Slide 79 text

Especially businesses are very aware of context!

Slide 80

Slide 80 text

Production user liaison Production users get support on compiler-related things.

Slide 81

Slide 81 text

The friends page https://www.rust-lang.org/friends.html

Slide 82

Slide 82 text

Users • Mozilla • Dropbox • Chucklefish • Chef • NPM • Schauspiel Dortmund

Slide 83

Slide 83 text

and over 100 other companies

Slide 84

Slide 84 text

How do we compare to others? We don’t know.

Slide 85

Slide 85 text

Integrating people • Our default meetup type is "Hack and Learn" • Quick review times for patches • Helping out where we can

Slide 86

Slide 86 text

Integrate people into the project quickly.

Slide 87

Slide 87 text

Conferences • RustFest (Europe, every half year) • RustConf (US, every year) • Rust Belt Rust (US, every year)

Slide 88

Slide 88 text

Community-run, community sponsored.

Slide 89

Slide 89 text

Support people online • We’re on youtube: /c/rustvideos • Twitter: twitter.com/rustlang • We tried running a global Hackfest • The Rust community loves to write

Slide 90

Slide 90 text

Conclusions • Social media isn’t a bad word • Actively speaking is better then waiting • Your bugtracker is only half of the story • A solid base is better then a lot of half-solutions

Slide 91

Slide 91 text

2017: Growing pains

Slide 92

Slide 92 text

Survey 5500 Respondents.

Slide 93

Slide 93 text

Stability • Over 90 percent never had upgrade problems • Almost everyone uses our tooling • People rate the tooling favourably

Slide 94

Slide 94 text

Community • 99 percent of people have no issue with the community • 75 percent see the community favourably

Slide 95

Slide 95 text

Are those numbers good? We don’t know. There’s no comparisons.

Slide 96

Slide 96 text

We don’t know Rust Producing a language doesn’t mean you won’t discover things yourself.

Slide 97

Slide 97 text

• New API practices are beginning to form. • How do include Rust into other projects becomes a main question!

Slide 98

Slide 98 text

New patterns coming up

Slide 99

Slide 99 text

Ownership is useful beyond pure memory safety: • Used to model statemachines • Used to model device driver mem- ory • Extremely useful in concurrency • "Who’s owning that" is a common programming problem

Slide 100

Slide 100 text

Realisations Ownership is a vastly more important feature then borrowing in Rust.

Slide 101

Slide 101 text

The book The book needed to be rewritten. Welcome second edition!

Slide 102

Slide 102 text

Direction Which areas should we focus on? Are we even solving useful problems?

Slide 103

Slide 103 text

Hobbyist problems aren’t production user problems!

Slide 104

Slide 104 text

Release cycle review The release cycle worked well. We only botched one release (1.14), hit no larger issues. It’s a benefit to users, changes are consumable.

Slide 105

Slide 105 text

Rust is becoming a practices leader • Other languages adopt the commu- nity interaction model (NodeJS) • Other products and languages adopt our RFC process (Ember, Swift) • Our management model is taken interest in

Slide 106

Slide 106 text

RFC process problems Volume brings issues! • People with too much time swamp the process • People with no time can’t follow along and feel excluded • Non-english speakers have issues to follow

Slide 107

Slide 107 text

Usage in Firefox Rust finally got adopted into Firefox on large scale, the CSS styling engine is now powered by Rust!

Slide 108

Slide 108 text

No content

Slide 109

Slide 109 text

Conclusions • Have a sense of accomplishment sometimes • Programming languages are ex- tremely complex, even to the pro- ducers • Identify issues early

Slide 110

Slide 110 text

2018: The Future is unwritten

Slide 111

Slide 111 text

Rust2018 campaign A blogging campaign over January. People were encouraged write down their wishes for next year.

Slide 112

Slide 112 text

Results 100 blog posts or essays. readrust.net

Slide 113

Slide 113 text

StackOverflow most loved language Third time in a row. Why?

Slide 114

Slide 114 text

We generate and manage Buzz Buzz is a great thing if you can back it with actual technology.

Slide 115

Slide 115 text

People follow the Buzz and find something!

Slide 116

Slide 116 text

Teams 17 teams, over 100 people.

Slide 117

Slide 117 text

Community team split • RustBridge • Events team • Content team • Switchboard team More then 20 people!

Slide 118

Slide 118 text

Teaching Rust Teaching programming remains a problem. There’s not much hard data!

Slide 119

Slide 119 text

Goals for this year • Stable story for bare metal embed- ded • Promoting our rock-solid network- ing story • WASM

Slide 120

Slide 120 text

• Shipping language ergonomics around async/await and boilerplate ("Rust 2018") • Have a conference on every conti- nent by 2019 • Make people aware that we are adopted!

Slide 121

Slide 121 text

Conclusions • Rework your organisation regularly • Change your approaches along with it! • See what it unlocks

Slide 122

Slide 122 text

Large, quality projects without a benevolent dictator are there and work. They just don’t make much noise!

Slide 123

Slide 123 text

Thanks The LLVM project, the Ruby, Python, Mozilla and JavaScript communities. We apply your work.