Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-4661

Rust enum name wrong case in generated structs

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.11.0
    • Fix Version/s: 0.12.0
    • Component/s: Rust - Compiler
    • Labels:
      None
    • Environment:

      C:\Users\jake>rustup show
      Default host: x86_64-pc-windows-msvc

      stable-x86_64-pc-windows-msvc (default)
      rustc 1.30.0 (da5f414c2 2018-10-24)

      Description

      For this thrift (note lowercase "e" at beginning of enum name):

      enum ePlatform

      { None = 0 }

      struct SettingItem

      { 1: ePlatform platform }

      Generated with:

      thrift -gen rs -out ../rust/thrift/src enum_lowercase_prefix.thrift

      Generated Rust fails to compile:

      error[E0412]: cannot find type `ePlatform` in this scope
      --> src\enum_lowercase_prefix.rs:71:24
       
      71 | pub platform: Option<ePlatform>,

      ^^^^^^^^^ did you mean `EPlatform`?

       

      In t_rs_generator.cc line 3025:

      return rust_namespace(ttype) + ttype->get_name();

      To match behavior in generate_enum(), probably needs to be:

      return rust_namespace(ttype) + rust_camel_case(ttype->get_name());

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                allengeorge Allen George
                Reporter:
                jeikabu J W
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: