commit | 096a28607fb80c91e6e2ca64d9ef44c4e550e96c | [log] [tgz] |
---|---|---|
author | Niko Matsakis <[email protected]> | Sat Dec 06 01:01:33 2014 |
committer | Niko Matsakis <[email protected]> | Mon Dec 08 18:47:44 2014 |
tree | 82c4ee8f20df133305959d507ec76adb4db5e324 | |
parent | c7a9b49d1b5d4e520f25355f26a93dfac4ffa146 [diff] |
librustc: Make `Copy` opt-in. This change makes the compiler no longer infer whether types (structures and enumerations) implement the `Copy` trait (and thus are implicitly copyable). Rather, you must implement `Copy` yourself via `impl Copy for MyType {}`. A new warning has been added, `missing_copy_implementations`, to warn you if a non-generic public type has been added that could have implemented `Copy` but didn't. For convenience, you may *temporarily* opt out of this behavior by using `#![feature(opt_out_copy)]`. Note though that this feature gate will never be accepted and will be removed by the time that 1.0 is released, so you should transition your code away from using it. This breaks code like: #[deriving(Show)] struct Point2D { x: int, y: int, } fn main() { let mypoint = Point2D { x: 1, y: 1, }; let otherpoint = mypoint; println!("{}{}", mypoint, otherpoint); } Change this code to: #[deriving(Show)] struct Point2D { x: int, y: int, } impl Copy for Point2D {} fn main() { let mypoint = Point2D { x: 1, y: 1, }; let otherpoint = mypoint; println!("{}{}", mypoint, otherpoint); } This is the backwards-incompatible part of #13231. Part of RFC #3. [breaking-change]
This is a compiler for Rust, including standard libraries, tools and documentation.
Note: Windows users can read the detailed using Rust on Windows notes on the wiki.
Make sure you have installed the dependencies:
g++
4.7 or clang++
3.xpython
2.6 or later (but not 3.x)perl
5.0 or latermake
3.81 or latercurl
git
Download and build Rust:
You can either download a tarball or build directly from the repo.
To build from the tarball do:
$ curl -O https://static.rust-lang.org/dist/rust-nightly.tar.gz $ tar -xzf rust-nightly.tar.gz $ cd rust-nightly
Or to build from the repo do:
$ git clone https://github.com/rust-lang/rust.git $ cd rust
Now that you have Rust's source code, you can configure and build it:
$ ./configure $ make && make install
Note: You may need to use
sudo make install
if you do not normally have permission to modify the destination directory. The install locations can be adjusted by passing a--prefix
argument toconfigure
. Various other options are also supported, pass--help
for more information on them.
When complete, make install
will place several programs into /usr/local/bin
: rustc
, the Rust compiler, and rustdoc
, the API-documentation tool.
Read the guide.
Enjoy!
To easily build on windows we can use MSYS2:
Grab the latest MSYS2 installer and go through the installer.
Now from the MSYS2 terminal we want to install the mingw64 toolchain and the other tools we need.
$ pacman -S mingw-w64-i686-toolchain $ pacman -S base-devel
With that now start mingw32_shell.bat
from where you installed MSYS2 (i.e. C:\msys
).
From there just navigate to where you have Rust's source code, configure and build it:
$ ./configure $ make && make install
Since the Rust compiler is written in Rust, it must be built by a precompiled “snapshot” version of itself (made in an earlier state of development). As such, source builds require a connection to the Internet, to fetch snapshots, and an OS that can execute the available snapshot binaries.
Snapshot binaries are currently built and tested on several platforms:
You may find that other platforms work, but these are our officially supported build environments that are most likely to work.
Rust currently needs about 1.5 GiB of RAM to build without swapping; if it hits swap, it will take a very long time to build.
There is a lot more documentation in the wiki.
The Rust community congregates in a few places:
Rust is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0), with portions covered by various BSD-like licenses.
See LICENSE-APACHE, LICENSE-MIT, and COPYRIGHT for details.