►
Description
"Bootstrapping" is the process of building a compiler written in its target language. Bootstrapping has been used since the development of ALGOL and LISP in the 1960s. In this talk, you'll learn the history of the bootstrapping the Rust compiler, how bootstrap works today, and some big ideas for bootstrap in the future. You'll also have a chance to get involved in working on bootstrap.
A
I
think
you
know
all
right,
so
my
talk
is
called
bootstrapping
and
that's
probably
already
raised
a
bunch
of
questions
like
what
is
bootstrapping
and
what
does
it
have
to
do
with
compilers,
and
so
I'm
going
to
talk
about
what
it
is
first
before
we
dive
too
deep
into
it.
So
the
rest
compiler
is
written
in
rust,
which
leads
to
some
strange
and
and
interesting
challenges,
and
because
it's
in
rust,
that
means
you
have
to
compile
it
with
an
existing
rest
compiler.
A
So
you
need
to
compile
it
with
itself
like.
How
does
this
work?
How?
How
do
we
compile
the
compiler
with
itself?
Well,
the
way
you
do
it
is:
you
can
use
an
older
version
of
the
compiler,
so
the
some
definitions,
real
quick,
the
rest
compiler
is
self-hosted,
which
means
it's
written
in
rest,
the
same
language
that
it
compiles
and
bootstrapping
is
the
process
of
building
it.
A
Okay
right!
So
there's
three
parts
of
this
talk,
and
the
first
part
is
how
we
want
things
to
work,
how
how
they
should
work,
how
we
hope
they
work
right.
So
when
I
say
an
older
version,
the
rust
compiler
always
uses
the
immediate
previous
version.
So,
for
example,
nightly
is
built
with
beta
beta
is
booked
by
stable
and
stable
is
built
by
the
previous
stable,
and
it
goes
back
in
the
chain
one
at
a
time,
and
you
might
ask
why
are
we
going
one
at
a
time
like?
A
Wouldn't
it
be
simpler,
if
we
just
like
had
one
version
of
the
rust
compiler
that
we
always
used?
Pin
that
in
place
and
there
we
go,
we
never
need
to
update
it.
Well,
the
problem
with
that
is
that
we
use
unstable
features
in
the
compiler,
but
let's
go
ahead:
let's,
let's
try
it
out
and
see
what
happens:
we're
going
to
build
the
current
beta
compiler
1.63
with
the
previous
stable
compiler.
This
is
like
only
two
versions
back
like
how
bad
could
it
be
right.
It
can't
be
that
bad
well
oops.
A
So
so,
if
you
look
at
the
error
here,
it's
telling
us
there's
something
called
a
language
item
that
we
need
to
know
and
it's
called
from
eat
and
we
don't
know
what
from
meat
is-
and
this
is
like
something
in
1.62,
not
in
1.61
so
like,
even
in
that
short
amount
of
time,
we're
already
running
into
errors
and
because
we
depend
on
those
unstable
features
in
the
compiler.
A
We
can't
use
that
older
version,
but
like
what
does
this
mean
right
like
what
are
language
items
like
all
this
stuff?
So
some
some
more
definitions
standard
is
the
standard
library.
If
you
look
at
this
error
here,
it's
not
actually
pointing
to
the
compiler.
It's
pointing
to
the
standard
library
and
what's
going
on
here
is
the
standard
library
depends
on
implementation,
details
of
the
compiler
and
one
of
those
is
language
items.
A
So
let's
take
an
example
here.
This
is
the
addition
trait
it's
defined
in
core.
It's
how
you
do
operator
overloading
and
rust
and
for
the
most
part,
it's
a
normal
trait.
You
have
an
output
type
that
tells
you
the
type
of
result.
It
has
a
function
you
implement.
That
tells
the
compiler
how
to
calculate
the
result,
and
you
can
do
it
for
any
of
your
user
defined
types
just
like
any
other
shape,
but
what
makes
it
special
is
the
little
attribute
at
the
top
language
equals
add,
and
what
that
does.
A
Is
it's
a
little
bit
of
compiler
internal
magic?
That
says
this
trait
corresponds
to
the
addition
operator,
and
we
need
this
to
make
operator
overloading
work,
so
you
can
use
a
plus
instead
of
a
function,
but
it
also
means
that
we're,
depending
on
implement
implementation
details
of
the
compiler
that
can
change
in
any
release.
We
don't
stabilize
stuff
like
this,
because
you're
not
meant
to
use
it
unstable.
A
A
And
other
all
sorts
of
other
things,
and
because
the
standard
library
is
so
tied
in
with
the
compiler
itself,
you
can
almost
think
of
it
as
part
of
the
compiler.
If
we
define
this
edition
trait
in
any
other
way,
if
we
remove
the
output
type
or
if
we
change
the
function
signature,
we
won't
be
able
to
compile
it.
We
won't
be
able
to
implement
operator
overloading
it's
important,
that
it
looks
exactly
the
way
that
it
does,
and
now
you
might
ask
like
what
happens
if
we
do
change
these
implementation
details
right.
A
We
we
said
earlier.
The
reason
they're
unstable
is
because
we
might
want
to
change
them,
and
so,
if
we
do
change
them,
won't
it
break
the
standard
library
right
because
it's
depending
on
unstable
features
and
the
reason
this
is
okay-
is
because
we
only
ever
build
the
standard
library
with
one
version
of
the
compiler.
It
only
has
to
support
1.62,
not
any
later
version,
and
so
it
knows
how
the
compiler
is
implemented,
and
it
can.
It
can
write
code
in
exactly
the
way
that
it
knows
the
compiler
will
accept
right.
A
Why
is
the
compiler
different
and
the
reason
is
when
we
build
the
compiler,
we
are
not
using
the
beta
compiler,
we
are
using
the
nightly
standard
library
and
the
reason
we
do.
That
is
because
it
lets
us
dog
food
new
nightly
features,
even
as
they're
added,
without
waiting
for
beta
release,
and
so
the
way
this
works
is
we
have
the
beta
compiler,
which
builds
the
standard
library,
and
then
the
new
standard
library
is
used
with
the
beta
compiler
to
build
standard
and
again
this
is
unlike
any
other
program
in
that
we're
building
the
standard
library.
A
Right
so
I've
talked
so
far
about
how
the
standard
library
depends
on
implementation.
Details
about
how
we
dog
food
those
unstable
features,
so
we
can
use
them
in
the
compiler
and
there's
another
way
we
dog
food
features
and
that's
by
using
language
features
in
the
compiler.
We
do
this
on
nightly,
even
before
the
beta
release.
As
soon
as
someone
adds
a
new
feature
to
the
compiler,
we
can
immediately
start
using
it.
A
A
A
A
There's
a
great
reason
for
that
and
the
reason
is
magic,
abi
reasons,
I'm
not
going
to
go
into
abis
and
and
why
this
is
important
in
this
talk,
but
I'm
happy
to
answer
on
discord
or
after
the
talk
right.
So
then
we
rebuild
the
sender
library.
We
use
that
newly
compiled
standard
library
to
build
the
compiler
again
using
the
nightly
compiler,
and
what
that
lets
us
do
is
use
language
features
in
the
nightly
compiler.
A
A
So
when
we're
building
1.62
well,
the
numbers
are
wrong,
but
when
we're
building
the
nightly
compiler
with
the
beta
compiler,
we
need
to
enable
the
feature
when
we
use
it,
because
the
beta
compiler
still
thinks
it's
unstable.
It
hasn't
been
stabilized
on
beta,
it's
only
been
stabilized
on
nightly,
but
when
we
rebuild
the
nightlight
compiler
with
itself,
the
knightly
compiler
does
think
that
it's
stable,
and
so
we
can
disable
the
feature.
So
we
don't
get
a
warning
about
an
unused
nightly
feature.
A
A
What
happens
when
someone
introduces
a
bug
to
the
compiler
most
of
the
time
it'll
be
caught
by
our
test
suite.
We
have
a
lot
of
tests,
they
run
in
every
merge.
They
run
on
every
platform.
We
catch
a
lot
of
bugs
this
way,
but
not
everything's
covered
by
tests.
Sometimes
things
slip
through,
usually
things
just
break
your
program.
It
fails
to
compile
you
get
an
error.
A
A
Then
it
builds
the
standard
library
rebuilds
itself
with
that
standard
library
and
note
here
that
the
standard
library
now
could
have
bugs
introduced
into
it
that
aren't
present
in
the
source,
because
the
compiler
is
buggy.
It
did
something
wrong
and
now
the
standard
library
no
longer
matches
your
source
code
and
even
more
than
that,
the
compiler
was
rebuilt
with
itself
with
a
version
of
it
that
was
buggy,
and
so
now
we
can
have
new
bugs
that
are
even
unrelated
to
the
original
bugs.
A
A
In
practice,
this
really
happens.
We
have
a
lot
of
tests.
We
have
a
lot
of
great
reviewers
who
catch
bugs
in
prs
and
we
have
something
called
a
release,
train
nightly
and
beta
and
stable,
and
that
gives
people
a
lot
of
time
to
report
bugs
and
let
us
fix
them
before
they
impact
users
unstable,
there's,
a
great
talk
by
pietro
albini
in
2019
called
shipping
a
compiler
every
six
weeks.
I
highly
recommend
looking
that
up.
If
you're
interested
in
how
the
release
process
works.
A
A
So
we
merge
the
pr.
We
publish
the
beta
release,
we
start
building
nightly
with
beta,
and
at
this
point
we
hit
an
error
and
we're
like
why.
Why
are
we
hitting
an
error
right
like
we?
We
know
this
just
worked
before
and
at
this
point
we'll
discover
the
miscompilation
will
be
like
okay,
we
did
something
wrong,
we
fixed
the
bug
and
then
we
will
patch
the
beta
compiler,
which
is
called
back
porting
and
then
we'll
use
that
new,
patched
compiler,
and
then
we
can
get
it
to
work.
A
Okay,
so
I've
talked
about
bugs
that
occur
pretty
frequently
in
practice,
bugs
that
cause
compile
errors
bugs
that
cause
miscompilations,
and
we
know
what
those
look
like.
We
know
how
to
fix
them.
We
have
experience
dealing
with
them
now
I
want
to
talk
about
a
kind
of
bug-
that's
still
theoretically
possible,
but
a
lot
harder
to
detect
or
to
fix,
and
to
do
that,
I
need
to
take
a
detour
and
talk
about
some
compiler
theory,
but
I
promise
it
does
have
practical
implications.
Just
stay
with
me
for
a
bit.
A
A
A
So,
let's
take
a
concrete
example:
let's
say
that
we
add
a
new
line
character
to
the
rest
language.
I
have
some
pseudo
code
here
of
basically
what
that
would
look
like
you
have
a
function.
It
takes
its
input,
which
is
a
string.
You
parse
the
string.
You
see
like
a
backslash
n
you're
like
okay.
This
is
a
newline
character,
and
so
the
very
first
time
you
add
support
for
this
feature.
A
The
new
line
character
is
not
in
the
rest
language,
because
you
haven't
added
that
support
yet,
and
so
you
can't
write
it
in
the
output
code.
You
have
to
write
the
the
actual
value
instead,
which
is
ox0a
and
ascii,
but
the
next
time
when
you
recompile
the
compiler,
now
it
because
it's
written
in
rust
now
it
has
the
feature
and
you
no
longer
need
to
write
the
value
in
the
source
code.
You
can
just
write.
Backslash
n,
like
any
other
program,
would
and
that's
great.
A
Then
you
end
up
with
a
program
that
looks
like
it
should
be
trustworthy,
but
is
not
in
fact
trustworthy
and
so
there's
a
solution
here
and
the
solution
is
you
just
read
the
source
of
the
compiler
you're
like
okay?
Well,
I've
I've
looked
at
it,
I've
read
through
rusty
or
whatever
it's
good.
I'm
glad
great
problem
solved.
Well,
we're
not
quite
what
happens
if
the
program
you're
generating
is
itself
a
compiler.
A
A
Then
you
take
your
trusted
program
which
you've,
reviewed
and
you're
pretty
sure
is
correct,
and
you
compile
that
with
the
backdoor
compiler
and
you
end
up
with
a
binary
that
looks
like
it
should
be
trustworthy
because
reviewed
it
in
the
compiler
that
creates
it,
but
still
is
not
trustworthy
like.
How
do
you
avoid
this
sort
of
issue.
A
The
answer
to
that
is
you
keep
going
up
the
chain
you
keep
reading
more
and
more
compiler
sources.
You're
like
okay,
I've
reviewed
them.
Every
single
compiler
ever
used
in
the
history
of
my
program
looks
good,
we're
pretty
sure
it's
trustworthy,
and
this
is
called
a
trust
chain.
All
those
compilers
in
the
history
of
your
program
are
a
trust
chain.
A
A
So
that's
great,
but
there's
a
solution
to
this
there's
a
guy
named
david,
a
wheeler
in
20
2009.
He
came
up
with
an
idea
called
diverse,
double
compilation
and
the
basic
idea
is
you
take
a
bunch
of
compilers
and
you
compile
them
with
each
other
you're
like
if
we
compile
cling
with
gcc
file
out
with
gcc
again
compile
clang
again.
If
we
end
up
with
the
same
compilers
we
had
originally,
then
we're
pretty
sure
it's
trustworthy.
It's
it's
like
very,
very
hard
to
sneak
a
bug
through
that
way.
A
A
Well,
it's
not
quite
true
that
we
only
have
one
compiler
there's
something
called
mresc,
which
is
a
c
plus
plus
compiler,
which
compiles
rust.
It's
written
in
c,
plus,
compiles
rust
and
so
from
there
we
can
use
existing
truss
chain
c,
plus
plus,
is
a
lot
easier
to
establish
trust
trains
for
because
you
only
have
to
go
back
four
or
five
compilers
instead
of
a
hundred
or
so,
and
people
use
this
in
practice.
A
And
because
c
plus
plus
has
multiple
compilers.
They
can
also
do
a
shorter
thing,
which
is
just
verify
them
against
each
other.
They
don't
they
don't
need
the
trust
chain
unless
they
want
to
right,
but
there's
a
problem
still,
which
is
that
mrc
is
kind
of
a
one-person
project
right
now,
and
so
it
can't
keep
up
with
all
the
nightly
features
that
the
rust
compiler
is
adding
on
every
six
weeks.
A
Now
it
does
support
pretty
recent
versions.
It
supports
1.54,
but
in
practice
that's
still
like
10
or
so
versions
of
the
compiler.
Now
I
don't
know
how
many
of
you
have
tried
to
compile
rest
c
from
source,
but
it
takes
a
while,
if
you,
if
you
compile
it
10
times,
it's
probably
a
full
day
of
running
your
computer
non-stop
right
there,
but
it
does
work.
You
can
do
it
if
you
want
to.
A
Okay,
I'm
going
to
switch
tax
for
a
bit,
I'm
going
to
switch
away
from
trusting
trust.
I
talked
a
bit
earlier
about
how
we
use
beta
compiled
nightly,
but
I
didn't
mention
where
beta
comes
from
right,
like
most
people
who
are
working
on
the
compiler
itself,
don't
have
beta
installed
right,
they
use
nightly.
Sometimes
they
use
stable.
We
actually
have
a
lot
of
trouble
getting
people
to
use
beta
because
most
of
them
use
stable
and
production
or
if
they
do
want
features
they're
using
nightly
it's
hard
to
get
people
to
use
beta.
A
So
how
do
we
get
it
onto
people's
systems?
So
we
can
use
it
and
the
answer
is
we
just
download
it?
We
have
a
little
python
script
that
reaches
out
to
a
website.
It
downloads
the
beta
compiler.
It
builds
our
build
system
and
then
the
build
system
uses
the
beta
compiler
to
build
the
standard
library,
and
that
works
great
we've
done
this
for
ages.
A
The
problem
is
that
now
we
have
a
python
script
right.
If
you're
working
on
the
compiler,
you
probably
don't
want
to
have
python
installed,
it's
not
part
of
your
normal
workflow.
You
have
to
figure
out
like
python,
one
versus
two
versus
three
and
you're
like
wait.
What
if
python,
doesn't
have
a
version
number
and
like
it
turns
out
that
there
is
no
version
of
python
with
a
name
that
exists
on
every
platform?
A
It's
it's
like
a
whole
mess
and
I
got
really
frustrated
at
this
in,
like
january
of
this
year,
I'm
like
okay,
I'm
fixing
this
I'm
getting
rid
of
this
problem,
and
so,
instead
of
using
python,
I
had
the
idea
what
if
we
just
use
the
compiler
people
already
have
installed
most
people
working
on
rust
use
rust
regularly,
which
is
why
they
contribute
to
the
language.
So
we
can
just
use
the
rust
they
already
have
installed.
A
Take
that
build
the
beta
compiler
build
our
build
system
and
there
we
go,
and
I've
been
working
on
that
for
about
six
months
now
and
it's
going
pretty
well.
This
is
the
tracking
issue.
As
you
can
see,
it
has
six
of
eleven
tasks
checked.
This
is
this
is
making
good
progress
here.
A
A
All
right,
that's
it!
For
me,
a
little
about
me.
My
name
is
joshua
nelson.
I
work
at
a
company
called
cloudflare
that
does
computer
networking
and
I've
been
involved
for
the
project
for
three
or
four
years
now
I
started
with
docs.rs
the
documentation
site.
I
worked
on
rustoc
the
documentation
generator
most
recently
I
work
on
bootstrapping.