From 8d5dcf9ce5425511720e77153aab665a7850f85a Mon Sep 17 00:00:00 2001 From: Thomas Winwood Date: Wed, 10 Feb 2016 11:36:10 +0000 Subject: [PATCH 01/13] Note rotate_{left,right} in wrapping_sh{lr} docs --- src/libcore/num/mod.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 9a9dfaa26797a..d094f05374b78 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -741,6 +741,13 @@ macro_rules! int_impl { /// where `mask` removes any high-order bits of `rhs` that /// would cause the shift to exceed the bitwidth of the type. /// + /// Note that this is *not* the same as a rotate-left; the + /// RHS of a wrapping shift-left is restricted to the range + /// of the type, rather than the bits shifted out of the LHS + /// being returned to the other end. The primitive integer + /// types all implement a `rotate_left` function, which may + /// be what you want instead. + /// /// # Examples /// /// Basic usage: @@ -759,6 +766,13 @@ macro_rules! int_impl { /// where `mask` removes any high-order bits of `rhs` that /// would cause the shift to exceed the bitwidth of the type. /// + /// Note that this is *not* the same as a rotate-right; the + /// RHS of a wrapping shift-right is restricted to the range + /// of the type, rather than the bits shifted out of the LHS + /// being returned to the other end. The primitive integer + /// types all implement a `rotate_right` function, which may + /// be what you want instead. + /// /// # Examples /// /// Basic usage: From cff81d724fa73003fe7e589a9433db33dde742a6 Mon Sep 17 00:00:00 2001 From: Oliver Middleton Date: Wed, 10 Feb 2016 14:53:42 +0000 Subject: [PATCH 02/13] Fix documentation example in the book The code sections shouldn't be inside a ```text block. --- src/doc/book/documentation.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/doc/book/documentation.md b/src/doc/book/documentation.md index ede3100194e5b..8d1e58ac17397 100644 --- a/src/doc/book/documentation.md +++ b/src/doc/book/documentation.md @@ -319,7 +319,7 @@ our source code: ```text First, we set `x` to five: - ```text + ```rust let x = 5; # let y = 6; # println!("{}", x + y); @@ -327,7 +327,7 @@ our source code: Next, we set `y` to six: - ```text + ```rust # let x = 5; let y = 6; # println!("{}", x + y); @@ -335,7 +335,7 @@ our source code: Finally, we print the sum of `x` and `y`: - ```text + ```rust # let x = 5; # let y = 6; println!("{}", x + y); From cec158b6b7c488c93f16bbe07b6082d5e4f2f7b1 Mon Sep 17 00:00:00 2001 From: "NODA, Kai" Date: Thu, 11 Feb 2016 00:55:47 +0800 Subject: [PATCH 03/13] doc: concat_idents! macro: more on its limitations. Signed-off-by: NODA, Kai --- src/libstd/macros.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index b7afd12d8e527..d241cd032ed4c 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -269,9 +269,10 @@ pub mod builtin { /// This macro takes any number of comma-separated identifiers, and /// concatenates them all into one, yielding an expression which is a new /// identifier. Note that hygiene makes it such that this macro cannot - /// capture local variables, and macros are only allowed in item, - /// statement or expression position, meaning this macro may be difficult to - /// use in some situations. + /// capture local variables. Also, as a general rule, macros are only + /// allowed in item, statement or expression position. That means while + /// you may use this macro for referring to existing variables, functions or + /// modules etc, you cannot define a new one with it. /// /// # Examples /// @@ -283,6 +284,8 @@ pub mod builtin { /// /// let f = concat_idents!(foo, bar); /// println!("{}", f()); + /// + /// // fn concat_idents!(new, fun, name) { } // not usable in this way! /// # } /// ``` #[stable(feature = "rust1", since = "1.0.0")] From c64088588a3f456b056b559a017850af39c5ff0a Mon Sep 17 00:00:00 2001 From: Scott Whittaker Date: Wed, 10 Feb 2016 22:28:32 -0500 Subject: [PATCH 04/13] mod.rs: fix typo "destructors" was misspelled. --- src/libstd/prelude/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstd/prelude/mod.rs b/src/libstd/prelude/mod.rs index a0db471deceb3..ebd299efa78db 100644 --- a/src/libstd/prelude/mod.rs +++ b/src/libstd/prelude/mod.rs @@ -55,7 +55,7 @@ //! * [`std::marker`]::{[`Copy`], [`Send`], [`Sized`], [`Sync`]}. The marker //! traits indicate fundamental properties of types. //! * [`std::ops`]::{[`Drop`], [`Fn`], [`FnMut`], [`FnOnce`]}. Various -//! operations for both destuctors and overloading `()`. +//! operations for both destructors and overloading `()`. //! * [`std::mem`]::[`drop`], a convenience function for explicitly dropping a //! value. //! * [`std::boxed`]::[`Box`], a way to allocate values on the heap. From 8f61a4b34c40e67e302b1abd84fd59a1a452e1e6 Mon Sep 17 00:00:00 2001 From: Sandeep Datta Date: Thu, 11 Feb 2016 11:16:47 +0530 Subject: [PATCH 05/13] Added a few words to indicate where the vector object is created. --- src/doc/book/ownership.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/doc/book/ownership.md b/src/doc/book/ownership.md index a62d31d362b14..175960f67b693 100644 --- a/src/doc/book/ownership.md +++ b/src/doc/book/ownership.md @@ -51,10 +51,11 @@ fn foo() { } ``` -When `v` comes into scope, a new [vector] is created, and it allocates space on -[the heap][heap] for each of its elements. When `v` goes out of scope at the -end of `foo()`, Rust will clean up everything related to the vector, even the -heap-allocated memory. This happens deterministically, at the end of the scope. +When `v` comes into scope, a new [vector] is created on [the stack][stack], +and it allocates space on [the heap][heap] for its elements. When `v` goes out +of scope at the end of `foo()`, Rust will clean up everything related to the +vector, even the heap-allocated memory. This happens deterministically, at the +end of the scope. We'll cover [vectors] in detail later in this chapter; we only use them here as an example of a type that allocates space on the heap at runtime. They @@ -67,6 +68,7 @@ Vectors have a [generic type][generics] `Vec`, so in this example `v` will ha [arrays]: primitive-types.html#arrays [vectors]: vectors.html [heap]: the-stack-and-the-heap.html +[stack]: the-stack-and-the-heap.html#the-stack [bindings]: variable-bindings.html [generics]: generics.html From 583f638a733965deb66c0c4db73718a1183a6189 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Thu, 11 Feb 2016 22:59:34 +0200 Subject: [PATCH 06/13] doc: add missing words --- src/libstd/ascii.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs index 38f79079b29f3..b5c01077a7bb9 100644 --- a/src/libstd/ascii.rs +++ b/src/libstd/ascii.rs @@ -45,7 +45,7 @@ pub trait AsciiExt { #[stable(feature = "rust1", since = "1.0.0")] type Owned; - /// Checks if within the ASCII range. + /// Checks if the value is within the ASCII range. /// /// # Examples /// From 2f20d5aa5f3392a38643f17683dd25c1dd7062c2 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Thu, 11 Feb 2016 23:05:00 +0200 Subject: [PATCH 07/13] doc: assert_eq on 2 boolean values is redundant --- src/libstd/ascii.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs index 38f79079b29f3..83cf670502f15 100644 --- a/src/libstd/ascii.rs +++ b/src/libstd/ascii.rs @@ -55,8 +55,8 @@ pub trait AsciiExt { /// let ascii = 'a'; /// let utf8 = '❤'; /// - /// assert_eq!(true, ascii.is_ascii()); - /// assert_eq!(false, utf8.is_ascii()) + /// assert!(ascii.is_ascii()); + /// assert!(!utf8.is_ascii()); /// ``` #[stable(feature = "rust1", since = "1.0.0")] fn is_ascii(&self) -> bool; @@ -114,9 +114,9 @@ pub trait AsciiExt { /// let ascii3 = 'A'; /// let ascii4 = 'z'; /// - /// assert_eq!(true, ascii1.eq_ignore_ascii_case(&ascii2)); - /// assert_eq!(true, ascii1.eq_ignore_ascii_case(&ascii3)); - /// assert_eq!(false, ascii1.eq_ignore_ascii_case(&ascii4)); + /// assert!(ascii1.eq_ignore_ascii_case(&ascii2)); + /// assert!(ascii1.eq_ignore_ascii_case(&ascii3)); + /// assert!(!ascii1.eq_ignore_ascii_case(&ascii4)); /// ``` #[stable(feature = "rust1", since = "1.0.0")] fn eq_ignore_ascii_case(&self, other: &Self) -> bool; From 0352bdf0cb5ce0db94d2b5c2435b4210ec3beeb3 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Thu, 11 Feb 2016 23:35:30 +0200 Subject: [PATCH 08/13] doc: skipping (obvious) details here is worth making this more nice to read --- src/libcollections/vec.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index 805d9a9807a33..1bc9e6588adb3 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -528,7 +528,7 @@ impl Vec { } /// Inserts an element at position `index` within the vector, shifting all - /// elements after position `i` one position to the right. + /// elements after it to the right. /// /// # Panics /// @@ -570,7 +570,7 @@ impl Vec { } /// Removes and returns the element at position `index` within the vector, - /// shifting all elements after position `index` one position to the left. + /// shifting all elements after it to the left. /// /// # Panics /// From 8bbb70cb94bfbe485e94994b2da35675597586c6 Mon Sep 17 00:00:00 2001 From: Jonathan Reem Date: Thu, 11 Feb 2016 17:24:57 -0800 Subject: [PATCH 09/13] Remove unnecessary bounds on Error and Display implementations for TryLockError and PoisonError. --- src/libstd/sys/common/poison.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/libstd/sys/common/poison.rs b/src/libstd/sys/common/poison.rs index 2cfa04c843b6b..d858c0027558c 100644 --- a/src/libstd/sys/common/poison.rs +++ b/src/libstd/sys/common/poison.rs @@ -111,7 +111,7 @@ impl fmt::Display for PoisonError { } #[stable(feature = "rust1", since = "1.0.0")] -impl Error for PoisonError { +impl Error for PoisonError { fn description(&self) -> &str { "poisoned lock: another task failed inside" } @@ -158,14 +158,17 @@ impl fmt::Debug for TryLockError { } #[stable(feature = "rust1", since = "1.0.0")] -impl fmt::Display for TryLockError { +impl fmt::Display for TryLockError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - self.description().fmt(f) + match *self { + TryLockError::Poisoned(..) => "poisoned lock: another task failed inside", + TryLockError::WouldBlock => "try_lock failed because the operation would block" + }.fmt(f) } } #[stable(feature = "rust1", since = "1.0.0")] -impl Error for TryLockError { +impl Error for TryLockError { fn description(&self) -> &str { match *self { TryLockError::Poisoned(ref p) => p.description(), From 4661dc83953ca0a9516ab4b4d2ff3e61187f76dd Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Fri, 12 Feb 2016 11:55:31 -0500 Subject: [PATCH 10/13] Remove incorrect documentation Fixes #31599 --- src/libcore/ptr.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index a826f2bb4440f..243f1a792cf0f 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -127,8 +127,6 @@ pub unsafe fn read(src: *const T) -> T { tmp } -/// Variant of read_and_zero that writes the specific drop-flag byte -/// (which may be more appropriate than zero). #[inline(always)] #[unstable(feature = "filling_drop", reason = "may play a larger role in std::ptr future extensions", From 9ec112749b7faeae7fcbdc529ab0de97c7dd3299 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sat, 13 Feb 2016 00:57:52 +0530 Subject: [PATCH 11/13] Clarify what tx/rx mean in concurrency docs --- src/doc/book/concurrency.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/doc/book/concurrency.md b/src/doc/book/concurrency.md index 44569a04b9824..752c097210243 100644 --- a/src/doc/book/concurrency.md +++ b/src/doc/book/concurrency.md @@ -286,6 +286,8 @@ use std::sync::mpsc; fn main() { let data = Arc::new(Mutex::new(0)); + // `tx` is the "transmitter" or "sender" + // `rx` is the "receiver" let (tx, rx) = mpsc::channel(); for _ in 0..10 { From eb0f9f81f02d6d4c849e7361a47eb62bead24ec7 Mon Sep 17 00:00:00 2001 From: Andrew Barchuk Date: Fri, 12 Feb 2016 21:40:02 +0200 Subject: [PATCH 12/13] Remove unnecessary article --- src/doc/book/using-rust-without-the-standard-library.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/book/using-rust-without-the-standard-library.md b/src/doc/book/using-rust-without-the-standard-library.md index 59182e1a4efce..2c7a097fe8045 100644 --- a/src/doc/book/using-rust-without-the-standard-library.md +++ b/src/doc/book/using-rust-without-the-standard-library.md @@ -11,7 +11,7 @@ don’t want to use the standard library via an attribute: `#![no_std]`. > For details on binaries without the standard library, see [the nightly > chapter on `#![no_std]`](no-stdlib.html) -To use `#![no_std]`, add a it to your crate root: +To use `#![no_std]`, add it to your crate root: ```rust #![no_std] From d3ca33fc6eadba8ddd8b87c7dd4b1def9f294a5d Mon Sep 17 00:00:00 2001 From: petevine Date: Sat, 13 Feb 2016 17:03:00 +0100 Subject: [PATCH 13/13] Add a new i586 Linux target --- mk/cfg/i586-unknown-linux-gnu.mk | 23 +++++++++++++++ .../target/i586_unknown_linux_gnu.rs | 28 +++++++++++++++++++ src/librustc_back/target/mod.rs | 1 + 3 files changed, 52 insertions(+) create mode 100644 mk/cfg/i586-unknown-linux-gnu.mk create mode 100644 src/librustc_back/target/i586_unknown_linux_gnu.rs diff --git a/mk/cfg/i586-unknown-linux-gnu.mk b/mk/cfg/i586-unknown-linux-gnu.mk new file mode 100644 index 0000000000000..0609f365de408 --- /dev/null +++ b/mk/cfg/i586-unknown-linux-gnu.mk @@ -0,0 +1,23 @@ +# i586-unknown-linux-gnu configuration +CC_i586-unknown-linux-gnu=$(CC) +CXX_i586-unknown-linux-gnu=$(CXX) +CPP_i586-unknown-linux-gnu=$(CPP) +AR_i586-unknown-linux-gnu=$(AR) +CFG_LIB_NAME_i586-unknown-linux-gnu=lib$(1).so +CFG_STATIC_LIB_NAME_i586-unknown-linux-gnu=lib$(1).a +CFG_LIB_GLOB_i586-unknown-linux-gnu=lib$(1)-*.so +CFG_LIB_DSYM_GLOB_i586-unknown-linux-gnu=lib$(1)-*.dylib.dSYM +CFG_JEMALLOC_CFLAGS_i586-unknown-linux-gnu := -m32 $(CFLAGS) +CFG_GCCISH_CFLAGS_i586-unknown-linux-gnu := -Wall -Werror -g -fPIC -m32 $(CFLAGS) +CFG_GCCISH_CXXFLAGS_i586-unknown-linux-gnu := -fno-rtti $(CXXFLAGS) +CFG_GCCISH_LINK_FLAGS_i586-unknown-linux-gnu := -shared -fPIC -ldl -pthread -lrt -g -m32 +CFG_GCCISH_DEF_FLAG_i586-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list= +CFG_LLC_FLAGS_i586-unknown-linux-gnu := +CFG_INSTALL_NAME_i586-unknown-linux-gnu = +CFG_EXE_SUFFIX_i586-unknown-linux-gnu = +CFG_WINDOWSY_i586-unknown-linux-gnu := +CFG_UNIXY_i586-unknown-linux-gnu := 1 +CFG_LDPATH_i586-unknown-linux-gnu := +CFG_RUN_i586-unknown-linux-gnu=$(2) +CFG_RUN_TARG_i586-unknown-linux-gnu=$(call CFG_RUN_i586-unknown-linux-gnu,,$(2)) +CFG_GNU_TRIPLE_i586-unknown-linux-gnu := i586-unknown-linux-gnu diff --git a/src/librustc_back/target/i586_unknown_linux_gnu.rs b/src/librustc_back/target/i586_unknown_linux_gnu.rs new file mode 100644 index 0000000000000..42d5674a2c869 --- /dev/null +++ b/src/librustc_back/target/i586_unknown_linux_gnu.rs @@ -0,0 +1,28 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use target::Target; + +pub fn target() -> Target { + let mut base = super::linux_base::opts(); + base.cpu = "pentium".to_string(); + base.pre_link_args.push("-m32".to_string()); + + Target { + llvm_target: "i586-unknown-linux-gnu".to_string(), + target_endian: "little".to_string(), + target_pointer_width: "32".to_string(), + arch: "x86".to_string(), + target_os: "linux".to_string(), + target_env: "gnu".to_string(), + target_vendor: "unknown".to_string(), + options: base, + } +} diff --git a/src/librustc_back/target/mod.rs b/src/librustc_back/target/mod.rs index 95b7c2e3f0748..a868178b14fb9 100644 --- a/src/librustc_back/target/mod.rs +++ b/src/librustc_back/target/mod.rs @@ -89,6 +89,7 @@ macro_rules! supported_targets { supported_targets! { ("x86_64-unknown-linux-gnu", x86_64_unknown_linux_gnu), ("i686-unknown-linux-gnu", i686_unknown_linux_gnu), + ("i586-unknown-linux-gnu", i586_unknown_linux_gnu), ("mips-unknown-linux-gnu", mips_unknown_linux_gnu), ("mipsel-unknown-linux-gnu", mipsel_unknown_linux_gnu), ("powerpc-unknown-linux-gnu", powerpc_unknown_linux_gnu),