diff --git a/src/librustc_typeck/check/callee.rs b/src/librustc_typeck/check/callee.rs index bd2c05ba66d47..e73c3aa352b56 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 f998778a50d66..80ff57c363595 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 }