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