about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustc_typeck/check/callee.rs4
-rw-r--r--src/test/compile-fail/E0040.rs4
2 files changed, 6 insertions, 2 deletions
diff --git a/src/librustc_typeck/check/callee.rs b/src/librustc_typeck/check/callee.rs
index bd2c05ba66d..e73c3aa352b 100644
--- a/src/librustc_typeck/check/callee.rs
+++ b/src/librustc_typeck/check/callee.rs
@@ -28,7 +28,9 @@ use rustc::hir;
 /// method that is called)
 pub fn check_legal_trait_for_method_call(ccx: &CrateCtxt, span: Span, trait_id: DefId) {
     if ccx.tcx.lang_items.drop_trait() == Some(trait_id) {
-        span_err!(ccx.tcx.sess, span, E0040, "explicit use of destructor method");
+        struct_span_err!(ccx.tcx.sess, span, E0040, "explicit use of destructor method")
+            .span_label(span, &format!("call to destructor method"))
+            .emit();
     }
 }
 
diff --git a/src/test/compile-fail/E0040.rs b/src/test/compile-fail/E0040.rs
index f998778a50d..80ff57c3635 100644
--- a/src/test/compile-fail/E0040.rs
+++ b/src/test/compile-fail/E0040.rs
@@ -20,5 +20,7 @@ impl Drop for Foo {
 
 fn main() {
     let mut x = Foo { x: -7 };
-    x.drop(); //~ ERROR E0040
+    x.drop();
+    //~^ ERROR E0040
+    //~| NOTE call to destructor method
 }