File tree Expand file tree Collapse file tree 5 files changed +54
-1
lines changed Expand file tree Collapse file tree 5 files changed +54
-1
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
5
5
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8
- refs/heads/try2: f89cc11827a36e6d1eb4e22322a51eb9b1153450
8
+ refs/heads/try2: 7c92735f08711cf15dd2dbdbd6119d49ae765807
9
9
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
10
10
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
11
11
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
Original file line number Diff line number Diff line change @@ -122,6 +122,10 @@ pub mod simd;
122
122
pub mod slice;
123
123
pub mod str;
124
124
pub mod tuple;
125
+ // FIXME #15320: primitive documentation needs top-level modules, this
126
+ // should be `core::tuple::unit`.
127
+ #[ path = "tuple/unit.rs" ]
128
+ pub mod unit;
125
129
pub mod fmt;
126
130
127
131
#[ doc( hidden) ]
Original file line number Diff line number Diff line change 61
61
62
62
#![ doc( primitive = "tuple" ) ]
63
63
64
+ pub use unit;
65
+
64
66
use clone:: Clone ;
65
67
use cmp:: * ;
66
68
use default:: Default ;
Original file line number Diff line number Diff line change
1
+ // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ #![ doc( primitive = "unit" ) ]
12
+
13
+ //! The `()` type, sometimes called "unit" or "nil".
14
+ //!
15
+ //! The `()` type has exactly one value `()`, and is used when there
16
+ //! is no other meaningful value that could be returned. `()` is most
17
+ //! commonly seen implicitly: functions without a `-> ...` implicitly
18
+ //! have return type `()`, that is, these are equivalent:
19
+ //!
20
+ //! ```rust
21
+ //! fn long() -> () {}
22
+ //!
23
+ //! fn short() {}
24
+ //! ```
25
+ //!
26
+ //! The semicolon `;` can be used to discard the result of an
27
+ //! expression at the end of a block, making the expression (and thus
28
+ //! the block) evaluate to `()`. For example,
29
+ //!
30
+ //! ```rust
31
+ //! fn returns_i64() -> i64 {
32
+ //! 1i64
33
+ //! }
34
+ //! fn returns_unit() {
35
+ //! 1i64;
36
+ //! }
37
+ //!
38
+ //! let is_i64 = {
39
+ //! returns_i64()
40
+ //! };
41
+ //! let is_unit = {
42
+ //! returns_i64();
43
+ //! };
44
+ //! ```
Original file line number Diff line number Diff line change @@ -160,6 +160,9 @@ pub use core::ptr;
160
160
pub use core:: raw;
161
161
pub use core:: simd;
162
162
pub use core:: tuple;
163
+ // FIXME #15320: primitive documentation needs top-level modules, this
164
+ // should be `std::tuple::unit`.
165
+ pub use core:: unit;
163
166
#[ cfg( not( test) ) ] pub use core:: ty;
164
167
pub use core:: result;
165
168
pub use core:: option;
You can’t perform that action at this time.
0 commit comments