]> git.lizzy.rs Git - rust.git/blob - src/test/ui/symbol-names/issue-60925.rs
Rollup merge of #105555 - krasimirgg:llvm-int-opt-2, r=cuviper
[rust.git] / src / test / ui / symbol-names / issue-60925.rs
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
6 #![feature(rustc_attrs)]
7
8 // This test is the same code as in ui/issue-53912.rs but this test checks that the symbol mangling
9 // fix produces the correct result, whereas that test just checks that the reproduction compiles
10 // successfully and doesn't crash LLVM
11
12 fn dummy() {}
13
14 mod llvm {
15     pub(crate) struct Foo;
16 }
17 mod foo {
18     pub(crate) struct Foo<T>(T);
19
20     impl Foo<::llvm::Foo> {
21         #[rustc_symbol_name]
22         //[legacy]~^ ERROR symbol-name(_ZN11issue_609253foo37Foo$LT$issue_60925..llv$u6d$..Foo$GT$3foo
23         //[legacy]~| ERROR demangling(issue_60925::foo::Foo<issue_60925::llvm::Foo>::foo
24         //[legacy]~| ERROR demangling-alt(issue_60925::foo::Foo<issue_60925::llvm::Foo>::foo)
25          //[v0]~^^^^ ERROR symbol-name
26             //[v0]~| ERROR demangling
27             //[v0]~| ERROR demangling-alt(<issue_60925::foo::Foo<issue_60925::llvm::Foo>>::foo)
28         pub(crate) fn foo() {
29             for _ in 0..0 {
30                 for _ in &[::dummy()] {
31                     ::dummy();
32                     ::dummy();
33                     ::dummy();
34                 }
35             }
36         }
37     }
38
39     pub(crate) fn foo() {
40         Foo::foo();
41         Foo::foo();
42     }
43 }
44
45 pub fn foo() {
46     foo::foo();
47 }
48
49 fn main() {}