]> git.proxmox.com Git - rustc.git/blob - src/test/ui/issues/issue-4252.rs
New upstream version 1.49.0+dfsg1
[rustc.git] / src / test / ui / issues / issue-4252.rs
1 // run-pass
2 trait X {
3 fn call<T: std::fmt::Debug>(&self, x: &T);
4 fn default_method<T: std::fmt::Debug>(&self, x: &T) {
5 println!("X::default_method {:?}", x);
6 }
7 }
8
9 #[derive(Debug)]
10 struct Y(isize);
11
12 #[derive(Debug)]
13 struct Z<T: X+std::fmt::Debug> {
14 x: T
15 }
16
17 impl X for Y {
18 fn call<T: std::fmt::Debug>(&self, x: &T) {
19 println!("X::call {:?} {:?}", self, x);
20 }
21 }
22
23 impl<T: X + std::fmt::Debug> Drop for Z<T> {
24 fn drop(&mut self) {
25 // These statements used to cause an ICE.
26 self.x.call(self);
27 self.x.default_method(self);
28 }
29 }
30
31 pub fn main() {
32 let _z = Z {x: Y(42)};
33 }