File: issue-75326.rs

package info (click to toggle)
rustc 1.85.0%2Bdfsg3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, sid, trixie
  • size: 893,396 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,051; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (56 lines) | stat: -rw-r--r-- 1,443 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//@ build-fail
//@ revisions: legacy v0
//@[legacy]compile-flags: -Z unstable-options -C symbol-mangling-version=legacy
//@[v0]compile-flags: -C symbol-mangling-version=v0
//@[legacy]normalize-stderr: "h[\w{16}]+" -> "SYMBOL_HASH"

#![feature(rustc_attrs)]

pub(crate) struct Foo<I, E>(I, E);

pub trait Iterator2 {
    type Item;

    fn next(&mut self) -> Option<Self::Item>;

    fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
    where
        Self: Sized,
        P: FnMut(&Self::Item) -> bool,
    {
        unimplemented!()
    }
}

struct Bar;

impl Iterator2 for Bar {
    type Item = (u32, u16);

    fn next(&mut self) -> Option<Self::Item> {
        unimplemented!()
    }
}

impl<I, T, E> Iterator2 for Foo<I, E>
where
    I: Iterator2<Item = (T, E)>,
{
    type Item = T;

    #[rustc_symbol_name]
    //[legacy]~^ ERROR symbol-name(_ZN72_$LT$issue_75326..Foo$LT$I$C$E$GT$$u20$as$u20$issue_75326..Iterator2$GT$4next
    //[legacy]~| ERROR demangling(<issue_75326::Foo<I,E> as issue_75326::Iterator2>::next
    //[legacy]~| ERROR demangling-alt(<issue_75326::Foo<I,E> as issue_75326::Iterator2>::next)
    //[v0]~^^^^  ERROR symbol-name
    //[v0]~|     ERROR demangling
    //[v0]~|     ERROR demangling-alt(<issue_75326::Foo<_, _> as issue_75326::Iterator2>::next)
    fn next(&mut self) -> Option<Self::Item> {
        self.find(|_| true)
    }
}

fn main() {
    let mut a = Foo(Bar, 1u16);
    let _ = a.next();
}