Skip to content

Rollup of 4 pull requests #24813

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 14 commits into from
Apr 25, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
23 changes: 12 additions & 11 deletions src/doc/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,14 @@ explicit code point lists. [^inputformat]
## Special Unicode Productions

The following productions in the Rust grammar are defined in terms of Unicode
properties: `ident`, `non_null`, `non_star`, `non_eol`, `non_slash_or_star`,
`non_single_quote` and `non_double_quote`.
properties: `ident`, `non_null`, `non_eol`, `non_single_quote` and `non_double_quote`.

### Identifiers

The `ident` production is any nonempty Unicode string of the following form:
The `ident` production is any nonempty Unicode[^non_ascii_idents] string of the following form:

[^non_ascii_idents]: Non-ASCII characters in identifiers are currently feature
gated. This is expected to improve soon.

- The first character has property `XID_start`
- The remaining characters have property `XID_continue`
Expand All @@ -90,8 +92,6 @@ Some productions are defined by exclusion of particular Unicode characters:

- `non_null` is any single Unicode character aside from `U+0000` (null)
- `non_eol` is `non_null` restricted to exclude `U+000A` (`'\n'`)
- `non_star` is `non_null` restricted to exclude `U+002A` (`*`)
- `non_slash_or_star` is `non_null` restricted to exclude `U+002F` (`/`) and `U+002A` (`*`)
- `non_single_quote` is `non_null` restricted to exclude `U+0027` (`'`)
- `non_double_quote` is `non_null` restricted to exclude `U+0022` (`"`)

Expand Down Expand Up @@ -269,10 +269,11 @@ r##"foo #"# bar"##; // foo #"# bar
##### Byte literals

A _byte literal_ is a single ASCII character (in the `U+0000` to `U+007F`
range) enclosed within two `U+0027` (single-quote) characters, with the
exception of `U+0027` itself, which must be _escaped_ by a preceding U+005C
character (`\`), or a single _escape_. It is equivalent to a `u8` unsigned
8-bit integer _number literal_.
range) or a single _escape_ preceded by the characters `U+0062` (`b`) and
`U+0027` (single-quote), and followed by the character `U+0027`. If the character
`U+0027` is present within the literal, it must be _escaped_ by a preceding
`U+005C` (`\`) character. It is equivalent to a `u8` unsigned 8-bit integer
_number literal_.

##### Byte string literals

Expand Down Expand Up @@ -1976,7 +1977,7 @@ For any lint check `C`:

The lint checks supported by the compiler can be found via `rustc -W help`,
along with their default settings. [Compiler
plugins](book/plugins.html#lint-plugins) can provide additional lint checks.
plugins](book/compiler-plugins.html#lint-plugins) can provide additional lint checks.

```{.ignore}
mod m1 {
Expand Down Expand Up @@ -3646,4 +3647,4 @@ that have since been removed):
pattern syntax

[ffi]: book/ffi.html
[plugin]: book/plugins.html
[plugin]: book/compiler-plugins.html
2 changes: 1 addition & 1 deletion src/doc/trpl/getting-started.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
% Getting Started

This first section of the book will get you going with Rust and its tooling.
First, we’ll install Rust. Then: the classic ‘Hello World’ program. Finally,
First, we’ll install Rust. Then, the classic ‘Hello World’ program. Finally,
we’ll talk about Cargo, Rust’s build system and package manager.
2 changes: 1 addition & 1 deletion src/doc/trpl/glossary.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ In the example above `x` and `y` have arity 2. `z` has arity 3.

When a compiler is compiling your program, it does a number of different
things. One of the things that it does is turn the text of your program into an
'abstract syntax tree,' or 'AST.' This tree is a representation of the
abstract syntax tree’, orAST’. This tree is a representation of the
structure of your program. For example, `2 + 3` can be turned into a tree:

```text
Expand Down
14 changes: 7 additions & 7 deletions src/doc/trpl/primitive-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ let y = 1.0; // y has type f64
Here’s a list of the different numeric types, with links to their documentation
in the standard library:

* [i8](../std/primitive.i8.html)
* [i16](../std/primitive.i16.html)
* [i32](../std/primitive.i32.html)
* [i64](../std/primitive.i64.html)
* [i8](../std/primitive.i8.html)
* [u8](../std/primitive.u8.html)
* [u16](../std/primitive.u16.html)
* [u32](../std/primitive.u32.html)
* [u64](../std/primitive.u64.html)
* [u8](../std/primitive.u8.html)
* [isize](../std/primitive.isize.html)
* [usize](../std/primitive.usize.html)
* [f32](../std/primitive.f32.html)
Expand All @@ -82,12 +82,12 @@ Let’s go over them by category:
Integer types come in two varieties: signed and unsigned. To understand the
difference, let’s consider a number with four bits of size. A signed, four-bit
number would let you store numbers from `-8` to `+7`. Signed numbers use
two’s compliment representation. An unsigned four bit number, since it does
two’s compliment representation. An unsigned four bit number, since it does
not need to store negatives, can store values from `0` to `+15`.

Unsigned types use a `u` for their category, and signed types use `i`. The `i`
is for ‘integer’. So `u8` is an eight-bit unsigned number, and `i8` is an
eight-bit signed number.
eight-bit signed number.

## Fixed size types

Expand All @@ -103,7 +103,7 @@ and unsigned varieties. This makes for two types: `isize` and `usize`.

## Floating-point types

Rust also two floating point types: `f32` and `f64`. These correspond to
Rust also has two floating point types: `f32` and `f64`. These correspond to
IEEE-754 single and double precision numbers.

# Arrays
Expand Down Expand Up @@ -241,8 +241,8 @@ println!("x is {}", x);
Remember [before][let] when I said the left-hand side of a `let` statement was more
powerful than just assigning a binding? Here we are. We can put a pattern on
the left-hand side of the `let`, and if it matches up to the right-hand side,
we can assign multiple bindings at once. In this case, `let` "destructures,"
or "breaks up," the tuple, and assigns the bits to three bindings.
we can assign multiple bindings at once. In this case, `let` destructures
or breaks up the tuple, and assigns the bits to three bindings.

[let]: variable-bindings.html

Expand Down
2 changes: 1 addition & 1 deletion src/doc/trpl/variable-bindings.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
% Variable Bindings

Virtually every non-Hello World’ Rust program uses *variable bindings*. They
Virtually every non-'Hello World’ Rust program uses *variable bindings*. They
look like this:

```rust
Expand Down
10 changes: 10 additions & 0 deletions src/libstd/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1241,6 +1241,16 @@ impl Path {
///
/// Path::new("foo.txt");
/// ```
///
/// You can create `Path`s from `String`s, or even other `Path`s:
///
/// ```
/// use std::path::Path;
///
/// let s = String::from("bar.txt");
/// let p = Path::new(&s);
/// Path::new(&p);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn new<S: AsRef<OsStr> + ?Sized>(s: &S) -> &Path {
unsafe { mem::transmute(s.as_ref()) }
Expand Down