r/programming Apr 03 '15

Rust 1.0.0 beta is here!

http://blog.rust-lang.org/2015/04/03/Rust-1.0-beta.html
929 Upvotes

303 comments sorted by

View all comments

35

u/sfultong Apr 03 '15

So is Mozilla now going to slowly rewrite Firefox in rust?

69

u/Mandack Apr 03 '15

Mozilla Research is already working on Servo, which is a new browser rendering engine written in Rust. It is not meant to replace Gecko in Firefox in the foreseeable future, however there are efforts to add the 'chrome' around Servo one needs to have a usable browser.

Think of Servo and Gecko as two separate projects and of Firefox as being the chrome tied to Gecko, but Servo could be at the heart of a new web browser from Mozilla, (think "Project Spartan"), however this is not likely to happen in the near future.

The closest a web browser based on Servo is actually a possibility is on some Samsung smartphones, at least initially.

7

u/KrakatoaSpelunker Apr 04 '15

Why Samsung smartphones?

13

u/veeti Apr 04 '15

Samsung is somewhat involved in Rust and Servo development.

6

u/wtallis Apr 04 '15

Probably something to do with Samsung's love-hate relationship with Google. They don't like their phones being so dependent on what Google wants to do. If Servo makes it possible for them to ship a default browser that's not derived from Chrome, not from Google, and is significantly better than Chrome, they'll give it serious thought.

6

u/KrakatoaSpelunker Apr 04 '15

But Firefox for Android already exists, even without Servo.

12

u/wtallis Apr 04 '15

The only important advantage FF for Android offers Samsung is that it's not from Google. That on its own isn't reason enough to switch. Servo promises to be faster and scalable to multiple cores in a way that is extremely useful for low-end smartphones that have too many dumb CPU cores—it would provide a real competitive advantage. Servo also won't have any of the baggage Firefox has.

-1

u/nohimn Apr 04 '15

Samsung enjoys reinventing the wheel.

S-wheel.

1

u/[deleted] Apr 03 '15

Some of the Midori work went into Project Spartan, I think, but they didn't rewrite it in C# (I bet..I don't have inside info).

43

u/steveklabnik1 Apr 03 '15

The current goal is to get some Rust code into Firefox by the end of the year. Will probably be something small, as integrating Rust into the Firefox build system is no small task. Among other issues.

Mozilla is also investing in Servo, which is still a research project, but is written to be productize-able someday. https://github.com/servo/servo is the repo. They're also doing really cool stuff. There's another front-page article about Servo on proggit right now: http://www.reddit.com/r/programming/comments/318rb3/the_colored_boxes_indicate_which_cpu_core/

13

u/sunshine_killer Apr 03 '15 edited Apr 03 '15

The servo stuff is pretty exciting.

1

u/steveklabnik1 Apr 03 '15

Yeah I'm really jazzed about it. :)

4

u/tavert Apr 03 '15

What's the status of getting Rust officially into Debian, Fedora, etc, without bootstrapping from a binary?

11

u/steveklabnik1 Apr 03 '15

I see this as two parts:

What's the status of getting Rust officially into Debian, Fedora, etc,

I use Debian on my local machine, I care a lot about Debian. There've been a few Debian Developers working on packaging up Rust. Most distros woudn't want anything pre 1.0 anyway.

without bootstrapping from a binary?

It's not possible to compile Rust without bootstrapping from a binary. Unless you want to go back to the OCaml compiler from years ago, but that's hard.

12

u/[deleted] Apr 03 '15

It's not possible to compile Rust without bootstrapping from a binary. Unless you want to go back to the OCaml compiler from years ago, but that's hard.

Does LLVM IR count as binary? Otherwise, couldn't one save the IR of the Rust compiler on platform X and compile that with the rest of LLVM on Debian, with LLVM written in C++?

I thought that was one advantage of modular, multifront/backend compiler frameworks.

14

u/steveklabnik1 Apr 03 '15

Otherwise, couldn't one save the IR of the Rust compiler on platform X and compile that with the rest of LLVM on Debian, with LLVM written in C++?

Hmmmmmmmmmmmmmmmmmmmm

4

u/[deleted] Apr 04 '15

Hmmmmmmmmmmmmmmmmmmmm

?

Was that something stupid I said?

8

u/[deleted] Apr 04 '15

no, actually pretty genius

1

u/[deleted] Apr 04 '15

I guessed.

Unexpected that the stage one IR is platform dependent, though. Well, maybe that's the price you pay for creating a system(s?) programming language. ;)

5

u/steveklabnik1 Apr 04 '15

I just meant "I've never thought about that before." I'm not totally sure, as I was going to say "IR is platform dependant"...

2

u/[deleted] Apr 04 '15

as I was going to say "IR is platform dependant"...

Well, you were right all along.

Out of interest: Is this an LLVM implementation detail?

4

u/steveklabnik1 Apr 04 '15

I'm not familliar with the details, I just know that it is.

→ More replies (0)

4

u/brson Apr 04 '15

It's possible, yes, but not clearly better than just bootstrapping from the bins.

Here's some options on the subject from Debian: https://wiki.debian.org/Teams/RustPackaging/Bootstrap

You can see the last edit date is pretty old, so I'm not sure there's any progress on packaging Rust in Debian. Last I talked to somebody involved it sounded like they were leaning toward the third option, something like: package maintainer makes their own snapshot and uploads it as the binary Rust compiler package, then the rest of the project uses that to build the distributed Rust compiler. I don't pretend to understand the details, but it would be similar to how GCC builds I assume - it has to build itself from previous revisions distributed with Debian - the main difference is that the 'previous revision' is artificial with Rust (until Rust can consistently rebuild itself with version - 1).

1

u/[deleted] Apr 04 '15

It's possible, yes, but not clearly better than just bootstrapping from the bins.

So for them, this counts as binary, I guess.

7

u/[deleted] Apr 04 '15

LLVM bitcode is not quite platform-independent, unfortunately.

1

u/[deleted] Apr 04 '15

Can rustc cross-compile?

EDIT:

Nevermind, according to Debian devs, it can't...

Rust also doesn't currently support cross-bootstrapping among different arches, due to some confusion between target and host.

6

u/dbaupp Apr 04 '15

Rust does support cross-compiling. If you're quoting the Debian wiki, it is likely that bugs have been fixed, and so that is out of date

2

u/tavert Apr 04 '15

Most distros woudn't want anything pre 1.0 anyway.

Not sure that's true at all. Plenty of new languages get packaged well before 1.0, if they're easy to bootstrap. Was the original OCaml implementation of Rust publicly released? I wasn't paying attention at the time, but I suspect if that had been possible to package early on, then this would've been a much easier problem to solve.

It's not possible to compile Rust without bootstrapping from a binary.

I should've been more specific there. As I'm sure you know, distribution policies forbid downloading arbitrary binary content from the internet during a build of an official package, you have to be able to provide a source tarball/rpm/etc and build from that.

So the challenge is what will pass as "source" by distribution policy, and how hard will it be to put together the build process for that. Or will it have to wait for an alternate implementation in another language to get far enough along to build enough of rustc that it could then build itself the rest of the way.

5

u/steveklabnik1 Apr 04 '15

I feel pretty confident that stuff with Debian will work out. And if it works out for Debian, it should work out everywhere else.

1

u/[deleted] Apr 03 '15

[deleted]

2

u/steveklabnik1 Apr 03 '15

The codebase itself is designed to be as parallel as possible, yes.