Rust symbols can become quite long due to namespacing introduced by modules, types, traits, generics, etc. For instance, the following code: pub mod my_module { pub struct MyType; pub struct MyGenericType<T>(T); pub trait MyTrait { fn my_method() -> u32; } impl MyTrait for MyGenericType<MyType> { fn my_method() -> u32 { 42 } } } generates a symbol of length 96 when using the upcoming v0 mangling scheme: _RNvXNtCshGpAVYOtgW1_7example9my_moduleINtB2_13MyGenericTypeNtB2_6MyTypeENtB2_7MyTrait9my_method At the moment, Rust symbols may reach up to 300 in length. Setting 512 as the maximum seems like a reasonable choice to keep some headroom.
Showing the changes to scripts (1 of 6 files). Show all
Unified · Split
| @@ -30,7 +30,7 @@ · 29 unmodified lines | |||
| 30 | #define _stringify_1(x) #x | 30 | #define _stringify_1(x) #x |
| 31 | #define _stringify(x) _stringify_1(x) | 31 | #define _stringify(x) _stringify_1(x) |
| 32 | 32 | ||
| 33 | #define KSYM_NAME_LEN 128 | 33 | #define KSYM_NAME_LEN 512 |
| 34 | 34 | ||
| 35 | /* | 35 | /* |
| 36 | * A substantially bigger size than the current maximum. | 36 | * A substantially bigger size than the current maximum. |
| @@ -39,7 +39,7 @@ · 2 unmodified lines | |||
| 39 | * for the fscanf() format string. Therefore, a _Static_assert() is | 39 | * for the fscanf() format string. Therefore, a _Static_assert() is |
| 40 | * used instead to maintain the relationship with KSYM_NAME_LEN. | 40 | * used instead to maintain the relationship with KSYM_NAME_LEN. |
| 41 | */ | 41 | */ |
| 42 | #define KSYM_NAME_LEN_BUFFER 512 | 42 | #define KSYM_NAME_LEN_BUFFER 2048 |
| 43 | _Static_assert( | 43 | _Static_assert( |
| 44 | KSYM_NAME_LEN_BUFFER == KSYM_NAME_LEN * 4, | 44 | KSYM_NAME_LEN_BUFFER == KSYM_NAME_LEN * 4, |
| 45 | "Please keep KSYM_NAME_LEN_BUFFER in sync with KSYM_NAME_LEN" | 45 | "Please keep KSYM_NAME_LEN_BUFFER in sync with KSYM_NAME_LEN" |