From c40866785f6eac48eb00ed19d8e0121968dd72cd Mon Sep 17 00:00:00 2001 From: Johannes Oertel Date: Wed, 27 May 2015 11:28:41 +0200 Subject: [PATCH 1/9] Remove build date from the output of --version Closes #25812. --- mk/main.mk | 4 ---- src/librustc_driver/lib.rs | 5 ----- 2 files changed, 9 deletions(-) diff --git a/mk/main.mk b/mk/main.mk index de5adfd129786..76189b9c6aeb2 100644 --- a/mk/main.mk +++ b/mk/main.mk @@ -74,9 +74,6 @@ ifneq ($(wildcard $(subst $(SPACE),\$(SPACE),$(CFG_GIT_DIR))),) endif endif -CFG_BUILD_DATE = $(shell date +%F) -CFG_VERSION += (built $(CFG_BUILD_DATE)) - # Windows exe's need numeric versions - don't use anything but # numbers and dots here CFG_VERSION_WIN = $(CFG_RELEASE_NUM) @@ -334,7 +331,6 @@ endif ifdef CFG_VER_HASH export CFG_VER_HASH endif -export CFG_BUILD_DATE export CFG_VERSION export CFG_VERSION_WIN export CFG_RELEASE diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index d91a26ed4ee9b..49879b472feb7 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -483,10 +483,6 @@ pub fn commit_date_str() -> Option<&'static str> { option_env!("CFG_VER_DATE") } -pub fn build_date_str() -> Option<&'static str> { - option_env!("CFG_BUILD_DATE") -} - /// Prints version information and returns None on success or an error /// message on panic. pub fn version(binary: &str, matches: &getopts::Matches) { @@ -498,7 +494,6 @@ pub fn version(binary: &str, matches: &getopts::Matches) { println!("binary: {}", binary); println!("commit-hash: {}", unw(commit_hash_str())); println!("commit-date: {}", unw(commit_date_str())); - println!("build-date: {}", unw(build_date_str())); println!("host: {}", config::host_triple()); println!("release: {}", unw(release_str())); } From 6cb061721cd044f15f87fb65102f19b70601e179 Mon Sep 17 00:00:00 2001 From: Ulrik Sverdrup Date: Sun, 31 May 2015 22:35:34 +0200 Subject: [PATCH 2/9] trpl: Fix typo in Raw Pointers chapter --- src/doc/trpl/raw-pointers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/trpl/raw-pointers.md b/src/doc/trpl/raw-pointers.md index 4a37af3c22782..0f189adf40abf 100644 --- a/src/doc/trpl/raw-pointers.md +++ b/src/doc/trpl/raw-pointers.md @@ -77,7 +77,7 @@ For more operations on raw pointers, see [their API documentation][rawapi]. # FFI Raw pointers are useful for FFI: Rust’s `*const T` and `*mut T` are similar to -C’s `const T*` and `T*`, respectfully. For more about this use, consult the +C’s `const T*` and `T*`, respectively. For more about this use, consult the [FFI chapter][ffi]. [ffi]: ffi.html From 0ac24d6bffd2381358c164969f002b2c9f3c1316 Mon Sep 17 00:00:00 2001 From: Ulrik Sverdrup Date: Sun, 31 May 2015 22:46:19 +0200 Subject: [PATCH 3/9] rustdoc: Tweak css of function where clauses Method where clauses are put indented on a new line, do the same tweak to free functions, which makes it cleaner and easier to read. --- src/librustdoc/html/static/main.css | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/librustdoc/html/static/main.css b/src/librustdoc/html/static/main.css index 575322e63526d..aaebdc34cd464 100644 --- a/src/librustdoc/html/static/main.css +++ b/src/librustdoc/html/static/main.css @@ -338,10 +338,10 @@ nav.sub { font-size: 1em; position: relative; } -/* Shift "where ..." part of method definition down a line */ -.content .method .where { display: block; } +/* Shift "where ..." part of method or fn definition down a line */ +.content .method .where, .content .fn .where { display: block; } /* Bit of whitespace to indent it */ -.content .method .where::before { content: ' '; } +.content .method .where::before, .content .fn .where::before { content: ' '; } .content .methods > div { margin-left: 40px; } From 3af8e14cd13090d7630b40bf7515d228e3bd8fa9 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Mon, 1 Jun 2015 00:26:11 +0200 Subject: [PATCH 4/9] doc: make String::as_bytes example more simple --- src/libcollections/string.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index 7563bb76b52f8..c328a58f0770e 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -495,8 +495,7 @@ impl String { /// /// ``` /// let s = String::from("hello"); - /// let b: &[_] = &[104, 101, 108, 108, 111]; - /// assert_eq!(s.as_bytes(), b); + /// assert_eq!(s.as_bytes(), [104, 101, 108, 108, 111]); /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] From 5fefae684a6284244541dbe7c86da6b052181dfa Mon Sep 17 00:00:00 2001 From: Paul Oliver Date: Mon, 1 Jun 2015 12:44:50 +0200 Subject: [PATCH 5/9] trpl: Use infinite iterator in chain example with take --- src/doc/trpl/iterators.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/trpl/iterators.md b/src/doc/trpl/iterators.md index c391a0ea9b6ea..249c1cc7e34f6 100644 --- a/src/doc/trpl/iterators.md +++ b/src/doc/trpl/iterators.md @@ -321,7 +321,7 @@ You can chain all three things together: start with an iterator, adapt it a few times, and then consume the result. Check it out: ```rust -(1..1000) +(1..) .filter(|&x| x % 2 == 0) .filter(|&x| x % 3 == 0) .take(5) From 8221715b95c918bc7a4045207a4421aa403fdd1a Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Sun, 31 May 2015 09:37:52 +0200 Subject: [PATCH 6/9] doc: improve Option::map example --- src/libcore/option.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 8da28094be3ae..048955d4d8acf 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -409,9 +409,11 @@ impl Option { /// Convert an `Option` into an `Option`, consuming the original: /// /// ``` - /// let num_as_str: Option = Some("10".to_string()); - /// // `Option::map` takes self *by value*, consuming `num_as_str` - /// let num_as_int: Option = num_as_str.map(|n| n.len()); + /// let maybe_some_string = Some(String::from("Hello, World!")); + /// // `Option::map` takes self *by value*, consuming `maybe_some_string` + /// let maybe_some_len = maybe_some_string.map(|s| s.len()); + /// + /// assert_eq!(maybe_some_len, Some(13)); /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] From 321c2f4f8c6cb31d816f8b0b9d7bd25fe97481ab Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Sun, 24 May 2015 11:37:11 -0400 Subject: [PATCH 7/9] Add community translations. --- src/doc/index.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/doc/index.md b/src/doc/index.md index c4725c26e46bd..f561cf5d70f56 100644 --- a/src/doc/index.md +++ b/src/doc/index.md @@ -86,3 +86,14 @@ something if you know its name. If you encounter an error while compiling your code you may be able to look it up in the [Rust Compiler Error Index](error-index.html). + +# Community Translations + +Several projects have been started to translate the documentation into other +languages: + +- [Russian](https://github.com/kgv/rust_book_ru) +- [Korean](https://github.com/rust-kr/doc.rust-kr.org) +- [Chinese](https://github.com/KaiserY/rust-book-chinese) +- [Spanish](https://github.com/goyox86/elpr) + From 7d95c222448e0f74b3ff1b6df0447b3fb27e72de Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Mon, 1 Jun 2015 14:01:13 -0700 Subject: [PATCH 8/9] Stop passing the old ndebug/debug cfg directives As of rust-lang/rust#22980 only `cfg(debug_assertions)` is used in the standard library and rustc code. --- mk/main.mk | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mk/main.mk b/mk/main.mk index de5adfd129786..a8891ff4066c8 100644 --- a/mk/main.mk +++ b/mk/main.mk @@ -130,9 +130,7 @@ CFG_JEMALLOC_FLAGS += $(JEMALLOC_FLAGS) ifdef CFG_ENABLE_DEBUG_ASSERTIONS $(info cfg: enabling debug assertions (CFG_ENABLE_DEBUG_ASSERTIONS)) - CFG_RUSTC_FLAGS += --cfg debug -C debug-assertions=on -else - CFG_RUSTC_FLAGS += --cfg ndebug + CFG_RUSTC_FLAGS += -C debug-assertions=on endif ifdef CFG_ENABLE_DEBUGINFO From f44d287a769765862518c0de82d87bef4cca2670 Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Mon, 1 Jun 2015 14:59:30 -0700 Subject: [PATCH 9/9] Document behavior of {f32,f64}::{min,max} on NaN This is based on the documented behavior of cmath::{fmin,fmax}. It is also tested by existing unit tests in this module. --- src/libstd/num/f32.rs | 4 ++++ src/libstd/num/f64.rs | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/libstd/num/f32.rs b/src/libstd/num/f32.rs index e31d97b324038..c22f5d073de89 100644 --- a/src/libstd/num/f32.rs +++ b/src/libstd/num/f32.rs @@ -660,6 +660,8 @@ impl f32 { /// /// assert_eq!(x.max(y), y); /// ``` + /// + /// If one of the arguments is NaN, then the other argument is returned. #[stable(feature = "rust1", since = "1.0.0")] #[inline] pub fn max(self, other: f32) -> f32 { @@ -674,6 +676,8 @@ impl f32 { /// /// assert_eq!(x.min(y), x); /// ``` + /// + /// If one of the arguments is NaN, then the other argument is returned. #[stable(feature = "rust1", since = "1.0.0")] #[inline] pub fn min(self, other: f32) -> f32 { diff --git a/src/libstd/num/f64.rs b/src/libstd/num/f64.rs index e87855ffd4eed..cde0b567ade0f 100644 --- a/src/libstd/num/f64.rs +++ b/src/libstd/num/f64.rs @@ -636,6 +636,8 @@ impl f64 { /// /// assert_eq!(x.max(y), y); /// ``` + /// + /// If one of the arguments is NaN, then the other argument is returned. #[stable(feature = "rust1", since = "1.0.0")] #[inline] pub fn max(self, other: f64) -> f64 { @@ -650,6 +652,8 @@ impl f64 { /// /// assert_eq!(x.min(y), x); /// ``` + /// + /// If one of the arguments is NaN, then the other argument is returned. #[stable(feature = "rust1", since = "1.0.0")] #[inline] pub fn min(self, other: f64) -> f64 {