]> git.lizzy.rs Git - rust.git/blob - src/test/incremental/issue-82920-predicate-order-miscompile.rs
Auto merge of #99612 - yanchen4791:issue-95079-fix, r=compiler-errors
[rust.git] / src / test / incremental / issue-82920-predicate-order-miscompile.rs
1 // revisions: rpass1 rpass2
2
3 trait MyTrait: One + Two {}
4 impl<T> One for T {
5     fn method_one(&self) -> usize {
6         1
7     }
8 }
9 impl<T> Two for T {
10     fn method_two(&self) -> usize {
11         2
12     }
13 }
14 impl<T: One + Two> MyTrait for T {}
15
16 fn main() {
17     let a: &dyn MyTrait = &true;
18     assert_eq!(a.method_one(), 1);
19     assert_eq!(a.method_two(), 2);
20 }
21
22 // Re-order traits 'One' and 'Two' between compilation
23 // sessions
24
25 #[cfg(rpass1)]
26 trait One { fn method_one(&self) -> usize; }
27
28 trait Two { fn method_two(&self) -> usize; }
29
30 #[cfg(rpass2)]
31 trait One { fn method_one(&self) -> usize; }