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