about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAriel Ben-Yehuda <ariel.byd@gmail.com>2015-09-26 23:12:11 +0300
committerBrian Anderson <banderson@mozilla.com>2015-10-16 15:34:12 -0700
commit9cc4beb5c348a26c0e814c55dd772ab587e24219 (patch)
tree02e937858e28e9bde8116237aa435c41a68378cb
parent7eb6ca228ee613205d4105ab74d0bdbbb8e6cafe (diff)
downloadrust-9cc4beb5c348a26c0e814c55dd772ab587e24219.tar.gz
rust-9cc4beb5c348a26c0e814c55dd772ab587e24219.zip
don't crash when there are multiple conflicting implementations of Drop
Fixes #28568
-rw-r--r--src/librustc/middle/ty/mod.rs1
-rw-r--r--src/test/compile-fail/issue-28568.rs23
2 files changed, 23 insertions, 1 deletions
diff --git a/src/librustc/middle/ty/mod.rs b/src/librustc/middle/ty/mod.rs
index 59eb5e7a72f..3025d7b5897 100644
--- a/src/librustc/middle/ty/mod.rs
+++ b/src/librustc/middle/ty/mod.rs
@@ -1695,7 +1695,6 @@ impl<'tcx, 'container> AdtDefData<'tcx, 'container> {
     }
 
     pub fn set_destructor(&self, dtor: DefId) {
-        assert!(self.destructor.get().is_none());
         self.destructor.set(Some(dtor));
     }
 
diff --git a/src/test/compile-fail/issue-28568.rs b/src/test/compile-fail/issue-28568.rs
new file mode 100644
index 00000000000..36b4a57eb11
--- /dev/null
+++ b/src/test/compile-fail/issue-28568.rs
@@ -0,0 +1,23 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct MyStruct;
+
+impl Drop for MyStruct {
+//~^ ERROR conflicting implementations for trait
+    fn drop(&mut self) { }
+}
+
+impl Drop for MyStruct {
+//~^ NOTE conflicting implementation here
+    fn drop(&mut self) { }
+}
+
+fn main() {}