Skip to content

Commit 42c3544

Browse files
committed
---
yaml --- r: 122739 b: refs/heads/snap-stage3 c: 7c92735 h: refs/heads/master i: 122737: 381c032 122735: b8a7da8 v: v3
1 parent 683da2b commit 42c3544

File tree

5 files changed

+54
-1
lines changed

5 files changed

+54
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 1bff1ff810dcfa8064c11e2b84473f053d1f69f1
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: f89cc11827a36e6d1eb4e22322a51eb9b1153450
4+
refs/heads/snap-stage3: 7c92735f08711cf15dd2dbdbd6119d49ae765807
55
refs/heads/try: 2e9d9477b848cec778ca3f07ecdf0aea6ade23de
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libcore/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ pub mod simd;
122122
pub mod slice;
123123
pub mod str;
124124
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;
125129
pub mod fmt;
126130

127131
#[doc(hidden)]

branches/snap-stage3/src/libcore/tuple.rs renamed to branches/snap-stage3/src/libcore/tuple/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@
6161
6262
#![doc(primitive = "tuple")]
6363

64+
pub use unit;
65+
6466
use clone::Clone;
6567
use cmp::*;
6668
use default::Default;
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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+
//! ```

branches/snap-stage3/src/libstd/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@ pub use core::ptr;
160160
pub use core::raw;
161161
pub use core::simd;
162162
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;
163166
#[cfg(not(test))] pub use core::ty;
164167
pub use core::result;
165168
pub use core::option;

0 commit comments

Comments
 (0)