Skip to content

Commit 9a86713

Browse files
committed
don't crash when there are multiple conflicting implementations of Drop
Fixes rust-lang#28568
1 parent f9b703e commit 9a86713

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

src/librustc/middle/ty/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1695,7 +1695,6 @@ impl<'tcx, 'container> AdtDefData<'tcx, 'container> {
16951695
}
16961696

16971697
pub fn set_destructor(&self, dtor: DefId) {
1698-
assert!(self.destructor.get().is_none());
16991698
self.destructor.set(Some(dtor));
17001699
}
17011700

src/test/compile-fail/issue-28568.rs

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
struct MyStruct;
12+
13+
impl Drop for MyStruct {
14+
//~^ ERROR conflicting implementations for trait
15+
fn drop(&mut self) { }
16+
}
17+
18+
impl Drop for MyStruct {
19+
//~^ NOTE conflicting implementation here
20+
fn drop(&mut self) { }
21+
}
22+
23+
fn main() {}

0 commit comments

Comments
 (0)