]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-9446.rs
Rollup merge of #86479 - exphp-forks:float-debug-exponential, r=yaahc
[rust.git] / src / test / ui / issues / issue-9446.rs
1 // run-pass
2 struct Wrapper(String);
3
4 impl Wrapper {
5     pub fn new(wrapped: String) -> Wrapper {
6         Wrapper(wrapped)
7     }
8
9     pub fn say_hi(&self) {
10         let Wrapper(ref s) = *self;
11         println!("hello {}", *s);
12     }
13 }
14
15 impl Drop for Wrapper {
16     fn drop(&mut self) {}
17 }
18
19 pub fn main() {
20     {
21         // This runs without complaint.
22         let x = Wrapper::new("Bob".to_string());
23         x.say_hi();
24     }
25     {
26         // This fails to compile, circa 0.8-89-gc635fba.
27         // error: internal compiler error: drop_ty_immediate: non-box ty
28         Wrapper::new("Bob".to_string()).say_hi();
29     }
30 }