Skip to content

Commit cd5f062

Browse files
committed
---
yaml --- r: 212919 b: refs/heads/master c: b87056f h: refs/heads/master i: 212917: 673b9d9 212915: eb282b2 212911: 586e3c0 v: v3
1 parent f87ef2a commit cd5f062

File tree

6 files changed

+32
-25
lines changed

6 files changed

+32
-25
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 520a471bc5da4ef30f60c0494c6889fe22bbbe2c
2+
refs/heads/master: b87056fa31b4c5926c2a0ad78613cf6387f8fdba
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: ba0e1cd8147d452c356aacb29fb87568ca26f111
55
refs/heads/try: 1864973ae17213c5a58c4dd3f9af6d1b6c7d2e05

trunk/src/doc/reference.md

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ apply to the crate as a whole.
638638
```
639639

640640
A crate that contains a `main` function can be compiled to an executable. If a
641-
`main` function is present, its return type must be [`unit`](#primitive-types)
641+
`main` function is present, its return type must be [`unit`](#tuple-types)
642642
and it must take no arguments.
643643

644644
# Items and attributes
@@ -928,20 +928,21 @@ A _generic function_ allows one or more _parameterized types_ to appear in its
928928
signature. Each type parameter must be explicitly declared, in an
929929
angle-bracket-enclosed, comma-separated list following the function name.
930930

931-
```rust,ignore
932-
// foo is generic over A and B
933-
934-
fn foo<A, B>(x: A, y: B) {
931+
```{.ignore}
932+
fn iter<T, F>(seq: &[T], f: F) where T: Copy, F: Fn(T) {
933+
for elt in seq { f(*elt); }
934+
}
935+
fn map<T, U, F>(seq: &[T], f: F) -> Vec<U> where T: Copy, U: Copy, F: Fn(T) -> U {
936+
let mut acc = vec![];
937+
for elt in seq { acc.push(f(*elt)); }
938+
acc
939+
}
935940
```
936941

937942
Inside the function signature and body, the name of the type parameter can be
938943
used as a type name. [Trait](#traits) bounds can be specified for type parameters
939944
to allow methods with that trait to be called on values of that type. This is
940-
specified using the `where` syntax:
941-
942-
```rust,ignore
943-
fn foo<T>(x: T) where T: Debug {
944-
```
945+
specified using the `where` syntax, as in the above example.
945946

946947
When a generic function is referenced, its type is instantiated based on the
947948
context of the reference. For example, calling the `iter` function defined
@@ -2873,7 +2874,7 @@ The `+`, `-`, `*`, `/`, `%`, `&`, `|`, `^`, `<<`, and `>>` operators may be
28732874
composed with the `=` operator. The expression `lval OP= val` is equivalent to
28742875
`lval = lval OP val`. For example, `x = x + 1` may be written as `x += 1`.
28752876

2876-
Any such expression always has the [`unit`](#primitive-types) type.
2877+
Any such expression always has the [`unit`](#tuple-types) type.
28772878

28782879
#### Operator precedence
28792880

@@ -3315,6 +3316,9 @@ assert!(b != "world");
33153316
assert!(p.0 == 10);
33163317
```
33173318

3319+
For historical reasons and convenience, the tuple type with no elements (`()`)
3320+
is often called ‘unit’ or ‘the unit type’.
3321+
33183322
### Array, and Slice types
33193323

33203324
Rust has two different types for a list of items:

trunk/src/doc/trpl/closures.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ let y = &mut num;
120120
```
121121

122122
If your closure requires it, however, Rust will take ownership and move
123-
the environment instead. This doesn’t work:
123+
the environment instead:
124124

125125
```rust,ignore
126126
let nums = vec![1, 2, 3];
@@ -130,7 +130,7 @@ let takes_nums = || nums;
130130
println!("{:?}", nums);
131131
```
132132

133-
We get this error:
133+
This gives us:
134134

135135
```text
136136
note: `nums` moved into closure environment here because it has type

trunk/src/doc/trpl/trait-objects.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,3 +300,7 @@ let y = TraitObject {
300300
// y.method();
301301
(y.vtable.method)(y.data);
302302
```
303+
304+
If `b` or `y` were owning trait objects (`Box<Foo>`), there would be a
305+
`(b.vtable.destructor)(b.data)` (respectively `y`) call when they went out of
306+
scope.

trunk/src/libcore/str/mod.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -638,10 +638,10 @@ impl<'a, P: Pattern<'a>> SplitInternal<'a, P> {
638638

639639
generate_pattern_iterators! {
640640
forward:
641-
#[doc="Created with the method `.split()`."]
641+
/// Created with the method `.split()`.
642642
struct Split;
643643
reverse:
644-
#[doc="Created with the method `.rsplit()`."]
644+
/// Created with the method `.rsplit()`.
645645
struct RSplit;
646646
stability:
647647
#[stable(feature = "rust1", since = "1.0.0")]
@@ -652,10 +652,10 @@ generate_pattern_iterators! {
652652

653653
generate_pattern_iterators! {
654654
forward:
655-
#[doc="Created with the method `.split_terminator()`."]
655+
/// Created with the method `.split_terminator()`.
656656
struct SplitTerminator;
657657
reverse:
658-
#[doc="Created with the method `.rsplit_terminator()`."]
658+
/// Created with the method `.rsplit_terminator()`.
659659
struct RSplitTerminator;
660660
stability:
661661
#[stable(feature = "rust1", since = "1.0.0")]
@@ -698,10 +698,10 @@ impl<'a, P: Pattern<'a>> SplitNInternal<'a, P> {
698698

699699
generate_pattern_iterators! {
700700
forward:
701-
#[doc="Created with the method `.splitn()`."]
701+
/// Created with the method `.splitn()`.
702702
struct SplitN;
703703
reverse:
704-
#[doc="Created with the method `.rsplitn()`."]
704+
/// Created with the method `.rsplitn()`.
705705
struct RSplitN;
706706
stability:
707707
#[stable(feature = "rust1", since = "1.0.0")]
@@ -732,10 +732,10 @@ impl<'a, P: Pattern<'a>> MatchIndicesInternal<'a, P> {
732732

733733
generate_pattern_iterators! {
734734
forward:
735-
#[doc="Created with the method `.match_indices()`."]
735+
/// Created with the method `.match_indices()`.
736736
struct MatchIndices;
737737
reverse:
738-
#[doc="Created with the method `.rmatch_indices()`."]
738+
/// Created with the method `.rmatch_indices()`.
739739
struct RMatchIndices;
740740
stability:
741741
#[unstable(feature = "core",
@@ -773,10 +773,10 @@ impl<'a, P: Pattern<'a>> MatchesInternal<'a, P> {
773773

774774
generate_pattern_iterators! {
775775
forward:
776-
#[doc="Created with the method `.matches()`."]
776+
/// Created with the method `.matches()`.
777777
struct Matches;
778778
reverse:
779-
#[doc="Created with the method `.rmatches()`."]
779+
/// Created with the method `.rmatches()`.
780780
struct RMatches;
781781
stability:
782782
#[unstable(feature = "core", reason = "type got recently added")]

trunk/src/librustc_back/sha2.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,6 @@ pub struct Sha256 {
482482

483483
impl Sha256 {
484484
/// Construct a new instance of a SHA-256 digest.
485-
/// Do not – under any circumstances – use this where timing attacks might be possible!
486485
pub fn new() -> Sha256 {
487486
Sha256 {
488487
engine: Engine256::new(&H256)

0 commit comments

Comments
 (0)