]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-27240.rs
Rollup merge of #105955 - Nilstrieb:no-trivial-opt-wrappers-we-have-field-accesses...
[rust.git] / src / test / ui / issues / issue-27240.rs
1 // run-pass
2 #![allow(unused_assignments)]
3 #![allow(unused_variables)]
4 use std::fmt;
5 struct NoisyDrop<T: fmt::Debug>(#[allow(unused_tuple_struct_fields)] T);
6 impl<T: fmt::Debug> Drop for NoisyDrop<T> {
7     fn drop(&mut self) {}
8 }
9
10 struct Bar<T: fmt::Debug>(#[allow(unused_tuple_struct_fields)] [*const NoisyDrop<T>; 2]);
11
12 fn fine() {
13     let (u,b);
14     u = vec![43];
15     b = Bar([&NoisyDrop(&u), &NoisyDrop(&u)]);
16 }
17
18 #[allow(unused_tuple_struct_fields)]
19 struct Bar2<T: fmt::Debug>(*const NoisyDrop<T>, *const NoisyDrop<T>);
20
21 fn lolwut() {
22     let (u,v);
23     u = vec![43];
24     v = Bar2(&NoisyDrop(&u), &NoisyDrop(&u));
25 }
26
27 fn main() { fine(); lolwut() }