Skip to content

Rollup of 15 pull requests #35053

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 46 commits into from
Jul 27, 2016
Merged
Changes from all commits
Commits
Show all changes
46 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
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
f694809
Fixed missing comma in the csv dumper.
eulerdisk Jul 25, 2016
a139772
Rewrite/expansion of `slice::split` doc examples.
frewsxcv Jul 25, 2016
47db8de
doc/book/trait-objects: remove empty lines at start of examples
rahiel Jul 26, 2016
493cb97
Rollup merge of #34461 - ubsan:master, r=steveklabnik
steveklabnik Jul 26, 2016
4c95b66
Rollup merge of #34609 - ubsan:transmute_docs, r=steveklabnik
steveklabnik Jul 26, 2016
f573888
Rollup merge of #34732 - durka:patch-27, r=steveklabnik
steveklabnik Jul 26, 2016
a56741f
Rollup merge of #34850 - tshepang:patch-3, r=steveklabnik
steveklabnik Jul 26, 2016
69d282a
Rollup merge of #34935 - GuillaumeGomez:hash_map_doc, r=steveklabnik
steveklabnik Jul 26, 2016
c54fc13
Rollup merge of #34974 - abhijeetbhagat:patch-2, r=GuillaumeGomez
steveklabnik Jul 26, 2016
96108bb
Rollup merge of #34990 - abhijeetbhagat:patch-3, r=steveklabnik
steveklabnik Jul 26, 2016
ae05e62
Rollup merge of #34995 - GuillaumeGomez:dir_builder_doc, r=steveklabnik
steveklabnik Jul 26, 2016
905e35f
Rollup merge of #35001 - rdwilliamson:patch-1, r=alexcrichton
steveklabnik Jul 26, 2016
57d5029
Rollup merge of #35009 - GuillaumeGomez:dir_entry_doc, r=steveklabnik
steveklabnik Jul 26, 2016
8de36f1
Rollup merge of #35010 - GuillaumeGomez:file_doc, r=steveklabnik
steveklabnik Jul 26, 2016
1a3c46f
Rollup merge of #35019 - frewsxcv:slice-split, r=GuillaumeGomez
steveklabnik Jul 26, 2016
a47ffc0
Rollup merge of #35028 - abhijeetbhagat:patch-6, r=alexcrichton
steveklabnik Jul 26, 2016
326444d
Rollup merge of #35029 - eulerdisk:fix_missing_comma_in_csv_dumper, r…
steveklabnik Jul 26, 2016
d64de04
Rollup merge of #35043 - rahiel:patch-1, r=nikomatsakis
steveklabnik Jul 26, 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
@@ -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

@@ -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
2 changes: 0 additions & 2 deletions src/doc/book/trait-objects.md
Original file line number Diff line number Diff line change
@@ -123,7 +123,6 @@ dispatch with trait objects by casting:
# trait Foo { fn method(&self) -> String; }
# impl Foo for u8 { fn method(&self) -> String { format!("u8: {}", *self) } }
# impl Foo for String { fn method(&self) -> String { format!("string: {}", *self) } }

fn do_something(x: &Foo) {
x.method();
}
@@ -140,7 +139,6 @@ or by coercing:
# trait Foo { fn method(&self) -> String; }
# impl Foo for u8 { fn method(&self) -> String { format!("u8: {}", *self) } }
# impl Foo for String { fn method(&self) -> String { format!("string: {}", *self) } }

fn do_something(x: &Foo) {
x.method();
}
3 changes: 1 addition & 2 deletions src/doc/nomicon/phantom-data.md
Original file line number Diff line number Diff line change
@@ -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!

@@ -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
@@ -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.
37 changes: 31 additions & 6 deletions src/libcollections/slice.rs
Original file line number Diff line number Diff line change
@@ -691,15 +691,40 @@ impl<T> [T] {
///
/// # Examples
///
/// Print the slice split by numbers divisible by 3 (i.e. `[10, 40]`,
/// `[20]`, `[50]`):
/// ```
/// let slice = [10, 40, 33, 20];
/// let mut iter = slice.split(|num| num % 3 == 0);
///
/// assert_eq!(iter.next().unwrap(), &[10, 40]);
/// assert_eq!(iter.next().unwrap(), &[20]);
/// assert!(iter.next().is_none());
/// ```
/// let v = [10, 40, 30, 20, 60, 50];
///
/// for group in v.split(|num| *num % 3 == 0) {
/// println!("{:?}", group);
/// }
/// If the first element is matched, an empty slice will be the first item
/// returned by the iterator. Similarly, if the last element in the slice
/// is matched, an empty slice will be the last item returned by the
/// iterator:
///
/// ```
/// let slice = [10, 40, 33];
/// let mut iter = slice.split(|num| num % 3 == 0);
///
/// assert_eq!(iter.next().unwrap(), &[10, 40]);
/// assert_eq!(iter.next().unwrap(), &[]);
/// assert!(iter.next().is_none());
/// ```
///
/// If two matched elements are directly adjacent, an empty slice will be
/// present between them:
///
/// ```
/// let slice = [10, 6, 33, 20];
/// let mut iter = slice.split(|num| num % 3 == 0);
///
/// assert_eq!(iter.next().unwrap(), &[10]);
/// assert_eq!(iter.next().unwrap(), &[]);
/// assert_eq!(iter.next().unwrap(), &[20]);
/// assert!(iter.next().is_none());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
16 changes: 16 additions & 0 deletions src/libcollections/vec_deque.rs
Original file line number Diff line number Diff line change
@@ -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
///
/// ```
@@ -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
///
/// ```
@@ -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
///
/// ```
@@ -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
///
/// ```
@@ -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
///
/// ```
@@ -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
@@ -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
///
/// ```
@@ -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`
Loading