1 use backtrace
::Backtrace
;
3 // 50-character module name
4 mod _234567890_234567890_234567890_234567890_234567890
{
5 // 50-character struct name
6 #[allow(non_camel_case_types)]
7 pub struct _234567890_234567890_234567890_234567890_234567890
<T
>(T
);
8 impl<T
> _234567890_234567890_234567890_234567890_234567890
<T
> {
10 pub fn new() -> crate::Backtrace
{
11 crate::Backtrace
::new()
16 // Long function names must be truncated to (MAX_SYM_NAME - 1) characters.
17 // Only run this test for msvc, since gnu prints "<no info>" for all frames.
19 #[cfg(all(windows, target_env = "msvc"))]
20 fn test_long_fn_name() {
21 use _234567890_234567890_234567890_234567890_234567890
::_234567890_234567890_234567890_234567890_234567890
as S
;
23 // 10 repetitions of struct name, so fully qualified function name is
24 // atleast 10 * (50 + 50) * 2 = 2000 characters long.
25 // It's actually longer since it also includes `::`, `<>` and the
26 // name of the current module
27 let bt
= S
::<S
<S
<S
<S
<S
<S
<S
<S
<S
<i32>>>>>>>>>>::new();
30 let mut found_long_name_frame
= false;
32 for frame
in bt
.frames() {
33 let symbols
= frame
.symbols();
34 if symbols
.is_empty() {
38 if let Some(function_name
) = symbols
[0].name() {
39 let function_name
= function_name
.as_str().unwrap();
40 if function_name
.contains("::_234567890_234567890_234567890_234567890_234567890") {
41 found_long_name_frame
= true;
42 assert
!(function_name
.len() > 200);
47 assert
!(found_long_name_frame
);