]> git.lizzy.rs Git - rust.git/blob - src/test/ui/symbol-names/issue-75326.rs
Rollup merge of #85989 - jyn514:gitignore-cleanup, r=ehuss
[rust.git] / src / test / ui / symbol-names / issue-75326.rs
1 // build-fail
2 // revisions: legacy v0
3 //[legacy]compile-flags: -Z symbol-mangling-version=legacy
4 //[v0]compile-flags: -Z symbol-mangling-version=v0
5 //[legacy]normalize-stderr-test: "h[\w{16}]+" -> "SYMBOL_HASH"
6
7 #![feature(rustc_attrs)]
8
9 pub(crate) struct Foo<I, E>(I, E);
10
11 pub trait Iterator2 {
12     type Item;
13
14     fn next(&mut self) -> Option<Self::Item>;
15
16     fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
17     where
18         Self: Sized,
19         P: FnMut(&Self::Item) -> bool,
20     {
21         unimplemented!()
22     }
23 }
24
25 struct Bar;
26
27 impl Iterator2 for Bar {
28     type Item = (u32, u16);
29
30     fn next(&mut self) -> Option<Self::Item> {
31         unimplemented!()
32     }
33 }
34
35 impl<I, T, E> Iterator2 for Foo<I, E>
36 where
37     I: Iterator2<Item = (T, E)>,
38 {
39     type Item = T;
40
41     #[rustc_symbol_name]
42     //[legacy]~^ ERROR symbol-name(_ZN72_$LT$issue_75326..Foo$LT$I$C$E$GT$$u20$as$u20$issue_75326..Iterator2$GT$4next
43     //[legacy]~| ERROR demangling(<issue_75326::Foo<I,E> as issue_75326::Iterator2>::next
44     //[legacy]~| ERROR demangling-alt(<issue_75326::Foo<I,E> as issue_75326::Iterator2>::next)
45     //[v0]~^^^^  ERROR symbol-name(_RNvXINICs21hi0yVfW1J_11issue_75326s_0pppEINtB5_3FooppENtB5_9Iterator24nextB5_)
46     //[v0]~|     ERROR demangling(<issue_75326[17891616a171812d]::Foo<_, _> as issue_75326[17891616a171812d]::Iterator2>::next)
47     //[v0]~|     ERROR demangling-alt(<issue_75326::Foo<_, _> as issue_75326::Iterator2>::next)
48     fn next(&mut self) -> Option<Self::Item> {
49         self.find(|_| true)
50     }
51 }
52
53 fn main() {
54     let mut a = Foo(Bar, 1u16);
55     let _ = a.next();
56 }