Skip to content

Commit

Permalink
Rollup merge of rust-lang#35357 - shri3k:E0040, r=jonathandturner
Browse files Browse the repository at this point in the history
Updates compiler error E0040 with new format

Addresses rust-lang#35208 as part of rust-lang#35233.
r? @GuillaumeGomez
  • Loading branch information
Jonathan Turner authored Aug 7, 2016
2 parents 0b567c6 + b564c6a commit b69b2db
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/librustc_typeck/check/callee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/test/compile-fail/E0040.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit b69b2db

Please sign in to comment.