10 ms·
Announcing Rust 1.7
- Perceptes 11y agoThank you, Rust team! It's like Christmas every six weeks! :D
- kibwen 11y agoAs mentioned in the OP, Rust really hasn't added any language-level features since 1.0, but looking forward there were two major features whose RFCs were accepted this cycle: impl specialization (https://github.com/rust-lang/rfcs/pull/1210#issuecomment-187777838 https://github.com/rust-lang/rfcs/pull/1210#issuecomment-187...) and the `?` operator (https://github.com/rust-lang/rfcs/pull/243#issuecomment-180504407 https://github.com/rust-lang/rfcs/pull/243#issuecomment-1805...). The former will keep code from having to pay a de facto performance penalty for being generic (preliminary implementation at https://github.com/rust-lang/rust/pull/30652 https://github.com/rust-lang/rust/pull/30652), and the latter is purely an ergonomic change to make our `Result`-based error handling more lightweight (preliminary implementation at https://github.com/rust-lang/rust/pull/31954 https://github.com/rust-lang/rust/pull/31954). I'm personally hoping the latter one manages to get into the beta release for the next cycle, so that I can use `?` rather than `try!()` for my Rust tutorial at OSCON this year. :)
- steveklabnik 11y agoWell, beta for the _next_ release is already branched; it would be the one after that, at the earliest.
- kibwen 11y ago1.8-beta has branched, yes, but if it stabilizes this cycle it would make it into 1.9-beta (which would progress to 1.9-stable the week after OSCON), and our beta releases have proven themselves stable enough that I'm perfectly happy to use them in tutorials.
- tatterdemalion 11y agoI would be surprised if ? were stabilized in the next 6 weeks after how contentious the RFC was.
- steveklabnik 11y agoYes, I expect it to move more slowly than an immediate stabilization as well.
- kibwen 11y agoAlas, you're probably right. :) A man can dream!
- dikaiosune 11y agoNot mentioned in the release, but in the extended release notes: "Soundness fixes to the interactions between associated types and lifetimes, specified in RFC 1214, now generate errors for code that violates the new rules. This is a significant change that is known to break existing code, so it has emitted warnings for the new error cases since 1.4 to give crate authors time to adapt." https://github.com/rust-lang/rust/blob/stable/RELEASES.md#compatibility-notes https://github.com/rust-lang/rust/blob/stable/RELEASES.md#co... I think this is a fantastic example of the even-handed approach in the compiler stability promises/plans, and it's great to see one of the first real tests of those promises go so well.
- steveklabnik 11y agoFor those that don't follow Rust very closely, I sent in numerous (well, something like "30") fixes to various libraries after this landed, and the vast majority of them involved adding ": Sized" in the correct place. So while it was true that it was breaking, it was easy to update. We take breaking changes ridiculously seriously, and soundness is basically the only case where they make sense to do.
- cpeterso 11y agoWhy does Rust not use semver to clearly communicate when breaking changes do take place?
- GolDDranks 11y agoDisclaimer: I'm not a Rust author, but I actively follow the development process. Rust does use semver. But as the concept of "breaking change" is ill-defined – as I've understood – in the definition, the Rust project is using the following heuristic: * If it's a safety/soundness-releated bugfix, it's considered a minor (1.x.0-changing) change even if it makes some existing crates stop compiling. Because the crate was relying on broken/unsound functionality, that's acceptable. * Impact of all such breaking changes are measured and assessed against the ecosystem using the Crater tool. * Even if crates stop building, the changes should be such that it's trivial to fix them. (In the best case, one-liner type annotations etc.) Btw. Rust sometimes deprecates APIs that have been supplanted by better alternatives. Deprecations are warnings, and they are allowed to go away only on a x.0.0 version change. Additionally, careful consideration for stability and breaking changes is done when designing new language features.
- BooneJS 11y agoI've been devoting a lot of my daylight hours to writing Go, but with Rust at 1.7 and Go at 1.6 I may have to rethink that. ;)
- kibwen 11y agoWhy not both? :) Dropbox has an enormous amount of infrastructure in Go, but some of their most performance-sensitive software is in Rust. There's no need to dedicate yourself to a monoculture. In any case, let's not put too much stock on version numbers. :P
- Cshelton 11y agoI second using both. Go has moments where it shines and same with Rust. No reason to pick a side and commit...not sure why so many feel they have to... I don't think any one would argue with writing a web server in Go right now compared to Rust, given the maturity of the Go ecosystem around writing web servers.
- SneakerXZ 11y agoIt one really nice thing about Go, you have http stack and json encoder/decoder integrated in std so you don't have to worry which one you should use if you are happy with basic one.
- bsder 11y agoWhy would you abandon Go for Rust without reason? Go does certain things better than Rust and vice versa.
- BooneJS 11y agoSorry, attempted snark at the version numbering. In all honestly, I think Rust looks quite interesting it's just that I want more experience in Go before I look at anything else.
- EugeneOZ 11y agoGo Rust!
- SneakerXZ 11y agoI wish Rust team invested more into tooling and maybe introduced officially supported IDE because at the end tooling is more important than the language itself. Java is not the best language but it obvious choice for many people because of its IDE integration.
- steveklabnik 11y agoWe have been working hard and investing a lot into tooling, it's just not done yet. https://www.rust-lang.org/ides.html https://www.rust-lang.org/ides.html is a rough outline of what's in the pipeline for IDEs specifically.
- wyager 11y ago>tooling is more important than the language itself What makes you say this? Many programmers don't use IDEs or anything.
- DasIch 11y agoYou don't use any tools for package management, documentation, linting, testing and debugging?
- untothebreach 11y agoI think the conflict here is that, for the "non-IDE" programmer, Rust's tooling is best-of-class (IMO). If your idea of an ideal programming environment is running vim/emacs/sublime/atom and maybe a terminal, Rust's tooling is great. However, some programmers like an IDE more. Which is fine, but for this type of programmer, Rust still has a long way to go. There are some immature plugins for existing IDEs, and even a couple "rust-specific" IDE projects, but nothing near what (say) Java or C# have.
- tatterdemalion 11y agoAs a vim user I can attest to this. Rust tooling is better for me than any other language I have ever used. Only thing I ever wish for is a REPL, which is a big ask for a language like Rust.
- dominotw 11y agoAny ideas how rust's cross compilation compares with golang? I am amazed with how easy it to cross compile to different platforms supported by golang. Curious how rust compares.
- steveklabnik 11y agoThe current situation is "it works, but is not as easy as we'd like." We have plans underway to make it very trivial, but the needed infrastructure work isn't quite there yet. A summary is "every Rust compiler is a cross-compiler, but you need a copy of the standard library for your target platform available." Getting said copy is what takes the work. In the future, we want it to be as easy as a call to the command-line, but for now, https://github.com/japaric/rust-cross https://github.com/japaric/rust-cross is a good resource. See also https://github.com/japaric/rust-everywhere https://github.com/japaric/rust-everywhere , which is very interesting.
- fabrice_d 11y agoI'm maintaining a docker image to cross-compile at https://hub.docker.com/r/fabricedesre/rustpi2/ https://hub.docker.com/r/fabricedesre/rustpi2/. It's Rasberry Pi2 specific since it relies on a tweaked sysroot to link against OpenSSL and a few other libraries. The way I'm using it is: docker run --name rustpi2 -v `pwd`:/home/rustpi2/dev/source -v $HOME/.cargo:/home/rustpi2/.cargo fabricedesre/rustpi2 cargopi build (cargopi is just equivalent to cargo --target=armv7-unknown-linux-gnueabihf)
- Kratisto 11y agoSo I don't know a whole lot about Rust. Can anyone give a summary of why/when I should use Rust?
- steveklabnik 11y agoSomeone asked a similar question on /r/rust the other day, here's what I had to say: Rust is a programming language. It's a general programming language, so it's good for a large variety of things. Different people have different reasons for using Rust. There are three large constituencies, as I see them: systems programmers, functional programmers, and scripting language programmers. Before I get into details: all generalizations are false ;) Systems programmers come to Rust because it's able to do the lowest levels of software: operating systems, device drivers, stuff like that. Where it improves on existing systems languages is "safety." The Rust compiler does a lot of compile-time checking to make sure you don't do things wrong. Existing languages force you, as the programmer, to double check your work. We have the compiler double-check your work, and force you to get it right. Functional programmers see all that static checking, and it feels like home. But a home where they have significant speed gained. Functional languages can be fast, but not always C level fast. Rust is. It's easier to get that level of performance out of Rust. Scripting language programmers come to Rust for two reasons: the first of which is to write extensions to their language for speed. You can write a Ruby gem in Rust, rather than in C. This is useful because this low-level stuff is not their expertise, and so the extra checks are really nice. Related: we have a lot of the nice tooling that scripting language folks have come to expect from their language. No need to write makefiles, we have Cargo. The second is sort of related, but these checks also mean it's easier to learn low-level stuff, so if they want to expand their universe, Rust is a nice way to do so. We're seeing a lot of people for whom Rust is their first systems language. I didn't know where to put this one, but Rust focuses on a concept called "zero-cost abstractions." This means that a lot of our features that feel very high level are extremely efficient. You don't write manual for loops, you se iterators. You don't deal with pointers directly, but with references. Structures like Box and Vec do memory management, but you don't need a garbage collector, and you don't need to manually manage it, but you also don't need to explicitly call free(). These are very broad strokes. Lots of other people have other reasons too. But that's some of them.
- benjismith 11y agoNice! I haven't used rust yet, but I'm really excited about it. I think Mozilla Research is doing some of the most groundbreaking work in CS lately. The best part about rust is seeing the equally incredible work being done by the Servo team. To get a glimpse into some of their best work, here's a video where they talk about using the GPU to get better performance rendering a DOM than most native GUI toolkits can achieve on a sophisticated layout: https://air.mozilla.org/bay-area-rust-meetup-february-2016/#@25m50s https://air.mozilla.org/bay-area-rust-meetup-february-2016/#...
- nightpool 11y agoYes, absolutely, if you haven't seen the WebRender video already you need to watch it. I haven't been this excited about a new technology in a while.
- desireco42 11y ago250K for hello world example... where is this world going to! :) I am sure it can be trimmed, but we are getting oblivious to common sense a little. This is system language.
- tatterdemalion 11y agoBy default Rust statically links the standard library into every program. For binaries it also statically links to jemalloc by default to use as the allocator. This is a large constant factory that makes trivial programs significantly larger than C, but like all constant factors it becomes insignificant when n is larger. Binary size is not a major concern for most programs, even those written in a systems language. If it is a concern for your use case, you can use dynamic linking and the system allocator to get the size down to the same scale as C.
- Manishearth 11y agoThat 250K is additive, not multiplicative. Hello World, which might be 10K in C, will be 240K+10K=250K in Rust. A larger program that would be 2M in C would be 240K+2M in Rust; the significance of that 240K reduces when you write actual programs (instead of hello world). The size is due to a statically linked stdlib (also jemalloc, which you can decide not to use) -- your C program is tiny because your system has a stdlib it can dynamically link to. Rust can do this too, it's just not the default since in most cases this additive extra binary size isn't a problem. Being a systems language does mean we should forgo sensible defaults.
- mystikal 11y agoIn theory you could tell the compiler to identify and statically link only those functions needed to make printf work (or a conservative approximation thereof).
- danieldk 11y agoAs far as I know, jemalloc is a substantial part of that binary size. See e.g.: https://github.com/japaric/rust-on-openwrt/issues/1#issuecomment-108425440 https://github.com/japaric/rust-on-openwrt/issues/1#issuecom... https://github.com/japaric/std-with-cargo#making-rust-binaries-smaller https://github.com/japaric/std-with-cargo#making-rust-binari...
- mattgodbolt 11y agoAlso at http://rust.godbolt.org/ http://rust.godbolt.org/ should you wish to see the assembly code generated too.
- StreamBright 11y agoIs there any plans to have a stable version and do not introduce breaking changes after that? Something like 2.x is for Python. I could not find any reference so far.
- Ygg2 11y agoNot if there is bug in the soundness.
- GolDDranks 11y agoWe already have a stable version. The only breaking changes we are seeing are soundness-related bugfixes, and crates stop compiling because they rely on buggy behaviour.
- lorenzhs 11y agoThere was a recent effort by Google to speed up SipHash, it's called HighwayHash: https://github.com/google/highwayhash https://github.com/google/highwayhash - it includes a compatible, optimized SipHash implementation (1.5x speedup), a variation on that that is not compatible but similar, SipTreeHash (3x speedup on top of optimized implementation) and a new algorithm, HighwayHash, that yields another factor of 2-3. I haven't yet used it myself but it looks interesting and might be relevant to Rust? Edited to add that Google's implementation targets Haswell and later (AVX-2), I don't know about the performance of an implementation that targets older CPUs which would of course be very relevant for Rust
- jayflux 11y agoWhen will it reach homebrew?
- steveklabnik 11y agoLooks like 15 hours ago.