about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-10-28 10:20:55 -0700
committerGitHub <noreply@github.com>2016-10-28 10:20:55 -0700
commit421b595f25e5dbab9c967afd03929d013f346322 (patch)
tree0b59aec9588a4d629bf8ad15509f35d6ae33d9a1
parent36d746718086dfcc12f73562b1996daf2f8ba643 (diff)
parent61e765ad982c7b01753ebe9971b4ce407bbdb0d9 (diff)
Auto merge of #37450 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 5 pull requests

- Successful merges: #36206, #37343, #37430, #37436, #37441
- Failed merges:
-rw-r--r--src/doc/reference.md6
-rw-r--r--src/librustc_resolve/lib.rs2
-rw-r--r--src/librustc_save_analysis/dump_visitor.rs1
-rw-r--r--src/libstd/io/impls.rs11
-rw-r--r--src/libsyntax/parse/parser.rs11
-rw-r--r--src/libsyntax_ext/deriving/generic/mod.rs3
-rw-r--r--src/test/compile-fail/issue-12612.rs2
-rw-r--r--src/test/compile-fail/issue-1697.rs2
-rw-r--r--src/test/compile-fail/issue-36116.rs23
-rw-r--r--src/test/compile-fail/unresolved-import.rs2
10 files changed, 58 insertions, 5 deletions
diff --git a/src/doc/reference.md b/src/doc/reference.md
index 84f459bf872..80b60fbf0e3 100644
--- a/src/doc/reference.md
+++ b/src/doc/reference.md
@@ -4078,6 +4078,12 @@ be ignored in favor of only building the artifacts specified by command line.
   Rust code into an existing non-Rust application because it will not have
   dynamic dependencies on other Rust code.
 
+* `--crate-type=cdylib`, `#[crate_type = "cdylib"]` - A dynamic system
+  library will be produced.  This is used when compiling Rust code as
+  a dynamic library to be loaded from another language.  This output type will
+  create `*.so` files on Linux, `*.dylib` files on OSX, and `*.dll` files on
+  Windows.
+
 * `--crate-type=rlib`, `#[crate_type = "rlib"]` - A "Rust library" file will be
   produced. This is used as an intermediate artifact and can be thought of as a
   "static Rust library". These `rlib` files, unlike `staticlib` files, are
diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs
index d4900be5758..0b382fcbfdd 100644
--- a/src/librustc_resolve/lib.rs
+++ b/src/librustc_resolve/lib.rs
@@ -1401,7 +1401,7 @@ impl<'a> Resolver<'a> {
 
                                 format!("Did you mean `{}{}`?", prefix, path_str)
                             }
-                            None => format!("Maybe a missing `extern crate {}`?", segment_name),
+                            None => format!("Maybe a missing `extern crate {};`?", segment_name),
                         }
                     } else {
                         format!("Could not find `{}` in `{}`", segment_name, module_name)
diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs
index 53a5f319323..73d0e5e50c6 100644
--- a/src/librustc_save_analysis/dump_visitor.rs
+++ b/src/librustc_save_analysis/dump_visitor.rs
@@ -166,6 +166,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
                        loc.file.name,
                        loc.line);
             }
+            error!("    master span: {:?}: `{}`", path.span, self.span.snippet(path.span));
             return vec!();
         }
 
diff --git a/src/libstd/io/impls.rs b/src/libstd/io/impls.rs
index cd05e6b5de9..6b26c016638 100644
--- a/src/libstd/io/impls.rs
+++ b/src/libstd/io/impls.rs
@@ -147,6 +147,10 @@ impl<B: BufRead + ?Sized> BufRead for Box<B> {
 // =============================================================================
 // In-memory buffer implementations
 
+/// Read is implemented for `&[u8]` by copying from the slice.
+///
+/// Note that reading updates the slice to point to the yet unread part.
+/// The slice will be empty when EOF is reached.
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a> Read for &'a [u8] {
     #[inline]
@@ -180,6 +184,11 @@ impl<'a> BufRead for &'a [u8] {
     fn consume(&mut self, amt: usize) { *self = &self[amt..]; }
 }
 
+/// Write is implemented for `&mut [u8]` by copying into the slice, overwriting
+/// its data.
+///
+/// Note that writing updates the slice to point to the yet unwritten part.
+/// The slice will be empty when it has been completely overwritten.
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a> Write for &'a mut [u8] {
     #[inline]
@@ -204,6 +213,8 @@ impl<'a> Write for &'a mut [u8] {
     fn flush(&mut self) -> io::Result<()> { Ok(()) }
 }
 
+/// Write is implemented for `Vec<u8>` by appending to the vector.
+/// The vector will grow as needed.
 #[stable(feature = "rust1", since = "1.0.0")]
 impl Write for Vec<u8> {
     #[inline]
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index d8dff6b4aa0..da5d754b599 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -1757,6 +1757,17 @@ impl<'a> Parser<'a> {
             // First, parse an identifier.
             let identifier = self.parse_path_segment_ident()?;
 
+            if self.check(&token::ModSep) && self.look_ahead(1, |t| *t == token::Lt) {
+                self.bump();
+                let prev_span = self.prev_span;
+
+                let mut err = self.diagnostic().struct_span_err(prev_span,
+                    "unexpected token: `::`");
+                err.help(
+                    "use `<...>` instead of `::<...>` if you meant to specify type arguments");
+                err.emit();
+            }
+
             // Parse types, optionally.
             let parameters = if self.eat_lt() {
                 let (lifetimes, types, bindings) = self.parse_generic_values_after_lt()?;
diff --git a/src/libsyntax_ext/deriving/generic/mod.rs b/src/libsyntax_ext/deriving/generic/mod.rs
index bc47d8f4e61..687f8c902f2 100644
--- a/src/libsyntax_ext/deriving/generic/mod.rs
+++ b/src/libsyntax_ext/deriving/generic/mod.rs
@@ -1460,8 +1460,9 @@ impl<'a> MethodDef<'a> {
             .iter()
             .map(|v| {
                 let ident = v.node.name;
+                let sp = Span { expn_id: trait_.span.expn_id, ..v.span };
                 let summary = trait_.summarise_struct(cx, &v.node.data);
-                (ident, v.span, summary)
+                (ident, sp, summary)
             })
             .collect();
         self.call_substructure_method(cx,
diff --git a/src/test/compile-fail/issue-12612.rs b/src/test/compile-fail/issue-12612.rs
index 20943bd0ea0..c6f76ca7887 100644
--- a/src/test/compile-fail/issue-12612.rs
+++ b/src/test/compile-fail/issue-12612.rs
@@ -16,7 +16,7 @@ use foo::bar;
 
 mod test {
     use bar::foo; //~ ERROR unresolved import `bar::foo` [E0432]
-                  //~^ Maybe a missing `extern crate bar`?
+                  //~^ Maybe a missing `extern crate bar;`?
 }
 
 fn main() {}
diff --git a/src/test/compile-fail/issue-1697.rs b/src/test/compile-fail/issue-1697.rs
index dc09af0ada6..1375200271c 100644
--- a/src/test/compile-fail/issue-1697.rs
+++ b/src/test/compile-fail/issue-1697.rs
@@ -11,6 +11,6 @@
 // Testing that we don't fail abnormally after hitting the errors
 
 use unresolved::*; //~ ERROR unresolved import `unresolved::*` [E0432]
-                   //~^ Maybe a missing `extern crate unresolved`?
+                   //~^ Maybe a missing `extern crate unresolved;`?
 
 fn main() {}
diff --git a/src/test/compile-fail/issue-36116.rs b/src/test/compile-fail/issue-36116.rs
new file mode 100644
index 00000000000..9abf2b5ec3a
--- /dev/null
+++ b/src/test/compile-fail/issue-36116.rs
@@ -0,0 +1,23 @@
+// Copyright 2016 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 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Foo<T> {
+    _a: T,
+}
+
+fn main() {
+    let f = Some(Foo { _a: 42 }).map(|a| a as Foo::<i32>);
+    //~^ ERROR unexpected token: `::`
+    //~| HELP use `<...>` instead of `::<...>` if you meant to specify type arguments
+
+    let g: Foo::<i32> = Foo { _a: 42 };
+    //~^ ERROR unexpected token: `::`
+    //~| HELP use `<...>` instead of `::<...>` if you meant to specify type arguments
+}
diff --git a/src/test/compile-fail/unresolved-import.rs b/src/test/compile-fail/unresolved-import.rs
index 0a9a4375697..47490af0ff3 100644
--- a/src/test/compile-fail/unresolved-import.rs
+++ b/src/test/compile-fail/unresolved-import.rs
@@ -11,7 +11,7 @@
 // ignore-tidy-linelength
 
 use foo::bar; //~ ERROR unresolved import `foo::bar` [E0432]
-              //~^ Maybe a missing `extern crate foo`?
+              //~^ Maybe a missing `extern crate foo;`?
 
 use bar::Baz as x; //~ ERROR unresolved import `bar::Baz` [E0432]
                    //~^ no `Baz` in `bar`. Did you mean to use `Bar`?