►
From YouTube: Valentin Goşu - Oxidation - How We Got Rust Code into Firefox (Rust Hungary #3, 2017-11-23)
Description
Valentin Gosu will show us how it all started, how the first bits of Rust landed in Firefox and the monumental work that led up to Rust components shipping in the live production version of the newest Firefox for anyone out there to see.
Slides: https://slides.com/valentingosu/oxidation-budapest-2017
[Rust Hungary Meetup #3, 2017-11-23, Mozilla Hungary Community Space, Budapest]
http://rust-lang.hu/posts/2017-11-22/meetup-03-rust-hungary.en.html
https://www.meetup.com/Rust-Hungary-Meetup/events/244411460/
A
B
B
So
as
a
member
of
the
networking
team,
one
of
the
things
I
do
is
I
maintained
the
URL
parser
in
gecko,
which
is
written
in
C++
and
as
any
C++
project.
It
keeps
growing
and
growing
with
every
change
that
we
make.
It
has
like
little
tiny
quirks
and
well.
Naturally,
it
also
has
bugs
and
crashes
and
some
and
stuff
sometimes
so.
B
So,
let's
get
to
it,
we
could
go
visitor,
launched
Firefox
57
also
called
Firefox
quantum.
It
was
a
big
release
for
us
different
from
the
others
and
the
reason
for
this.
As
we
focused
on
performance,
we
wanted
to
be
our
best
in
our
fastest
release
yet,
and
we
delivered
on
that
promise,
making
it
a
browser,
that's
not
only
fast,
but
it
also
it
supports
the
user,
it
that's
us
to
the
user
not
to
the
big
companies
or
advertisers
and
so
on.
B
B
Some
of
you
may
know
it
some
of
you
may
not
so
it's
all
started
in
2006
when
its
founder
great
and
he
was
working
it
history
it
on
by
himself.
He
worked
on
on
it
for
a
long
while,
like
three
years
and
in
2009
Mozilla,
started
funding
the
project
and
got
more
research,
engineers
and
interns
to
work
on
its
full
time.
So
it's
only
in
2012
when
we
got
first
got
rust,
C,
which
is
a
self
hosting
compiler.
So
the
rust
C
compiler
is
written
in
rust.
B
Like
the
thing
we
know
today,
as
box
pointers,
there
was
a
garbage,
collector
pointer
and,
like
various
other
things,
they
had
green
thread
like
recalled
and
yeah
a
lot
of
weird
syntax
that
that's
not
there
today,
thankfully,
and
it
was
in
2015
that
the
first
version
of
rust,
rust
paint
always
released
while
the
the
latest
one
is
rust,
1.21,
so
rust
gets
a
release
every
six
weeks
just
to
keep
up
with
fast
developer
fast
development
like
developers.
Nowadays
they
ask
for
more
features
the
features
they
they
really
really
want,
and
they
want
them
in
rust.
B
Yesterday's
though
it
has
to
be
really
fast.
So
what's
that
you
ask,
why
did
Mozilla
wanted
to
fund
rust
development?
Well,
the
answer
is
fearless
concurrency,
so
I'm,
just
gonna
read
this
out.
I
hope
this
definition
of
insanity
is
to
do
the
same
thing
over
and
over
again
and
to
expect
the
results
to
be
different
by
this
definition.
B
We
in
fact
require
that
programmers
of
multi-threaded
systems
be
insane
or
they're
saying
they
could
not
understand
their
programs
and
that's
the
whole
point
of
putting
the
rust
in
in
Firefox,
because
we
want
multi-threaded
programming
is
so
so
hard.
It's
insane
to
think
that
you
can
actually
do
multi-threaded
programming
without
any
errors
and
make
it
work
properly.
So
the
point
of
rust
is:
oh,
let's
make
multi-threaded
programming
work
for
developers
who
are
not
really
insane
so
the
main
purpose
of
this
was
as
a
building
block
for
the
next
generation
of
browsers.
B
B
You
can
most
software
nowadays
isn't
ready,
isn't
capable
of
taking
advantage
of
all
all
the
features
we
have
in
hardware,
which
is
it's
kind
of
sad,
so
the
the
first
step
of
getting
of
getting
browsers
to
work
better
by
using
rust
with
servo,
which
started
in
2012
so
a
long
time
before
rust,
1.0,
so
that
kind
of
meant
they
had
to
keep
up
with
changes
in
the
rust
compiler.
So
every
couple
of
weeks
they
needed
to
start
using
a
newer
version
of
rust,
which
kind
of
end
fix
all
the
all
the
stuff
that
broke.
B
So
they
just
wanted
to
see
what
you
could
do
if
you
weren't
scared
to
try
it,
and
that's
that's
the
thing
because
you
some
people
have
said:
oh,
do
you
actually
want
to
rewrite
Firefox
in
rusts,
and
the
answer
is
no,
because
we
can't
do
that.
It's
millions
and
millions
of
lines
of
code
and
the
best
way
of
doing
it
is
she
have
a
targeted
approach
and
only
only
change
and
replace
the
large
blocks
of
it
with
parts
that
we've
already
tested
and
servo
and
we're
sure
that
they
work
really
really
well.
B
So
we
get
to
today
where
the
server
code
actually
lives
in
the
the
gecko
tree
in
Missoula.
Central
and
that's
happened
this
year,
and
it
takes
us
to
last
week
when,
in
Firefox
57
we
launched
Firefox
quantum,
which
contains
a
big,
a
big
feature
which
is
called
stylo,
which
is
the
the
CSS
engine
that
that's
actually
written
in
rust,
which
is
great.
B
So
this
is
the
oxidation
project.
It
actually
started
around
February
2015,
so
a
bit
before
the
rust
1.0
release
and
lots
of
teams
at
mozilla
were
interested
in
doing
something
in
rust.
We
recognized
the
benefits
of
it
and
we
made
a
list
of
things
that
we
could
do
so.
The
first
one
to
land,
rust
code
and
Firefox
was
Ralph,
Gauss
is
was
and
playback
team
and
what
they
wanted
to
do
was
to
get
rid
of
their
dependency
on
lip
stage-fright,
which
is
used
for
parsing
mp4,
a
video.
B
The
reason
is
that
it
in
2015
or
around
that
time
they
have
like
10
May
security
bugs
in
live
stage
fright.
So
that
was
obviously
a
problem,
and
he
did
you
don't
want
to
depend
on
that
on
the
fact
that
that
project
is
secure,
because
at
what
so
what
they
did
was
write
a
project
called
mp4
par
thrust
and
yeah.
They
put
it
in
Firefox.
A
big.
B
A
big
task
was
changing
the
build
system
to
coal,
rust,
C
or
rust
files
and
figure
out
how
to
test
it,
how
to
make
sure
that
something
doesn't
break
and
that
breaking
that's
reason.
That's
the
reason
why,
for
a
long
time,
they
ran
live
stage
fright
and
the
rust
code,
they
run
both
of
them
to
see
if
they
get
different
results,
because
for
some
reason
people
get
really
angry
when
their
browser
can't
can't
play
videos
on
the
internet.
I,
don't
know
why
yeah.
A
B
B
We
are
a
very
different
thing
was
when
we
got
crashes
in
the
rust
code,
because
the
stack
trace
when
we
when
we
collect
them
when
you
submit
the
stack
traces
because
it
happened,
was
very
different
and
we
didn't
have
symbols
for
them,
which
was
quite
quite
confusing,
but
we
got
past
all
that
and
fun
fact,
and
actually
this
was
shipped
in
Firefox
before
we
intended
to,
because
it
was
running
so
well
and
no
one
was
was
paying
attention
and
it
actually
went
to
Firefox
released
before
we
were
expect
like.
Oh
no.
A
B
B
I
think
this
is
maybe
the
second
Russ
project
that
landed
and
gecko,
and
it's
a
new
URL
parser.
It
was
written
by
another
Moodle.
Employee
assignments
happen
from
Paris
and
yeah.
So
it's
it's
a
new
URL
parser,
which
is
completely
written
in
rust,
and
it's
very
safe
and
the
problem
with
getting
this
landed
was
again
the
build
system
because
rust
URL.
We
had
dependencies
on
a
few
other
crates,
so
it
wasn't
an
option
just
to
change
the
build
system.
B
Just
to
Colorado
see
we
actually
had
to
get
cargo
in
our
build
system
and
to
work
with
that
and
sure.
Then
there
were
other
problems
such
as
Mozilla
has
a
policy
of
not
having
external
code
dependencies
or
all
the
code
we're
running
had
to
be
in
the
tree,
and
also
we
had
to
get
cargo
to
build
it
offline
because
all
orbit,
Bell
BOTS,
don't
really
have
connectivity.
So
that
was
also
a
problem,
but
it
was
fixed.
B
And
now
we
have
a
cargo
vendor
which
kind
of
makes
sure
that
all
works
offline
and
you
you
don't
need
to
have
internet
connection
when
you're
building
another
one
was
encoding.
Our
s,
which
was
written
by
Henry,
C
Bonin,
and
this
this
also
got
rid
of
you-
count
the
other
external
dependency
for
encoding
and
yeah.
We
kind
of
get
to
you
today
where
we
have
a
bunch
of
rest
codeine
far
for
a
big
step.
B
This
year,
major
milestone
was
in
Firefox
54.
We
actually
started
requiring
the
the
RUS
compiler
in
order
to
build
for
us.
So
before
you
could
set
a
flag,
so
you
can
build
Firefox
without
rest,
but
starting
then
we
got
all
in
and
said
no
from
now
on,
you're
required.
You
have
the
Ross
compiler
on
your
system
when
you're
building
and
we're
also
tracking
individual
rust
releases,
they
kind
of
every
Firefox
release
corresponds
to
rust
wheels.
B
B
From
now
on,
we're
gonna
see
it.
We're
gonna,
see
a
lot
more
features
of
servo
make
their
it
make
their
transition
to
Firefox,
which
is
just
great
so
as
I
said
in
Firefox
57,
we
got
stylo
also
called
quantum
CSS
and
it's
a
very,
very
cool
feature
because
it
uses
it
uses
all
the
parallelism
and
concurrency
that
we
get
with
rust.
B
Maybe
that's
in
this
amount
of
time
that
we
had
since
we
we
decided
to
start
working
on
quantum
Firefox
it's
like
a
year
ago.
So
in
that
amount
of
time
we
definitely
couldn't
have
built
something
so
big
and
so
complicated
without
having
rust
and
that's
now
that
certainty,
that's
wait.
It's
not
gonna
crash.
It's
all
gonna
go
just
fine
and
we're
not
gonna
have
data
races
turning
into
security,
but.
B
B
What
are
we
gonna
do
in
the
future?
And
the
answer
is
more
rust
or
we're
gonna
try
to
put
more
features
from
servo
and
migrant
migrate
them
into
Firefox
and
just
plain
all
rewriting
of
code.
You
have
to
rewrite
some
code
sometimes,
and
we
are
trying
to
do
that
and
rust,
because
it's
much
safer
and
much
cleaner
and
much
better.
B
B
Ya,
that
is,
minus
1.
That's
minus
1
on
32
bits
unsigned.
So
that's
the
problem
because
indexed
with
an
untied
32
bits
and
that's
a
ternary
operator,
which
kind
of
said:
oh,
these
need
to
have
the
same
type,
so
it
kind
of
so
it
makes
minus
1
also
be
an
unsigned
32-bit
and
when
it
returns
as
an
n64,
we
get
that
number
and
that's
one
of
the
most
interesting
bugs
I've
seen
because
it's
so
simple
yet
extremely
hard
to
to
figure
out.
We
have
static
analysis
in
the
in
the
tree
and
that
didn't
pick.
B
B
B
B
The
most
important
things
is
to
use
and
report
bugs
and
Firefox,
because
that's
the
the
only
thing
where
we
don't
have
enough
people
in
the
world
to
do,
and
you
can
contribute
to
your
projects
and
Firefox.
We
have
mentored
bugs.
So
if
you
want
to
rewrite
some
simple
functions
in
rust,
just
let
me
know
send
me
an
email
or
hit
me
up
on
Twitter
and
I
can
easily
find
some
of
some
of
them
for
you,
and
you
can
also
contribute
to
the
servo
and
rust
projects
on
github.
B
They
have
issues
labeled
EEZ,
so
yeah,
there's
a
bunch
of
them
which
you
to
pick
from
that.
So
that's
about
it.
This
is
the
link
to
my
slide.
If
you
want
there're
a
bunch
of
links
in
the
slides,
if
you
want
to
learn
more
and
that's
the
wiki
page
for
the
oxidation
project,
where
you
can
see
all
the
related
bugs
and
you
can
watch
them
and
all
the
other
projects
that
we
are
currently
in.
B
B
We
have
crashed
that,
but
I
don't
know
if
you
can
correlate
them
for
that.
There's
crash
reductions
because
of
rust
or
because
other
people
are
busy
fixing
crashes,
but
it's
all
public.
It's
called
crashed
at
org.
You
can
crash
dot,
stats
that
and
you
can
see
you
like,
which
are
the
biggest
crashers
in
Firefox
and
how
the
crash
number
oscillates
from
release
to
release
and
so
on.
B
So
we
don't
know
how,
by
how
much
we
reduce
our
crashes,
because
we
can't
know
we
can't
be
in
two
realities
at
once
and
see
how
bad
it
would
have
been
otherwise.
But
we
trust,
like
the
number
of
crashes
we
see
in
in
rust
code,
is
well
they're,
not
actually
crashes
they're
like
assertions
at
most,
so
that's
it.
A
B
That
is,
that
is
a
challenge
indeed,
and
one
of
the
ways
of
doing
it
is
you
write
rappers,
so
you
have
C++
objects
that
actually
rap
and
treat
just
call
those
methods
on
objects
right
and
that's
one
way
of
doing
it.
Stylo
also
does
something
they
have
a
binding
generator,
which
kinda
Maps
C++
structures
to
rust
structures,
and
then
you
can
just
this
is
for
speed,
so
you
can
kind
of
export
the
data
from
rust,
and
you
just
call
a
rust
function,
get
that
data
engine
just
looking
the
in
that
structure
and
get
all
the.