Skip to content

Commit 43403b4

Browse files
committed
Auto merge of #30750 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #30683, #30698, #30699, #30700, #30716, #30720, #30727, #30729, #30735, #30749 - Failed merges:
2 parents 5daa753 + 6cca775 commit 43403b4

File tree

11 files changed

+75
-29
lines changed

11 files changed

+75
-29
lines changed

README.md

+30-14
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,16 @@ Read ["Installing Rust"] from [The Book].
5353
5454
### Building on Windows
5555
56+
There are two prominent ABIs in use on Windows: the native (MSVC) ABI used by
57+
Visual Studio, and the GNU ABI used by the GCC toolchain. Which version of Rust
58+
you need depends largely on what C/C++ libraries you want to interoperate with:
59+
for interop with software produced by Visual Studio use the MSVC build of Rust;
60+
for interop with GNU software built using the MinGW/MSYS2 toolchain use the GNU
61+
build.
62+
63+
64+
#### MinGW
65+
5666
[MSYS2](http://msys2.github.io/) can be used to easily build Rust on Windows:
5767
5868
1. Grab the latest MSYS2 installer and go through the installer.
@@ -63,12 +73,15 @@ Read ["Installing Rust"] from [The Book].
6373
```sh
6474
# Update package mirrors (may be needed if you have a fresh install of MSYS2)
6575
$ pacman -Sy pacman-mirrors
76+
```
6677
67-
# Choose one based on platform:
68-
# *** see the note below ***
69-
$ pacman -S mingw-w64-i686-toolchain
70-
$ pacman -S mingw-w64-x86_64-toolchain
78+
Download [MinGW from
79+
here](http://mingw-w64.org/doku.php/download/mingw-builds), and choose the
80+
`threads=win32,exceptions=dwarf/seh` flavor when installing. After installing,
81+
add its `bin` directory to your `PATH`. This is due to #28260, in the future,
82+
installing from pacman should be just fine.
7183
84+
```
7285
# Make git available in MSYS2 (if not already available on path)
7386
$ pacman -S git
7487
@@ -84,16 +97,19 @@ Read ["Installing Rust"] from [The Book].
8497
$ ./configure
8598
$ make && make install
8699
```
87-
> ***Note:*** gcc versions >= 5 currently have issues building LLVM on Windows
88-
> resulting in a segmentation fault when building Rust. In order to avoid this
89-
> it may be necessary to obtain an earlier version of gcc such as 4.9.x.
90-
> Msys's `pacman` will install the latest version, so for the time being it is
91-
> recommended to skip gcc toolchain installation step above and use [Mingw-Builds]
92-
> project's installer instead. Be sure to add gcc `bin` directory to the path
93-
> before running `configure`.
94-
> For more information on this see issue #28260.
95-
96-
[Mingw-Builds]: http://sourceforge.net/projects/mingw-w64/
100+
101+
#### MSVC
102+
103+
MSVC builds of Rust additionally require an installation of Visual Studio 2013
104+
(or later) so `rustc` can use its linker. Make sure to check the “C++ tools”
105+
option. In addition, `cmake` needs to be installed to build LLVM.
106+
107+
With these dependencies installed, the build takes two steps:
108+
109+
```sh
110+
$ ./configure
111+
$ make && make install
112+
```
97113

98114
## Building Documentation
99115

src/doc/book/error-handling.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1573,11 +1573,11 @@ fn main() {
15731573
15741574
let matches = match opts.parse(&args[1..]) {
15751575
Ok(m) => { m }
1576-
Err(e) => { panic!(e.to_string()) }
1576+
Err(e) => { panic!(e.to_string()) }
15771577
};
15781578
if matches.opt_present("h") {
15791579
print_usage(&program, opts);
1580-
return;
1580+
return;
15811581
}
15821582
let data_path = args[1].clone();
15831583
let city = args[2].clone();

src/doc/book/structs.md

+29
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,35 @@ fn main() {
8888
}
8989
```
9090

91+
Your structure can still contain `&mut` pointers, which will let
92+
you do some kinds of mutation:
93+
94+
```rust
95+
struct Point {
96+
x: i32,
97+
y: i32,
98+
}
99+
100+
struct PointRef<'a> {
101+
x: &'a mut i32,
102+
y: &'a mut i32,
103+
}
104+
105+
fn main() {
106+
let mut point = Point { x: 0, y: 0 };
107+
108+
{
109+
let r = PointRef { x: &mut point.x, y: &mut point.y };
110+
111+
*r.x = 5;
112+
*r.y = 6;
113+
}
114+
115+
assert_eq!(5, point.x);
116+
assert_eq!(6, point.y);
117+
}
118+
```
119+
91120
# Update syntax
92121

93122
A `struct` can include `..` to indicate that you want to use a copy of some

src/doc/book/the-stack-and-the-heap.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ instead.
539539
# Which to use?
540540

541541
So if the stack is faster and easier to manage, why do we need the heap? A big
542-
reason is that Stack-allocation alone means you only have LIFO semantics for
542+
reason is that Stack-allocation alone means you only have 'Last In First Out (LIFO)' semantics for
543543
reclaiming storage. Heap-allocation is strictly more general, allowing storage
544544
to be taken from and returned to the pool in arbitrary order, but at a
545545
complexity cost.

src/doc/nomicon/vec-dealloc.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ impl<T> Drop for Vec<T> {
2121
let elem_size = mem::size_of::<T>();
2222
let num_bytes = elem_size * self.cap;
2323
unsafe {
24-
heap::deallocate(*self.ptr, num_bytes, align);
24+
heap::deallocate(*self.ptr as *mut _, num_bytes, align);
2525
}
2626
}
2727
}

src/doc/reference.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,10 @@ A _string literal_ is a sequence of any Unicode characters enclosed within two
208208
which must be _escaped_ by a preceding `U+005C` character (`\`).
209209

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

216216
```rust
217217
let a = "foobar";

src/libcore/char.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ pub unsafe fn from_u32_unchecked(i: u32) -> char {
181181
///
182182
/// A 'radix' here is sometimes also called a 'base'. A radix of two
183183
/// indicates a binary number, a radix of ten, decimal, and a radix of
184-
/// sixteen, hexicdecimal, to give some common values. Arbitrary
184+
/// sixteen, hexadecimal, to give some common values. Arbitrary
185185
/// radicum are supported.
186186
///
187187
/// `from_digit()` will return `None` if the input is not a digit in

src/libcore/marker.rs

+4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ use hash::Hash;
2424
use hash::Hasher;
2525

2626
/// Types that can be transferred across thread boundaries.
27+
///
28+
/// This trait is automatically derived when the compiler determines it's appropriate.
2729
#[stable(feature = "rust1", since = "1.0.0")]
2830
#[lang = "send"]
2931
#[rustc_on_unimplemented = "`{Self}` cannot be sent between threads safely"]
@@ -219,6 +221,8 @@ pub trait Copy : Clone {
219221
/// wrapper around the value(s) which can be mutated when behind a `&`
220222
/// reference; not doing this is undefined behavior (for example,
221223
/// `transmute`-ing from `&T` to `&mut T` is invalid).
224+
///
225+
/// This trait is automatically derived when the compiler determines it's appropriate.
222226
#[stable(feature = "rust1", since = "1.0.0")]
223227
#[lang = "sync"]
224228
#[rustc_on_unimplemented = "`{Self}` cannot be shared between threads safely"]

src/librustc_typeck/check/regionck.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
//!
6262
//! struct Foo { i: i32 }
6363
//! struct Bar { foo: Foo }
64-
//! fn get_i(x: &'a Bar) -> &'a i32 {
64+
//! fn get_i<'a>(x: &'a Bar) -> &'a i32 {
6565
//! let foo = &x.foo; // Lifetime L1
6666
//! &foo.i // Lifetime L2
6767
//! }

src/librustc_unicode/char.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ impl char {
126126
///
127127
/// A 'radix' here is sometimes also called a 'base'. A radix of two
128128
/// indicates a binary number, a radix of ten, decimal, and a radix of
129-
/// sixteen, hexicdecimal, to give some common values. Arbitrary
129+
/// sixteen, hexadecimal, to give some common values. Arbitrary
130130
/// radicum are supported.
131131
///
132132
/// Compared to `is_numeric()`, this function only recognizes the characters
@@ -185,7 +185,7 @@ impl char {
185185
///
186186
/// A 'radix' here is sometimes also called a 'base'. A radix of two
187187
/// indicates a binary number, a radix of ten, decimal, and a radix of
188-
/// sixteen, hexicdecimal, to give some common values. Arbitrary
188+
/// sixteen, hexadecimal, to give some common values. Arbitrary
189189
/// radicum are supported.
190190
///
191191
/// 'Digit' is defined to be only the following characters:

src/libsyntax/parse/token.rs

-3
Original file line numberDiff line numberDiff line change
@@ -495,9 +495,6 @@ macro_rules! declare_special_idents_and_keywords {(
495495
}
496496

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

0 commit comments

Comments
 (0)