Skip to content

Rollup of 10 pull requests #30750

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Jan 7, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
e5a846e
Correct formatting use of tab instead of spaces
lawrencewoodman Jan 3, 2016
ff3ebfa
Mention that Sync/Send are automatically derived
steveklabnik Jan 4, 2016
723ead6
Mention that structs can contain &mut Ts
steveklabnik Jan 4, 2016
cd4bf34
Fix the spelling of "hexadecimal"
kraai Jan 5, 2016
011a23e
Update MinGW details in the README
steveklabnik Jan 4, 2016
7d6d39b
Clarify What LIFO Is
BChip Jan 5, 2016
ce6baa7
Clarify how Rust treats backslashes at end of line in string literals
tbu- Jan 5, 2016
4ea84fc
Remove irrelevant comment
huonw Jan 6, 2016
eb30c66
heap::deallocate expects a *mut u8 but here a *mut T is given. The fi…
Jan 6, 2016
4c90f5d
Rollup merge of #30683 - LawrenceWoodman:patch-1, r=steveklabnik
steveklabnik Jan 6, 2016
9239b64
Rollup merge of #30698 - steveklabnik:gh29649, r=brson
steveklabnik Jan 6, 2016
ba41e3c
Rollup merge of #30699 - steveklabnik:gh30254, r=apasel422
steveklabnik Jan 6, 2016
48e9d19
Rollup merge of #30700 - steveklabnik:gh28581, r=brson
steveklabnik Jan 6, 2016
23c88ff
Rollup merge of #30716 - kraai:fix-hexicdecimal, r=apasel422
steveklabnik Jan 6, 2016
eb41060
Rollup merge of #30720 - BChip:patch-1, r=steveklabnik
steveklabnik Jan 6, 2016
fcb1ccf
Rollup merge of #30727 - tbu-:pr_doc_escaped_newline, r=steveklabnik
steveklabnik Jan 6, 2016
d91518b
Rollup merge of #30729 - huonw:delete-bad-comment, r=sanxiyn
steveklabnik Jan 6, 2016
e78de13
Rollup merge of #30735 - jonastepe:nomicon_vec_dealloc_pointer_type, …
steveklabnik Jan 6, 2016
6cca775
Rollup merge of #30749 - andgra2:patch-1, r=steveklabnik
steveklabnik Jan 6, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 30 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ Read ["Installing Rust"] from [The Book].

### Building on Windows

There are two prominent ABIs in use on Windows: the native (MSVC) ABI used by
Visual Studio, and the GNU ABI used by the GCC toolchain. Which version of Rust
you need depends largely on what C/C++ libraries you want to interoperate with:
for interop with software produced by Visual Studio use the MSVC build of Rust;
for interop with GNU software built using the MinGW/MSYS2 toolchain use the GNU
build.


#### MinGW

[MSYS2](http://msys2.github.io/) can be used to easily build Rust on Windows:

1. Grab the latest MSYS2 installer and go through the installer.
Expand All @@ -63,12 +73,15 @@ Read ["Installing Rust"] from [The Book].
```sh
# Update package mirrors (may be needed if you have a fresh install of MSYS2)
$ pacman -Sy pacman-mirrors
```

# Choose one based on platform:
# *** see the note below ***
$ pacman -S mingw-w64-i686-toolchain
$ pacman -S mingw-w64-x86_64-toolchain
Download [MinGW from
here](http://mingw-w64.org/doku.php/download/mingw-builds), and choose the
`threads=win32,exceptions=dwarf/seh` flavor when installing. After installing,
add its `bin` directory to your `PATH`. This is due to #28260, in the future,
installing from pacman should be just fine.

```
# Make git available in MSYS2 (if not already available on path)
$ pacman -S git

Expand All @@ -84,16 +97,19 @@ Read ["Installing Rust"] from [The Book].
$ ./configure
$ make && make install
```
> ***Note:*** gcc versions >= 5 currently have issues building LLVM on Windows
> resulting in a segmentation fault when building Rust. In order to avoid this
> it may be necessary to obtain an earlier version of gcc such as 4.9.x.
> Msys's `pacman` will install the latest version, so for the time being it is
> recommended to skip gcc toolchain installation step above and use [Mingw-Builds]
> project's installer instead. Be sure to add gcc `bin` directory to the path
> before running `configure`.
> For more information on this see issue #28260.

[Mingw-Builds]: http://sourceforge.net/projects/mingw-w64/

#### MSVC

MSVC builds of Rust additionally require an installation of Visual Studio 2013
(or later) so `rustc` can use its linker. Make sure to check the “C++ tools”
option. In addition, `cmake` needs to be installed to build LLVM.

With these dependencies installed, the build takes two steps:

```sh
$ ./configure
$ make && make install
```

## Building Documentation

Expand Down
4 changes: 2 additions & 2 deletions src/doc/book/error-handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -1573,11 +1573,11 @@ fn main() {

let matches = match opts.parse(&args[1..]) {
Ok(m) => { m }
Err(e) => { panic!(e.to_string()) }
Err(e) => { panic!(e.to_string()) }
};
if matches.opt_present("h") {
print_usage(&program, opts);
return;
return;
}
let data_path = args[1].clone();
let city = args[2].clone();
Expand Down
29 changes: 29 additions & 0 deletions src/doc/book/structs.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,35 @@ fn main() {
}
```

Your structure can still contain `&mut` pointers, which will let
you do some kinds of mutation:

```rust
struct Point {
x: i32,
y: i32,
}

struct PointRef<'a> {
x: &'a mut i32,
y: &'a mut i32,
}

fn main() {
let mut point = Point { x: 0, y: 0 };

{
let r = PointRef { x: &mut point.x, y: &mut point.y };

*r.x = 5;
*r.y = 6;
}

assert_eq!(5, point.x);
assert_eq!(6, point.y);
}
```

# Update syntax

A `struct` can include `..` to indicate that you want to use a copy of some
Expand Down
2 changes: 1 addition & 1 deletion src/doc/book/the-stack-and-the-heap.md
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ instead.
# Which to use?

So if the stack is faster and easier to manage, why do we need the heap? A big
reason is that Stack-allocation alone means you only have LIFO semantics for
reason is that Stack-allocation alone means you only have 'Last In First Out (LIFO)' semantics for
reclaiming storage. Heap-allocation is strictly more general, allowing storage
to be taken from and returned to the pool in arbitrary order, but at a
complexity cost.
Expand Down
2 changes: 1 addition & 1 deletion src/doc/nomicon/vec-dealloc.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ impl<T> Drop for Vec<T> {
let elem_size = mem::size_of::<T>();
let num_bytes = elem_size * self.cap;
unsafe {
heap::deallocate(*self.ptr, num_bytes, align);
heap::deallocate(*self.ptr as *mut _, num_bytes, align);
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/doc/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,10 @@ A _string literal_ is a sequence of any Unicode characters enclosed within two
which must be _escaped_ by a preceding `U+005C` character (`\`).

Line-break characters are allowed in string literals. Normally they represent
themselves (i.e. no translation), but as a special exception, when a `U+005C`
character (`\`) occurs immediately before the newline, the `U+005C` character,
the newline, and all whitespace at the beginning of the next line are ignored.
Thus `a` and `b` are equal:
themselves (i.e. no translation), but as a special exception, when an unescaped
`U+005C` character (`\`) occurs immediately before the newline (`U+000A`), the
`U+005C` character, the newline, and all whitespace at the beginning of the
next line are ignored. Thus `a` and `b` are equal:

```rust
let a = "foobar";
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/char.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ pub unsafe fn from_u32_unchecked(i: u32) -> char {
///
/// A 'radix' here is sometimes also called a 'base'. A radix of two
/// indicates a binary number, a radix of ten, decimal, and a radix of
/// sixteen, hexicdecimal, to give some common values. Arbitrary
/// sixteen, hexadecimal, to give some common values. Arbitrary
/// radicum are supported.
///
/// `from_digit()` will return `None` if the input is not a digit in
Expand Down
4 changes: 4 additions & 0 deletions src/libcore/marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ use hash::Hash;
use hash::Hasher;

/// Types that can be transferred across thread boundaries.
///
/// This trait is automatically derived when the compiler determines it's appropriate.
#[stable(feature = "rust1", since = "1.0.0")]
#[lang = "send"]
#[rustc_on_unimplemented = "`{Self}` cannot be sent between threads safely"]
Expand Down Expand Up @@ -219,6 +221,8 @@ pub trait Copy : Clone {
/// wrapper around the value(s) which can be mutated when behind a `&`
/// reference; not doing this is undefined behavior (for example,
/// `transmute`-ing from `&T` to `&mut T` is invalid).
///
/// This trait is automatically derived when the compiler determines it's appropriate.
#[stable(feature = "rust1", since = "1.0.0")]
#[lang = "sync"]
#[rustc_on_unimplemented = "`{Self}` cannot be shared between threads safely"]
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_unicode/char.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ impl char {
///
/// A 'radix' here is sometimes also called a 'base'. A radix of two
/// indicates a binary number, a radix of ten, decimal, and a radix of
/// sixteen, hexicdecimal, to give some common values. Arbitrary
/// sixteen, hexadecimal, to give some common values. Arbitrary
/// radicum are supported.
///
/// Compared to `is_numeric()`, this function only recognizes the characters
Expand Down Expand Up @@ -185,7 +185,7 @@ impl char {
///
/// A 'radix' here is sometimes also called a 'base'. A radix of two
/// indicates a binary number, a radix of ten, decimal, and a radix of
/// sixteen, hexicdecimal, to give some common values. Arbitrary
/// sixteen, hexadecimal, to give some common values. Arbitrary
/// radicum are supported.
///
/// 'Digit' is defined to be only the following characters:
Expand Down
3 changes: 0 additions & 3 deletions src/libsyntax/parse/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -495,9 +495,6 @@ macro_rules! declare_special_idents_and_keywords {(
}

fn mk_fresh_ident_interner() -> IdentInterner {
// The indices here must correspond to the numbers in
// special_idents, in Keyword to_name(), and in static
// constants below.
let mut init_vec = Vec::new();
$(init_vec.push($si_str);)*
$(init_vec.push($sk_str);)*
Expand Down