Skip to content
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

Rollup of 13 pull requests #35036

Closed
wants to merge 42 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
dbe6a09
First commit, fix ABI string docs in reference.md
ubsan Jun 24, 2016
1e899fd
Add vectorcall and fastcall explanation
ubsan Jun 25, 2016
3d03f75
Add more docs - mostly warnings - to std::mem::transmute
ubsan Jul 2, 2016
233b45f
Fix up some things which scott mentioned
ubsan Jul 2, 2016
6928bbb
Fix some other small nits
ubsan Jul 2, 2016
2413b52
More nits :P
ubsan Jul 2, 2016
377bbfe
Add a new alternative
ubsan Jul 2, 2016
9e94ebf
Make sure the documentation compiles
ubsan Jul 3, 2016
7ec44e6
Fix tests
ubsan Jul 5, 2016
8c7668a
Fix nits
ubsan Jul 5, 2016
15a49fe
Tone it down a little
ubsan Jul 5, 2016
451af79
Fix links, change example to english
ubsan Jul 5, 2016
297e396
Merge upstream/master: Fix a weird bug
ubsan Jul 6, 2016
7eabff5
Hopefully, it now works
ubsan Jul 6, 2016
b4ff6b0
document DoubleEndedIterator::next_back
durka Jul 9, 2016
97003e5
Switch around Examples and Alternatives
ubsan Jul 10, 2016
c0bee60
Make it nicer from @alexandermerritt
ubsan Jul 10, 2016
010e479
Merge guidelines from RFC 1567 into UX Guidelines.
Havvy Jul 17, 2016
b0de620
doc: add missing pause
tshepang Jul 16, 2016
24f8589
Fix nits
ubsan Jul 21, 2016
0d192c3
Update VecDeque documentation to specify direction of index 0 (#34920)
abhijeetbhagat Jul 22, 2016
ec33dab
Add HashMap Entry enums examples
GuillaumeGomez Jul 20, 2016
90bb8d4
Add DirBuilder doc examples
GuillaumeGomez Jul 22, 2016
6ebe6e8
Update underscore usage (#34903)
abhijeetbhagat Jul 23, 2016
ccc955c
Fix HashMap's values_mut example to use println!
rdwilliamson Jul 23, 2016
dad29a6
Add missing links
GuillaumeGomez Jul 24, 2016
1669963
Add DirEntry doc examples
GuillaumeGomez Jul 24, 2016
debb2ac
Improve Open doc
GuillaumeGomez Jul 24, 2016
96932cf
Remove no_stack_check tests (#34915)
abhijeetbhagat Jul 25, 2016
48fda61
Rollup merge of #34461 - ubsan:master, r=steveklabnik
steveklabnik Jul 25, 2016
ee771bf
Rollup merge of #34609 - ubsan:transmute_docs, r=steveklabnik
steveklabnik Jul 25, 2016
3f359d9
Rollup merge of #34732 - durka:patch-27, r=steveklabnik
steveklabnik Jul 25, 2016
31ffb92
Rollup merge of #34850 - tshepang:patch-3, r=steveklabnik
steveklabnik Jul 25, 2016
017517d
Rollup merge of #34894 - Havvy:patch-2, r=steveklabnik
steveklabnik Jul 25, 2016
637b63a
Rollup merge of #34935 - GuillaumeGomez:hash_map_doc, r=steveklabnik
steveklabnik Jul 25, 2016
7027fd9
Rollup merge of #34974 - abhijeetbhagat:patch-2, r=GuillaumeGomez
steveklabnik Jul 25, 2016
4d44503
Rollup merge of #34990 - abhijeetbhagat:patch-3, r=steveklabnik
steveklabnik Jul 25, 2016
8c810ef
Rollup merge of #34995 - GuillaumeGomez:dir_builder_doc, r=steveklabnik
steveklabnik Jul 25, 2016
c61da08
Rollup merge of #35001 - rdwilliamson:patch-1, r=alexcrichton
steveklabnik Jul 25, 2016
181d39d
Rollup merge of #35009 - GuillaumeGomez:dir_entry_doc, r=steveklabnik
steveklabnik Jul 25, 2016
dafbe97
Rollup merge of #35010 - GuillaumeGomez:file_doc, r=steveklabnik
steveklabnik Jul 25, 2016
e3e138b
Rollup merge of #35028 - abhijeetbhagat:patch-6, r=alexcrichton
steveklabnik Jul 25, 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
3 changes: 2 additions & 1 deletion src/doc/book/syntax-index.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
* `|` (`|…| expr`): closures. See [Closures].
* `|=` (`var |= expr`): bitwise or & assignment. Overloadable (`BitOrAssign`).
* `||` (`expr || expr`): logical or.
* `_`: "ignored" pattern binding. See [Patterns (Ignoring bindings)].
* `_`: "ignored" pattern binding (see [Patterns (Ignoring bindings)]). Also used to make integer-literals readable (see [Reference (Integer literals)]).

## Other Syntax

Expand Down Expand Up @@ -231,6 +231,7 @@
[Primitive Types (Tuples)]: primitive-types.html#tuples
[Raw Pointers]: raw-pointers.html
[Reference (Byte String Literals)]: ../reference.html#byte-string-literals
[Reference (Integer literals)]: ../reference.html#integer-literals
[Reference (Raw Byte String Literals)]: ../reference.html#raw-byte-string-literals
[Reference (Raw String Literals)]: ../reference.html#raw-string-literals
[References and Borrowing]: references-and-borrowing.html
Expand Down
3 changes: 1 addition & 2 deletions src/doc/nomicon/phantom-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct Vec<T> {
}
```

Unlike the previous example it *appears* that everything is exactly as we
Unlike the previous example, it *appears* that everything is exactly as we
want. Every generic argument to Vec shows up in at least one field.
Good to go!

Expand Down Expand Up @@ -84,4 +84,3 @@ standard library made a utility for itself called `Unique<T>` which:
* includes a `PhantomData<T>`
* auto-derives Send/Sync as if T was contained
* marks the pointer as NonZero for the null-pointer optimization

33 changes: 31 additions & 2 deletions src/doc/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -1653,14 +1653,43 @@ the Rust ABI and the foreign ABI.
A number of [attributes](#ffi-attributes) control the behavior of external blocks.

By default external blocks assume that the library they are calling uses the
standard C "cdecl" ABI. Other ABIs may be specified using an `abi` string, as
shown here:
standard C ABI on the specific platform. Other ABIs may be specified using an
`abi` string, as shown here:

```ignore
// Interface to the Windows API
extern "stdcall" { }
```

There are three ABI strings which are cross-platform, and which all compilers
are guaranteed to support:

* `extern "Rust"` -- The default ABI when you write a normal `fn foo()` in any
Rust code.
* `extern "C"` -- This is the same as `extern fn foo()`; whatever the default
your C compiler supports.
* `extern "system"` -- Usually the same as `extern "C"`, except on Win32, in
which case it's `"stdcall"`, or what you should use to link to the Windows API
itself

There are also some platform-specific ABI strings:

* `extern "cdecl"` -- The default for x86\_32 C code.
* `extern "stdcall"` -- The default for the Win32 API on x86\_32.
* `extern "win64"` -- The default for C code on x86\_64 Windows.
* `extern "aapcs"` -- The default for ARM.
* `extern "fastcall"` -- The `fastcall` ABI -- corresponds to MSVC's
`__fastcall` and GCC and clang's `__attribute__((fastcall))`
* `extern "vectorcall"` -- The `vectorcall` ABI -- corresponds to MSVC's
`__vectorcall` and clang's `__attribute__((vectorcall))`

Finally, there are some rustc-specific ABI strings:

* `extern "rust-intrinsic"` -- The ABI of rustc intrinsics.
* `extern "rust-call"` -- The ABI of the Fn::call trait functions.
* `extern "platform-intrinsic"` -- Specific platform intrinsics -- like, for
example, `sqrt` -- have this ABI. You should never have to deal with it.

The `link` attribute allows the name of the library to be specified. When
specified the compiler will attempt to link against the native library of the
specified name.
Expand Down
122 changes: 122 additions & 0 deletions src/doc/rustc-ux-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ Error explanations are long form descriptions of error messages provided with
the compiler. They are accessible via the `--explain` flag. Each explanation
comes with an example of how to trigger it and advice on how to fix it.

Long error codes explanations are a very important part of Rust. Having an
explanation of what failed helps to understand the error and is appreciated by
Rust developers of all skill levels.

* All of them are accessible [online](http://doc.rust-lang.org/error-index.html),
which are auto-generated from rustc source code in different places:
[librustc](https://github.com/rust-lang/rust/blob/master/src/librustc/diagnostics.rs),
Expand All @@ -74,6 +78,124 @@ code with backticks.
* When talking about the compiler, call it `the compiler`, not `Rust` or
`rustc`.

Note: The following sections are mostly a repaste of [RFC 1567](https://github.com/rust-lang/rfcs/blob/master/text/1567-long-error-codes-explanation-normalization.md).

### Template

Long error descriptions should match the following template. The next few
sections of this document describe what each section is about.

```rust
E000: r##"
[Error description]

Example of erroneous code:

\```compile_fail
[Minimal example]
\```

[Error explanation]

\```
[How to fix the problem]
\```

[Optional Additional information]
```

### Error description

Provide a more detailed error message. For example:

```rust
extern crate a;
extern crate b as a;
```

We get the `E0259` error code which says "an extern crate named `a` has already been imported in this module" and the error explanation says: "The name chosen for an external crate conflicts with another external crate that has been imported into the current module.".

### Minimal example

Provide an erroneous code example which directly follows `Error description`. The erroneous example will be helpful for the `How to fix the problem`. Making it as simple as possible is really important in order to help readers to understand what the error is about. A comment should be added with the error on the same line where the errors occur. Example:

```rust
type X = u32<i32>; // error: type parameters are not allowed on this type
```

If the error comments is too long to fit 80 columns, split it up like this, so the next line start at the same column of the previous line:

```rust
type X = u32<'static>; // error: lifetime parameters are not allowed on
// this type
```

And if the sample code is too long to write an effective comment, place your comment on the line before the sample code:

```rust
// error: lifetime parameters are not allowed on this type
fn super_long_function_name_and_thats_problematic() {}
```

Of course, it the comment is too long, the split rules still applies.

### Error explanation

Provide a full explanation about "__why__ you get the error" and some leads on __how__ to fix it. If needed, use additional code snippets to improve your explanations.

### How to fix the problem

This part will show how to fix the error that we saw previously in the `Minimal example`, with comments explaining how it was fixed.

### Additional information

Some details which might be useful for the users, let's take back `E0109` example. At the end, the supplementary explanation is the following: "Note that type parameters for enum-variant constructors go after the variant, not after the enum (`Option::None::<u32>`, not `Option::<u32>::None`).". It provides more information, not directly linked to the error, but it might help user to avoid doing another error.

### Full Example

Now let's take a full example:

> E0409: r##"
> An "or" pattern was used where the variable bindings are not consistently bound
> across patterns.
>
> Example of erroneous code:
>
> ```compile_fail
> let x = (0, 2);
> match x {
> (0, ref y) | (y, 0) => { /* use y */} // error: variable `y` is bound with
> // different mode in pattern #2
> // than in pattern #1
> _ => ()
> }
> ```
>
> Here, `y` is bound by-value in one case and by-reference in the other.
>
> To fix this error, just use the same mode in both cases.
> Generally using `ref` or `ref mut` where not already used will fix this:
>
> ```ignore
> let x = (0, 2);
> match x {
> (0, ref y) | (ref y, 0) => { /* use y */}
> _ => ()
> }
> ```
>
> Alternatively, split the pattern:
>
> ```
> let x = (0, 2);
> match x {
> (y, 0) => { /* use y */ }
> (0, ref y) => { /* use y */}
> _ => ()
> }
> ```
> "##,

## Compiler Flags

* Flags should be orthogonal to each other. For example, if we'd have a
Expand Down
16 changes: 16 additions & 0 deletions src/libcollections/vec_deque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,8 @@ impl<T> VecDeque<T> {

/// Retrieves an element in the `VecDeque` by index.
///
/// Element at index 0 is the front of the queue.
///
/// # Examples
///
/// ```
Expand All @@ -425,6 +427,8 @@ impl<T> VecDeque<T> {

/// Retrieves an element in the `VecDeque` mutably by index.
///
/// Element at index 0 is the front of the queue.
///
/// # Examples
///
/// ```
Expand Down Expand Up @@ -456,6 +460,8 @@ impl<T> VecDeque<T> {
///
/// Fails if there is no element with either index.
///
/// Element at index 0 is the front of the queue.
///
/// # Examples
///
/// ```
Expand Down Expand Up @@ -1180,6 +1186,8 @@ impl<T> VecDeque<T> {
///
/// Returns `None` if `index` is out of bounds.
///
/// Element at index 0 is the front of the queue.
///
/// # Examples
///
/// ```
Expand Down Expand Up @@ -1214,6 +1222,8 @@ impl<T> VecDeque<T> {
///
/// Returns `None` if `index` is out of bounds.
///
/// Element at index 0 is the front of the queue.
///
/// # Examples
///
/// ```
Expand Down Expand Up @@ -1245,6 +1255,8 @@ impl<T> VecDeque<T> {
/// end is closer to the insertion point will be moved to make room,
/// and all the affected elements will be moved to new positions.
///
/// Element at index 0 is the front of the queue.
///
/// # Panics
///
/// Panics if `index` is greater than `VecDeque`'s length
Expand Down Expand Up @@ -1472,6 +1484,8 @@ impl<T> VecDeque<T> {
/// room, and all the affected elements will be moved to new positions.
/// Returns `None` if `index` is out of bounds.
///
/// Element at index 0 is the front of the queue.
///
/// # Examples
///
/// ```
Expand Down Expand Up @@ -1651,6 +1665,8 @@ impl<T> VecDeque<T> {
///
/// Note that the capacity of `self` does not change.
///
/// Element at index 0 is the front of the queue.
///
/// # Panics
///
/// Panics if `at > len`
Expand Down
Loading