about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-09-04 06:06:37 -0700
committerGitHub <noreply@github.com>2016-09-04 06:06:37 -0700
commit987b47549eae03e4d9699336f5e30f787161acaa (patch)
tree5e7eb63f8f244e3d1961b69dacb8bfeacdff849b /src
parente77d86c142ae668038dd43594d04022cbd6bf4d8 (diff)
parent55893f0da7427c14be55837fada2d062db387ec9 (diff)
downloadrust-987b47549eae03e4d9699336f5e30f787161acaa.tar.gz
rust-987b47549eae03e4d9699336f5e30f787161acaa.zip
Auto merge of #36255 - Manishearth:rollup, r=Manishearth
Rollup of 7 pull requests

- Successful merges: #36070, #36132, #36200, #36212, #36225, #36231, #36234
- Failed merges:
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/config.rs2
-rw-r--r--src/bootstrap/config.toml.example7
-rw-r--r--src/doc/book/nightly-rust.md2
-rw-r--r--src/librustc_metadata/creader.rs10
-rw-r--r--src/librustc_mir/transform/qualify_consts.rs33
-rw-r--r--src/test/compile-fail/E0458.rs4
-rw-r--r--src/test/compile-fail/E0459.rs1
-rw-r--r--src/test/ui/span/E0493.rs (renamed from src/test/compile-fail/E0493.rs)10
-rw-r--r--src/test/ui/span/E0493.stderr11
9 files changed, 73 insertions, 7 deletions
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index 682a6f74126..c1af7bd794c 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -144,6 +144,7 @@ struct Rust {
     rpath: Option<bool>,
     optimize_tests: Option<bool>,
     debuginfo_tests: Option<bool>,
+    codegen_tests: Option<bool>,
 }
 
 /// TOML representation of how each build target is configured.
@@ -232,6 +233,7 @@ impl Config {
             set(&mut config.rust_optimize, rust.optimize);
             set(&mut config.rust_optimize_tests, rust.optimize_tests);
             set(&mut config.rust_debuginfo_tests, rust.debuginfo_tests);
+            set(&mut config.codegen_tests, rust.codegen_tests);
             set(&mut config.rust_rpath, rust.rpath);
             set(&mut config.debug_jemalloc, rust.debug_jemalloc);
             set(&mut config.use_jemalloc, rust.use_jemalloc);
diff --git a/src/bootstrap/config.toml.example b/src/bootstrap/config.toml.example
index 2894adafef6..fcbd1d33309 100644
--- a/src/bootstrap/config.toml.example
+++ b/src/bootstrap/config.toml.example
@@ -1,5 +1,8 @@
 # Sample TOML configuration file for building Rust.
 #
+# To configure rustbuild, copy this file to the directory from which you will be
+# running the build, and name it config.toml.
+#
 # All options are commented out by default in this file, and they're commented
 # out with their default values. The build system by default looks for
 # `config.toml` in the current directory of a build for build configuration, but
@@ -130,6 +133,10 @@
 #optimize-tests = true
 #debuginfo-tests = true
 
+# Flag indicating whether codegen tests will be run or not. If you get an error
+# saying that the FileCheck executable is missing, you may want to disable this.
+#codegen-tests = true
+
 # =============================================================================
 # Options for specific targets
 #
diff --git a/src/doc/book/nightly-rust.md b/src/doc/book/nightly-rust.md
index b3be71038a9..25570cb5503 100644
--- a/src/doc/book/nightly-rust.md
+++ b/src/doc/book/nightly-rust.md
@@ -54,7 +54,7 @@ binary downloads][install-page].
 
 Oh, we should also mention the officially supported platforms:
 
-* Windows (7, 8, Server 2008 R2)
+* Windows (7+)
 * Linux (2.6.18 or later, various distributions), x86 and x86-64
 * OSX 10.7 (Lion) or greater, x86 and x86-64
 
diff --git a/src/librustc_metadata/creader.rs b/src/librustc_metadata/creader.rs
index 2524348dc1a..62e5d670fb6 100644
--- a/src/librustc_metadata/creader.rs
+++ b/src/librustc_metadata/creader.rs
@@ -1056,8 +1056,9 @@ impl<'a> LocalCrateReader<'a> {
                 Some("dylib") => cstore::NativeUnknown,
                 Some("framework") => cstore::NativeFramework,
                 Some(k) => {
-                    span_err!(self.sess, m.span, E0458,
-                              "unknown kind: `{}`", k);
+                    struct_span_err!(self.sess, m.span, E0458,
+                              "unknown kind: `{}`", k)
+                        .span_label(m.span, &format!("unknown kind")).emit();
                     cstore::NativeUnknown
                 }
                 None => cstore::NativeUnknown
@@ -1068,8 +1069,9 @@ impl<'a> LocalCrateReader<'a> {
             let n = match n {
                 Some(n) => n,
                 None => {
-                    span_err!(self.sess, m.span, E0459,
-                              "#[link(...)] specified without `name = \"foo\"`");
+                    struct_span_err!(self.sess, m.span, E0459,
+                                     "#[link(...)] specified without `name = \"foo\"`")
+                        .span_label(m.span, &format!("missing `name` argument")).emit();
                     InternedString::new("foo")
                 }
             };
diff --git a/src/librustc_mir/transform/qualify_consts.rs b/src/librustc_mir/transform/qualify_consts.rs
index 6c6a5f7fc74..02a643b76d5 100644
--- a/src/librustc_mir/transform/qualify_consts.rs
+++ b/src/librustc_mir/transform/qualify_consts.rs
@@ -18,6 +18,7 @@ use rustc_data_structures::bitvec::BitVector;
 use rustc_data_structures::indexed_vec::{IndexVec, Idx};
 use rustc::dep_graph::DepNode;
 use rustc::hir;
+use rustc::hir::map as hir_map;
 use rustc::hir::def_id::DefId;
 use rustc::hir::intravisit::FnKind;
 use rustc::hir::map::blocks::FnLikeNode;
@@ -252,14 +253,46 @@ impl<'a, 'tcx> Qualifier<'a, 'tcx, 'tcx> {
 
         let mut err =
             struct_span_err!(self.tcx.sess, self.span, E0493, "{}", msg);
+
         if self.mode != Mode::Const {
             help!(&mut err,
                   "in Nightly builds, add `#![feature(drop_types_in_const)]` \
                    to the crate attributes to enable");
+        } else {
+            self.find_drop_implementation_method_span()
+                .map(|span| err.span_label(span, &format!("destructor defined here")));
+
+            err.span_label(self.span, &format!("constants cannot have destructors"));
         }
+
         err.emit();
     }
 
+    fn find_drop_implementation_method_span(&self) -> Option<Span> {
+        self.tcx.lang_items
+            .drop_trait()
+            .and_then(|drop_trait_id| {
+                let mut span = None;
+
+                self.tcx
+                    .lookup_trait_def(drop_trait_id)
+                    .for_each_relevant_impl(self.tcx, self.mir.return_ty, |impl_did| {
+                        self.tcx.map
+                            .as_local_node_id(impl_did)
+                            .and_then(|impl_node_id| self.tcx.map.find(impl_node_id))
+                            .map(|node| {
+                                if let hir_map::NodeItem(item) = node {
+                                    if let hir::ItemImpl(_, _, _, _, _, ref methods) = item.node {
+                                        span = methods.first().map(|method| method.span);
+                                    }
+                                }
+                            });
+                    });
+
+                span
+            })
+    }
+
     /// Check if an Lvalue with the current qualifications could
     /// be consumed, by either an operand or a Deref projection.
     fn try_consume(&mut self) -> bool {
diff --git a/src/test/compile-fail/E0458.rs b/src/test/compile-fail/E0458.rs
index 21bedc6b84c..e87158ae3b0 100644
--- a/src/test/compile-fail/E0458.rs
+++ b/src/test/compile-fail/E0458.rs
@@ -9,7 +9,9 @@
 // except according to those terms.
 
 #[link(kind = "wonderful_unicorn")] extern {} //~ ERROR E0458
-                                              //~^ ERROR E0459
+                                              //~| NOTE unknown kind
+                                              //~| ERROR E0459
+                                              //~| NOTE missing `name` argument
 
 fn main() {
 }
diff --git a/src/test/compile-fail/E0459.rs b/src/test/compile-fail/E0459.rs
index dc7ac714f22..41376bd9ef5 100644
--- a/src/test/compile-fail/E0459.rs
+++ b/src/test/compile-fail/E0459.rs
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 #[link(kind = "dylib")] extern {} //~ ERROR E0459
+                                  //~| NOTE missing `name` argument
 
 fn main() {
 }
diff --git a/src/test/compile-fail/E0493.rs b/src/test/ui/span/E0493.rs
index 689f469533d..ea4526b70f6 100644
--- a/src/test/compile-fail/E0493.rs
+++ b/src/test/ui/span/E0493.rs
@@ -16,7 +16,15 @@ impl Drop for Foo {
     fn drop(&mut self) {}
 }
 
-const F : Foo = Foo { a : 0 }; //~ ERROR E0493
+struct Bar {
+    a: u32
+}
+
+impl Drop for Bar {
+    fn drop(&mut self) {}
+}
+
+const F : Foo = Foo { a : 0 };
 
 fn main() {
 }
diff --git a/src/test/ui/span/E0493.stderr b/src/test/ui/span/E0493.stderr
new file mode 100644
index 00000000000..afcc9a240eb
--- /dev/null
+++ b/src/test/ui/span/E0493.stderr
@@ -0,0 +1,11 @@
+error[E0493]: constants are not allowed to have destructors
+  --> $DIR/E0493.rs:27:17
+   |
+16 |     fn drop(&mut self) {}
+   |     --------------------- destructor defined here
+...
+27 | const F : Foo = Foo { a : 0 };
+   |                 ^^^^^^^^^^^^^ constants cannot have destructors
+
+error: aborting due to previous error
+