From e5a4a7afcce936ea33f84b83d4e119feb788d3ab Mon Sep 17 00:00:00 2001 From: Yojan Shrestha Date: Thu, 4 Aug 2016 22:46:59 -0500 Subject: [PATCH] Updates compiler error E0040 with new format --- src/librustc_typeck/check/callee.rs | 4 +++- src/test/compile-fail/E0040.rs | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) 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..8c2395eefceaf 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 }