From efaa1ea979c60dcb6884be12dcb12ceb09dbc5bd Mon Sep 17 00:00:00 2001 From: Eduard Burtescu Date: Thu, 20 Feb 2014 00:12:09 +0200 Subject: Resolve the vtables for method calls to generic Drop impls with trait bounds. --- src/test/run-pass/issue-4252.rs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src/test') diff --git a/src/test/run-pass/issue-4252.rs b/src/test/run-pass/issue-4252.rs index 86b09f8dcfb..ba080e98183 100644 --- a/src/test/run-pass/issue-4252.rs +++ b/src/test/run-pass/issue-4252.rs @@ -8,30 +8,34 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-test - trait X { - fn call(&self); + fn call(&self, x: &T); + fn default_method(&self, x: &T) { + println!("X::default_method {:?} {:?}", self, x); + } } -struct Y; +struct Y(int); struct Z { x: T } impl X for Y { - fn call(&self) { + fn call(&self, x: &T) { + println!("X::call {:?} {:?}", self, x); } } +#[unsafe_destructor] impl Drop for Z { fn drop(&mut self) { - self.x.call(); // Adding this statement causes an ICE. + // These statements used to cause an ICE. + self.x.call(self); + self.x.default_method(self); } } pub fn main() { - let y = Y; - let _z = Z{x: y}; + let _z = Z {x: Y(42)}; } -- cgit 1.4.1-3-g733a5