]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-34796.rs
Rollup merge of #100168 - WaffleLapkin:improve_diagnostics_for_missing_type_in_a_cons...
[rust.git] / src / test / ui / issues / issue-34796.rs
1 // run-pass
2 #![allow(dead_code)]
3 // This test case exposes conditions where the encoding of a trait object type
4 // with projection predicates would differ between this crate and the upstream
5 // crate, because the predicates were encoded in different order within each
6 // crate. This led to different symbol hashes of functions using these type,
7 // which in turn led to linker errors because the two crates would not agree on
8 // the symbol name.
9 // The fix was to make the order in which predicates get encoded stable.
10
11 // aux-build:issue-34796-aux.rs
12 extern crate issue_34796_aux;
13
14 fn mk<T>() -> T { loop {} }
15
16 struct Data<T, E> {
17     data: T,
18     error: E,
19 }
20
21 fn main() {
22     issue_34796_aux::bar(|()| {
23         Data::<(), std::io::Error> {
24             data: mk(),
25             error: mk(),
26         }
27     })
28 }