1 1| |#![allow(unused_assignments)]
2 2| |// expect-exit-status-1
4 4| |struct Firework<T> where T: Copy + std::fmt::Display {
8 8| |impl<T> Firework<T> where T: Copy + std::fmt::Display {
10 10| 3| fn set_strength(&mut self, new_strength: T) {
11 11| 3| self.strength = new_strength;
14 | <generics::Firework<i32>>::set_strength:
15 | 10| 1| fn set_strength(&mut self, new_strength: T) {
16 | 11| 1| self.strength = new_strength;
19 | <generics::Firework<f64>>::set_strength:
20 | 10| 2| fn set_strength(&mut self, new_strength: T) {
21 | 11| 2| self.strength = new_strength;
26 15| |impl<T> Drop for Firework<T> where T: Copy + std::fmt::Display {
27 16| | #[inline(always)]
28 17| 2| fn drop(&mut self) {
29 18| 2| println!("BOOM times {}!!!", self.strength);
32 | <generics::Firework<i32> as core::ops::drop::Drop>::drop:
33 | 17| 1| fn drop(&mut self) {
34 | 18| 1| println!("BOOM times {}!!!", self.strength);
37 | <generics::Firework<f64> as core::ops::drop::Drop>::drop:
38 | 17| 1| fn drop(&mut self) {
39 | 18| 1| println!("BOOM times {}!!!", self.strength);
44 22| 1|fn main() -> Result<(),u8> {
45 23| 1| let mut firecracker = Firework { strength: 1 };
46 24| 1| firecracker.set_strength(2);
48 26| 1| let mut tnt = Firework { strength: 100.1 };
49 27| 1| tnt.set_strength(200.1);
50 28| 1| tnt.set_strength(300.3);
53 31| 1| println!("Exiting with error...");
61 39| 0| let _ = Firework { strength: 1000 };
66 44| |// Expected program output:
67 45| |// Exiting with error...
68 46| |// BOOM times 100!!!
69 47| |// BOOM times 1!!!