Skip to content

Commit 32f9f42

Browse files
committed
Auto merge of #24869 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #24797, #24804, #24848, #24854, #24855, #24860, #24863, #24866, #24867, #24868 - Failed merges:
2 parents b772ce6 + 03f3b45 commit 32f9f42

File tree

10 files changed

+61
-31
lines changed

10 files changed

+61
-31
lines changed

src/doc/reference.md

+17-9
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ that does _not_ occur in the set of [keywords](#keywords).
8484
## Comments
8585

8686
Comments in Rust code follow the general C++ style of line (`//`) and
87-
block-comment (`/* ... */`) forms. Nested block comments are supported.
87+
block (`/* ... */`) comment forms. Nested block comments are supported.
8888

8989
Line comments beginning with exactly _three_ slashes (`///`), and block
9090
comments beginning with exactly one repeated asterisk in the block-open
@@ -192,13 +192,13 @@ which must be _escaped_ by a preceding `U+005C` character (`\`).
192192

193193
A _string literal_ is a sequence of any Unicode characters enclosed within two
194194
`U+0022` (double-quote) characters, with the exception of `U+0022` itself,
195-
which must be _escaped_ by a preceding `U+005C` character (`\`), or a _raw
196-
string literal_.
195+
which must be _escaped_ by a preceding `U+005C` character (`\`).
197196

198-
A multi-line string literal may be defined by terminating each line with a
199-
`U+005C` character (`\`) immediately before the newline. This causes the
200-
`U+005C` character, the newline, and all whitespace at the beginning of the
201-
next line to be ignored.
197+
Line-break characters are allowed in string literals. Normally they represent
198+
themselves (i.e. no translation), but as a special exception, when a `U+005C`
199+
character (`\`) occurs immediately before the newline, the `U+005C` character,
200+
the newline, and all whitespace at the beginning of the next line are ignored.
201+
Thus `a` and `b` are equal:
202202

203203
```rust
204204
let a = "foobar";
@@ -366,11 +366,19 @@ A _floating-point literal_ has one of two forms:
366366
optionally followed by another decimal literal, with an optional _exponent_.
367367
* A single _decimal literal_ followed by an _exponent_.
368368

369-
By default, a floating-point literal has a generic type, and, like integer
370-
literals, the type must be uniquely determined from the context. There are two valid
369+
Like integer literals, a floating-point literal may be followed by a
370+
suffix, so long as the pre-suffix part does not end with `U+002E` (`.`).
371+
The suffix forcibly sets the type of the literal. There are two valid
371372
_floating-point suffixes_, `f32` and `f64` (the 32-bit and 64-bit floating point
372373
types), which explicitly determine the type of the literal.
373374

375+
The type of an _unsuffixed_ floating-point literal is determined by type
376+
inference. If a floating-point type can be _uniquely_ determined from the
377+
surrounding program context, the unsuffixed floating-point literal has that type.
378+
If the program context underconstrains the type, it defaults to double-precision `f64`;
379+
if the program context overconstrains the type, it is considered a static type
380+
error.
381+
374382
Examples of floating-point literals of various forms:
375383

376384
```

src/doc/trpl/hello-cargo.md

+7
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ $ mkdir src
3232
$ mv main.rs src/main.rs
3333
```
3434

35+
Note that since we're creating an executable, we used `main.rs`. If we
36+
want to make a library instead, we should use `lib.rs`.
37+
Custom file locations for the entry point can be specified
38+
with a [`[[lib]]` or `[[bin]]`][crates-custom] key in the TOML file described below.
39+
40+
[crates-custom]: http://doc.crates.io/manifest.html#configuring-a-target
41+
3542
Cargo expects your source files to live inside a `src` directory. That leaves
3643
the top level for other things, like READMEs, license information, and anything
3744
not related to your code. Cargo helps us keep our projects nice and tidy. A

src/doc/trpl/vectors.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
% Vectors
22

33
A ‘vector’ is a dynamic or ‘growable’ array, implemented as the standard
4-
library type [`Vec<T>`][vec]. That `<T>` is a [generic][generic], meaning we
5-
can have vectors of any type. Vectors always allocate their data on the heap.
4+
library type [`Vec<T>`][vec]. The `T` means that we can have vectors
5+
of any type (see the chapter on [generics][generic] for more).
6+
Vectors always allocate their data on the heap.
67
You can create them with the `vec!` macro:
78

89
```rust

src/libcollections/string.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -951,12 +951,13 @@ impl<'a> Deref for DerefString<'a> {
951951
/// # #![feature(collections)]
952952
/// use std::string::as_string;
953953
///
954-
/// fn string_consumer(s: String) {
955-
/// assert_eq!(s, "foo".to_string());
954+
/// // Let's pretend we have a function that requires `&String`
955+
/// fn string_consumer(s: &String) {
956+
/// assert_eq!(s, "foo");
956957
/// }
957958
///
958-
/// let string = as_string("foo").clone();
959-
/// string_consumer(string);
959+
/// // Provide a `&String` from a `&str` without allocating
960+
/// string_consumer(&as_string("foo"));
960961
/// ```
961962
#[unstable(feature = "collections")]
962963
pub fn as_string<'a>(x: &'a str) -> DerefString<'a> {

src/libcollections/vec.rs

+17-1
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ impl<T> Vec<T> {
536536
///
537537
/// # Panics
538538
///
539-
/// Panics if `i` is out of bounds.
539+
/// Panics if `index` is out of bounds.
540540
///
541541
/// # Examples
542542
///
@@ -1915,6 +1915,22 @@ impl<'a, T> Drop for DerefVec<'a, T> {
19151915
}
19161916

19171917
/// Converts a slice to a wrapper type providing a `&Vec<T>` reference.
1918+
///
1919+
/// # Examples
1920+
///
1921+
/// ```
1922+
/// # #![feature(collections)]
1923+
/// use std::vec::as_vec;
1924+
///
1925+
/// // Let's pretend we have a function that requires `&Vec<i32>`
1926+
/// fn vec_consumer(s: &Vec<i32>) {
1927+
/// assert_eq!(s, &[1, 2, 3]);
1928+
/// }
1929+
///
1930+
/// // Provide a `&Vec<i32>` from a `&[i32]` without allocating
1931+
/// let values = [1, 2, 3];
1932+
/// vec_consumer(&as_vec(&values));
1933+
/// ```
19181934
#[unstable(feature = "collections")]
19191935
pub fn as_vec<'a, T>(x: &'a [T]) -> DerefVec<'a, T> {
19201936
unsafe {

src/libcore/convert.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,8 @@ pub trait Into<T>: Sized {
8383
/// `String` implements `From<&str>`:
8484
///
8585
/// ```
86-
/// let s = "hello";
8786
/// let string = "hello".to_string();
88-
///
89-
/// let other_string: String = From::from(s);
87+
/// let other_string = String::from("hello");
9088
///
9189
/// assert_eq!(string, other_string);
9290
/// ```

src/librustdoc/html/render.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1460,7 +1460,7 @@ impl<'a> fmt::Display for Item<'a> {
14601460
try!(write!(fmt, "<span class='out-of-band'>"));
14611461
try!(write!(fmt,
14621462
r##"<span id='render-detail'>
1463-
<a id="toggle-all-docs" href="#" title="collapse all docs">[-]</a>
1463+
<a id="toggle-all-docs" href="#" title="collapse all docs">[&minus;]</a>
14641464
</span>"##));
14651465

14661466
// Write `src` tag

src/librustdoc/html/static/main.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ a {
392392
text-decoration: underline;
393393
}
394394

395-
.content span.trait, .content a.trait, .block a.current.trait { color: #ed9603; }
395+
.content span.trait, .content a.trait, .block a.current.trait { color: #8866ff; }
396396
.content span.mod, .content a.mod, block a.current.mod { color: #4d76ae; }
397397
.content span.enum, .content a.enum, .block a.current.enum { color: #5e9766; }
398398
.content span.struct, .content a.struct, .block a.current.struct { color: #e53700; }

src/librustdoc/html/static/main.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -808,20 +808,20 @@
808808

809809
$("#toggle-all-docs").on("click", function() {
810810
var toggle = $("#toggle-all-docs");
811-
if (toggle.html() == "[-]") {
812-
toggle.html("[+]");
811+
if (toggle.html() == "[&minus;]") {
812+
toggle.html("[&plus;]");
813813
toggle.attr("title", "expand all docs");
814814
$(".docblock").hide();
815815
$(".toggle-label").show();
816816
$(".toggle-wrapper").addClass("collapsed");
817-
$(".collapse-toggle").children(".inner").html("+");
817+
$(".collapse-toggle").children(".inner").html("&plus;");
818818
} else {
819-
toggle.html("[-]");
819+
toggle.html("[&minus;]");
820820
toggle.attr("title", "collapse all docs");
821821
$(".docblock").show();
822822
$(".toggle-label").hide();
823823
$(".toggle-wrapper").removeClass("collapsed");
824-
$(".collapse-toggle").children(".inner").html("-");
824+
$(".collapse-toggle").children(".inner").html("&minus;");
825825
}
826826
});
827827

@@ -835,20 +835,20 @@
835835
if (relatedDoc.is(":visible")) {
836836
relatedDoc.slideUp({duration:'fast', easing:'linear'});
837837
toggle.parent(".toggle-wrapper").addClass("collapsed");
838-
toggle.children(".inner").html("+");
838+
toggle.children(".inner").html("&plus;");
839839
toggle.children(".toggle-label").fadeIn();
840840
} else {
841841
relatedDoc.slideDown({duration:'fast', easing:'linear'});
842842
toggle.parent(".toggle-wrapper").removeClass("collapsed");
843-
toggle.children(".inner").html("-");
843+
toggle.children(".inner").html("&minus;");
844844
toggle.children(".toggle-label").hide();
845845
}
846846
}
847847
});
848848

849849
$(function() {
850850
var toggle = $("<a/>", {'href': 'javascript:void(0)', 'class': 'collapse-toggle'})
851-
.html("[<span class='inner'>-</span>]");
851+
.html("[<span class='inner'>&minus;</span>]");
852852

853853
$(".method").each(function() {
854854
if ($(this).next().is(".docblock") ||

src/libstd/thread/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,7 @@
115115
//! ## Configuring threads
116116
//!
117117
//! A new thread can be configured before it is spawned via the `Builder` type,
118-
//! which currently allows you to set the name, stack size, and writers for
119-
//! `println!` and `panic!` for the child thread:
118+
//! which currently allows you to set the name and stack size for the child thread:
120119
//!
121120
//! ```rust
122121
//! # #![allow(unused_must_use)]

0 commit comments

Comments
 (0)