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/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 { 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); 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 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] 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 /// 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: 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", 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), diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs index 38f79079b29f3..8cabdc41a0583 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 /// @@ -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; 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")] 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. 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(),