]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #30619 - steveklabnik:rollup, r=steveklabnik
authorbors <bors@rust-lang.org>
Tue, 29 Dec 2015 22:21:57 +0000 (22:21 +0000)
committerbors <bors@rust-lang.org>
Tue, 29 Dec 2015 22:21:57 +0000 (22:21 +0000)
- Successful merges: #30253, #30390, #30405, #30549, #30603, #30610
- Failed merges:

src/doc/book/macros.md
src/libcore/fmt/mod.rs
src/libcore/iter.rs
src/libcore/macros.rs
src/librustc_metadata/loader.rs
src/librustc_resolve/diagnostics.rs

index e4a900a2b1a4f8c79b9d7e538460d64680d4878e..7c8b74bd6495d0f44cf279a4c3daec98faa4b55e 100644 (file)
@@ -611,8 +611,7 @@ to define a single macro that works both inside and outside our library. The
 function name will expand to either `::increment` or `::mylib::increment`.
 
 To keep this system simple and correct, `#[macro_use] extern crate ...` may
-only appear at the root of your crate, not inside `mod`. This ensures that
-`$crate` is a single identifier.
+only appear at the root of your crate, not inside `mod`.
 
 # The deep end
 
index 04676c0c9c8b47547d2cb9c3cb22f421518fc176..628bf654873c7cfc7e8195fbf9d7146d607ef618 100644 (file)
@@ -356,7 +356,7 @@ fn fmt(&self, fmt: &mut Formatter) -> Result {
 /// `Debug` implementations using either `derive` or the debug builder API
 /// on `Formatter` support pretty printing using the alternate flag: `{:#?}`.
 ///
-/// [debug_struct]: ../std/fmt/struct.Formatter.html#method.debug_struct
+/// [debug_struct]: ../../std/fmt/struct.Formatter.html#method.debug_struct
 ///
 /// Pretty printing with `#?`:
 ///
index f063c6b06767b6edf9b794cfd5ed812fc0ce5659..526c2e1c6b523c4cb5acdcdf4fb1564fa65ca758 100644 (file)
@@ -604,7 +604,7 @@ fn chain<U>(self, other: U) -> Chain<Self, U::IntoIter> where
     /// iterators, returning a tuple where the first element comes from the
     /// first iterator, and the second element comes from the second iterator.
     ///
-    /// In other words, it zips two iterators together, into a single one. 🤐
+    /// In other words, it zips two iterators together, into a single one.
     ///
     /// When either iterator returns `None`, all further calls to `next()`
     /// will return `None`.
index 03d3cb11b3ed37fa93e9ff1c10d34c19fbeec377..154ca30c62dd148398744744912fed670a34ada3 100644 (file)
@@ -135,10 +135,10 @@ macro_rules! debug_assert {
     ($($arg:tt)*) => (if cfg!(debug_assertions) { assert!($($arg)*); })
 }
 
-/// Asserts that two expressions are equal to each other, testing equality in
-/// both directions.
+/// Asserts that two expressions are equal to each other.
 ///
-/// On panic, this macro will print the values of the expressions.
+/// On panic, this macro will print the values of the expressions with their
+/// debug representations.
 ///
 /// Unlike `assert_eq!`, `debug_assert_eq!` statements are only enabled in non
 /// optimized builds by default. An optimized build will omit all
index 81788e08c7ef2085135b3c90c59f2207cc8ff5d5..d1892b87f8bcc3b7d8d734f6bf76da960a64974d 100644 (file)
@@ -664,6 +664,8 @@ fn find_commandline_library(&mut self, locs: &[String]) -> Option<Library> {
                 }
                 sess.err(&format!("extern location for {} is of an unknown type: {}",
                                  self.crate_name, loc.display()));
+                sess.help(&format!("file name should be lib*.rlib or {}*.{}",
+                                   dylibname.0, dylibname.1));
                 false
             });
 
index 85fb5d9ccf9e5c1f554c7597dc22569811867091..04ab3fe70e9fabdea01732ec67a15b205bf09c21 100644 (file)
@@ -274,7 +274,7 @@ pub mod foo {
 "##,
 
 E0401: r##"
-Inner functions do not inherit type parameters from the functions they are
+Inner items do not inherit type parameters from the functions they are
 embedded in. For example, this will not compile:
 
 ```
@@ -286,12 +286,32 @@ fn bar(y: T) { // T is defined in the "outer" function
 }
 ```
 
-Functions inside functions are basically just like top-level functions, except
-that they can only be called from the function they are in.
+nor will this:
+
+```
+fn foo<T>(x: T) {
+    type MaybeT = Option<T>;
+    // ...
+}
+```
+
+or this:
+
+```
+fn foo<T>(x: T) {
+    struct Foo {
+        x: T,
+    }
+    // ...
+}
+```
+
+Items inside functions are basically just like top-level items, except
+that they can only be used from the function they are in.
 
 There are a couple of solutions for this.
 
-You can use a closure:
+If the item is a function, you may use a closure:
 
 ```
 fn foo<T>(x: T) {
@@ -302,7 +322,7 @@ fn foo<T>(x: T) {
 }
 ```
 
-or copy over the parameters:
+For a generic item, you can copy over the parameters:
 
 ```
 fn foo<T>(x: T) {
@@ -313,6 +333,12 @@ fn bar<T>(y: T) {
 }
 ```
 
+```
+fn foo<T>(x: T) {
+    type MaybeT<T> = Option<T>;
+}
+```
+
 Be sure to copy over any bounds as well:
 
 ```
@@ -324,10 +350,18 @@ fn bar<T: Copy>(y: T) {
 }
 ```
 
+```
+fn foo<T: Copy>(x: T) {
+    struct Foo<T: Copy> {
+        x: T,
+    }
+}
+```
+
 This may require additional type hints in the function body.
 
-In case the function is in an `impl`, defining a private helper function might
-be easier:
+In case the item is a function inside an `impl`, defining a private helper
+function might be easier:
 
 ```
 impl<T> Foo<T> {