Resolve the vtables for method calls to generic Drop impls with trait bounds.

This commit is contained in:
Eduard Burtescu 2014-02-20 00:12:09 +02:00
parent efef078cfa
commit efaa1ea979
3 changed files with 42 additions and 23 deletions

View file

@ -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<T>(&self, x: &T);
fn default_method<T>(&self, x: &T) {
println!("X::default_method {:?} {:?}", self, x);
}
}
struct Y;
struct Y(int);
struct Z<T> {
x: T
}
impl X for Y {
fn call(&self) {
fn call<T>(&self, x: &T) {
println!("X::call {:?} {:?}", self, x);
}
}
#[unsafe_destructor]
impl<T: X> Drop for Z<T> {
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)};
}