1 // build-fail
2 // revisions: legacy v0
3 //[legacy]compile-flags: -Z unstable-options -C symbol-mangling-version=legacy
4 //[v0]compile-flags: -C 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
next(&mut self) -> Option<Self::Item>14 fn next(&mut self) -> Option<Self::Item>;
15
find<P>(&mut self, predicate: P) -> Option<Self::Item> where Self: Sized, P: FnMut(&Self::Item) -> bool,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
next(&mut self) -> Option<Self::Item>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
46 //[v0]~| ERROR demangling
47 //[v0]~| ERROR demangling-alt(<issue_75326::Foo<_, _> as issue_75326::Iterator2>::next)
next(&mut self) -> Option<Self::Item>48 fn next(&mut self) -> Option<Self::Item> {
49 self.find(|_| true)
50 }
51 }
52
main()53 fn main() {
54 let mut a = Foo(Bar, 1u16);
55 let _ = a.next();
56 }
57