1# This file holds test cases for the Rust demangler. 2# Each test case looks like this: 3# options 4# input to be demangled 5# expected output 6# 7# See demangle-expected for documentation of supported options. 8# 9# A line starting with `#' is ignored. 10# However, blank lines in this file are NOT ignored. 11# 12############ 13# 14# Coverage Tests (legacy) 15# 16# 17# Demangles as rust symbol. 18--format=rust 19_ZN4main4main17he714a2e23ed7db23E 20main::main 21# Also demangles as c++ gnu v3 mangled symbol. But with extra Rust hash. 22--format=gnu-v3 23_ZN4main4main17he714a2e23ed7db23E 24main::main::he714a2e23ed7db23 25# But auto should demangle fully gnu-v3 -> rust -> demangled, not partially. 26--format=auto 27_ZN4main4main17he714a2e23ed7db23E 28main::main 29# Hash is exactly 16 hex chars. Not more. 30--format=auto 31_ZN4main4main18h1e714a2e23ed7db23E 32main::main::h1e714a2e23ed7db23 33# Not less. 34--format=auto 35_ZN4main4main16h714a2e23ed7db23E 36main::main::h714a2e23ed7db23 37# And not non-hex. 38--format=auto 39_ZN4main4main17he714a2e23ed7db2gE 40main::main::he714a2e23ed7db2g 41# $XX$ substitutions should not contain just numbers. 42--format=auto 43_ZN4main4$99$17he714a2e23ed7db23E 44main::$99$ 45# _ at start of path should be removed. 46# ".." translates to "::" "$GT$" to ">" and "$LT$" to "<". 47--format=rust 48_ZN71_$LT$Test$u20$$u2b$$u20$$u27$static$u20$as$u20$foo..Bar$LT$Test$GT$$GT$3bar17h930b740aa94f1d3aE 49<Test + 'static as foo::Bar<Test>>::bar 50# 51--format=rust 52_ZN54_$LT$I$u20$as$u20$core..iter..traits..IntoIterator$GT$9into_iter17h8581507801fb8615E 53<I as core::iter::traits::IntoIterator>::into_iter 54# 55--format=rust 56_ZN10parse_tsan4main17hdbbfdf1c6a7e27d9E 57parse_tsan::main 58# 59--format=rust 60_ZN65_$LT$std..env..Args$u20$as$u20$core..iter..iterator..Iterator$GT$4next17h420a7c8d0c7eef40E 61<std::env::Args as core::iter::iterator::Iterator>::next 62# 63--format=rust 64_ZN4core3str9from_utf817hdcea28871313776dE 65core::str::from_utf8 66# 67--format=rust 68_ZN4core3mem7size_of17h18bde9bb8c22e2cfE 69core::mem::size_of 70# 71--format=rust 72_ZN5alloc4heap8allocate17hd55c03e6cb81d924E 73alloc::heap::allocate 74# 75--format=rust 76_ZN4core3ptr8null_mut17h736cce09ca0ac11aE 77core::ptr::null_mut 78# 79--format=rust 80_ZN4core3ptr31_$LT$impl$u20$$BP$mut$u20$T$GT$7is_null17h7f9de798bc3f0879E 81core::ptr::<impl *mut T>::is_null 82# 83--format=rust 84_ZN40_$LT$alloc..raw_vec..RawVec$LT$T$GT$$GT$6double17h4166e2b47539e1ffE 85<alloc::raw_vec::RawVec<T>>::double 86# 87--format=rust 88_ZN39_$LT$collections..vec..Vec$LT$T$GT$$GT$4push17hd4b6b23c1b88141aE 89<collections::vec::Vec<T>>::push 90# 91--format=rust 92_ZN70_$LT$collections..vec..Vec$LT$T$GT$$u20$as$u20$core..ops..DerefMut$GT$9deref_mut17hf299b860dc5a831cE 93<collections::vec::Vec<T> as core::ops::DerefMut>::deref_mut 94# 95--format=rust 96_ZN63_$LT$core..ptr..Unique$LT$T$GT$$u20$as$u20$core..ops..Deref$GT$5deref17hc784b4a166cb5e5cE 97<core::ptr::Unique<T> as core::ops::Deref>::deref 98# 99--format=rust 100_ZN40_$LT$alloc..raw_vec..RawVec$LT$T$GT$$GT$3ptr17h7570b6e9070b693bE 101<alloc::raw_vec::RawVec<T>>::ptr 102# 103--format=rust 104_ZN4core3ptr31_$LT$impl$u20$$BP$mut$u20$T$GT$7is_null17h0f3228f343444ac8E 105core::ptr::<impl *mut T>::is_null 106# 107--format=rust 108_ZN53_$LT$$u5b$T$u5d$$u20$as$u20$core..slice..SliceExt$GT$10as_mut_ptr17h153241df1c7d1666E 109<[T] as core::slice::SliceExt>::as_mut_ptr 110# 111--format=rust 112_ZN11collections5slice29_$LT$impl$u20$$u5b$T$u5d$$GT$10as_mut_ptr17hf12a6d0409938c96E 113collections::slice::<impl [T]>::as_mut_ptr 114# 115--format=rust 116_ZN4core3ptr5write17h651fe53ec860e780E 117core::ptr::write 118# 119--format=rust 120_ZN65_$LT$std..env..Args$u20$as$u20$core..iter..iterator..Iterator$GT$4next17h420a7c8d0c7eef40E 121<std::env::Args as core::iter::iterator::Iterator>::next 122# 123--format=rust 124_ZN54_$LT$I$u20$as$u20$core..iter..traits..IntoIterator$GT$9into_iter17he06cb713aae5b465E 125<I as core::iter::traits::IntoIterator>::into_iter 126# 127--format=rust 128_ZN71_$LT$collections..vec..IntoIter$LT$T$GT$$u20$as$u20$core..ops..Drop$GT$4drop17hf7f23304ebe62eedE 129<collections::vec::IntoIter<T> as core::ops::Drop>::drop 130# 131--format=rust 132_ZN86_$LT$collections..vec..IntoIter$LT$T$GT$$u20$as$u20$core..iter..iterator..Iterator$GT$4next17h04b3fbf148c39713E 133<collections::vec::IntoIter<T> as core::iter::iterator::Iterator>::next 134# 135--format=rust 136_ZN75_$LT$$RF$$u27$a$u20$mut$u20$I$u20$as$u20$core..iter..iterator..Iterator$GT$4next17ha050492063e0fd20E 137<&'a mut I as core::iter::iterator::Iterator>::next 138# Different hashes are OK, they are just stripped. 139--format=rust 140_ZN13drop_contents17hfe3c0a68c8ad1c74E 141drop_contents 142# 143--format=rust 144_ZN13drop_contents17h48cb59bef15bb555E 145drop_contents 146# 147--format=rust 148_ZN4core3mem7size_of17h900b33157bf58f26E 149core::mem::size_of 150# 151--format=rust 152_ZN67_$LT$alloc..raw_vec..RawVec$LT$T$GT$$u20$as$u20$core..ops..Drop$GT$4drop17h96a5cf6e94807905E 153<alloc::raw_vec::RawVec<T> as core::ops::Drop>::drop 154# 155--format=rust 156_ZN68_$LT$core..nonzero..NonZero$LT$T$GT$$u20$as$u20$core..ops..Deref$GT$5deref17hc49056f882aa46dbE 157<core::nonzero::NonZero<T> as core::ops::Deref>::deref 158# 159--format=rust 160_ZN63_$LT$core..ptr..Unique$LT$T$GT$$u20$as$u20$core..ops..Deref$GT$5deref17h19f2ad4920655e85E 161<core::ptr::Unique<T> as core::ops::Deref>::deref 162# 163--format=rust 164_ZN11issue_609253foo37Foo$LT$issue_60925..llv$u6d$..Foo$GT$3foo17h059a991a004536adE 165issue_60925::foo::Foo<issue_60925::llvm::Foo>::foo 166--format=rust 167_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17h000b1ad6c4f30bd6E 168core::ops::function::FnOnce::call_once{{vtable.shim}} 169# 170############ 171# 172# Coverage Tests (v0) 173# 174# 175# Crate with a leading digit. 176--format=rust 177_RNvC6_123foo3bar 178123foo::bar 179# UTF-8 identifiers. 180--format=rust 181_RNqCs4fqI2P2rA04_11utf8_identsu30____7hkackfecea1cbdathfdh9hlq6y 182utf8_idents::საჭმელად_გემრიელი_სადილი 183# Closure path elements. 184--format=rust 185_RNCNCNgCs6DXkGYLi8lr_2cc5spawn00B5_ 186cc::spawn::{closure#0}::{closure#0} 187# 188--format=rust 189_RNCINkXs25_NgCsbmNqQUJIY6D_4core5sliceINyB9_4IterhENuNgNoBb_4iter8iterator8Iterator9rpositionNCNgNpB9_6memchr7memrchrs_0E0Bb_ 190<core::slice::Iter<u8> as core::iter::iterator::Iterator>::rposition::<core::slice::memchr::memrchr::{closure#1}>::{closure#0} 191# dyn Trait ("trait object") types. 192--format=rust 193_RINbNbCskIICzLVDPPb_5alloc5alloc8box_freeDINbNiB4_5boxed5FnBoxuEp6OutputuEL_ECs1iopQbuBiw2_3std 194alloc::alloc::box_free::<dyn alloc::boxed::FnBox<(), Output = ()>> 195# Types with const generics parameters. 196--format=rust 197_RNvMC0INtC8arrayvec8ArrayVechKj7b_E3new 198<arrayvec::ArrayVec<u8, 123>>::new 199# 200--format=rust 201_RMCs4fqI2P2rA04_13const_genericINtB0_8UnsignedKhb_E 202<const_generic::Unsigned<11>> 203# 204--format=rust 205_RMCs4fqI2P2rA04_13const_genericINtB0_6SignedKs98_E 206<const_generic::Signed<152>> 207# 208--format=rust 209_RMCs4fqI2P2rA04_13const_genericINtB0_6SignedKanb_E 210<const_generic::Signed<-11>> 211# 212--format=rust 213_RMCs4fqI2P2rA04_13const_genericINtB0_4BoolKb0_E 214<const_generic::Bool<false>> 215# 216--format=rust 217_RMCs4fqI2P2rA04_13const_genericINtB0_4BoolKb1_E 218<const_generic::Bool<true>> 219# 220--format=rust 221_RMCs4fqI2P2rA04_13const_genericINtB0_4CharKc76_E 222<const_generic::Char<'v'>> 223# 224--format=rust 225_RMCs4fqI2P2rA04_13const_genericINtB0_4CharKca_E 226<const_generic::Char<'\n'>> 227# 228--format=rust 229_RMCs4fqI2P2rA04_13const_genericINtB0_4CharKc2202_E 230<const_generic::Char<'\u{2202}'>> 231# 232--format=rust 233_RNvNvMCs4fqI2P2rA04_13const_genericINtB4_3FooKpE3foo3FOO 234<const_generic::Foo<_>>::foo::FOO 235# 236# All of the tests above but in auto mode instead: 237# 238# Crate with a leading digit. 239--format=auto 240_RNvC6_123foo3bar 241123foo::bar 242# UTF-8 identifiers. 243--format=auto 244_RNqCs4fqI2P2rA04_11utf8_identsu30____7hkackfecea1cbdathfdh9hlq6y 245utf8_idents::საჭმელად_გემრიელი_სადილი 246# Closure path elements. 247--format=auto 248_RNCNCNgCs6DXkGYLi8lr_2cc5spawn00B5_ 249cc::spawn::{closure#0}::{closure#0} 250# 251--format=auto 252_RNCINkXs25_NgCsbmNqQUJIY6D_4core5sliceINyB9_4IterhENuNgNoBb_4iter8iterator8Iterator9rpositionNCNgNpB9_6memchr7memrchrs_0E0Bb_ 253<core::slice::Iter<u8> as core::iter::iterator::Iterator>::rposition::<core::slice::memchr::memrchr::{closure#1}>::{closure#0} 254# dyn Trait ("trait object") types. 255--format=auto 256_RINbNbCskIICzLVDPPb_5alloc5alloc8box_freeDINbNiB4_5boxed5FnBoxuEp6OutputuEL_ECs1iopQbuBiw2_3std 257alloc::alloc::box_free::<dyn alloc::boxed::FnBox<(), Output = ()>> 258# Types with const generics parameters. 259--format=auto 260_RNvMC0INtC8arrayvec8ArrayVechKj7b_E3new 261<arrayvec::ArrayVec<u8, 123>>::new 262# 263--format=auto 264_RMCs4fqI2P2rA04_13const_genericINtB0_8UnsignedKhb_E 265<const_generic::Unsigned<11>> 266# 267--format=auto 268_RMCs4fqI2P2rA04_13const_genericINtB0_6SignedKs98_E 269<const_generic::Signed<152>> 270# 271--format=auto 272_RMCs4fqI2P2rA04_13const_genericINtB0_6SignedKanb_E 273<const_generic::Signed<-11>> 274# 275--format=auto 276_RMCs4fqI2P2rA04_13const_genericINtB0_4BoolKb0_E 277<const_generic::Bool<false>> 278# 279--format=auto 280_RMCs4fqI2P2rA04_13const_genericINtB0_4BoolKb1_E 281<const_generic::Bool<true>> 282# 283--format=auto 284_RMCs4fqI2P2rA04_13const_genericINtB0_4CharKc76_E 285<const_generic::Char<'v'>> 286# 287--format=auto 288_RMCs4fqI2P2rA04_13const_genericINtB0_4CharKca_E 289<const_generic::Char<'\n'>> 290# 291--format=auto 292_RMCs4fqI2P2rA04_13const_genericINtB0_4CharKc2202_E 293<const_generic::Char<'\u{2202}'>> 294# 295--format=auto 296_RNvNvMCs4fqI2P2rA04_13const_genericINtB4_3FooKpE3foo3FOO 297<const_generic::Foo<_>>::foo::FOO 298# 299# Suffixes 300# 301--format=rust 302_RNvMs0_NtCs5l0EXMQXRMU_21rustc_data_structures17obligation_forestINtB5_16ObligationForestNtNtNtCsdozMG8X9FIu_21rustc_trait_selection6traits7fulfill26PendingPredicateObligationE22register_obligation_atB1v_.llvm.8517020237817239694 303<rustc_data_structures::obligation_forest::ObligationForest<rustc_trait_selection::traits::fulfill::PendingPredicateObligation>>::register_obligation_at 304--format=rust 305_ZN4core3ptr85drop_in_place$LT$std..rt..lang_start$LT$$LP$$RP$$GT$..$u7b$$u7b$closure$u7d$$u7d$$GT$17h27f14859c664490dE.llvm.8091179795805947855 306core::ptr::drop_in_place<std::rt::lang_start<()>::{{closure}}> 307# old style rustc llvm thinlto 308--format=rust 309_ZN9backtrace3foo17hbb467fcdaea5d79bE.llvm.A5310EB9 310backtrace::foo 311--format=rust 312_ZN9backtrace3foo17hbb467fcdaea5d79bE.llvm.A5310EB9@@16 313backtrace::foo 314# new style rustc llvm thinlto 315--format=rust 316_RC3foo.llvm.9D1C9369 317foo 318--format=rust 319_RC3foo.llvm.9D1C9369@@16 320foo 321--format=rust 322_RNvC9backtrace3foo.llvm.A5310EB9 323backtrace::foo 324