]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-5666.rs
Require Drop impls to have the same constness on its bounds as the bounds on the...
[rust.git] / src / test / ui / issues / issue-5666.rs
1 // run-pass
2
3 struct Dog {
4     name : String
5 }
6
7 trait Barks {
8     fn bark(&self) -> String;
9 }
10
11 impl Barks for Dog {
12     fn bark(&self) -> String {
13         return format!("woof! (I'm {})", self.name);
14     }
15 }
16
17
18 pub fn main() {
19     let snoopy = Box::new(Dog{name: "snoopy".to_string()});
20     let bubbles = Box::new(Dog{name: "bubbles".to_string()});
21     let barker = [snoopy as Box<dyn Barks>, bubbles as Box<dyn Barks>];
22
23     for pup in &barker {
24         println!("{}", pup.bark());
25     }
26 }