Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bugfix] protos with the same package name prefix fail to compile #2923

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on Oct 6, 2024

  1. [Bugfix] protos with the same package name prefix fail to compile

    When proto files sharing the same package name prefixes reference types from
    each other, protoc_wrapper will generate code with incorrect module
    scope resulting in the following compilation error:
    
    ```
    error[E0412]: cannot find type `CMessage` in module `super`
      --> bazel-out/darwin_arm64-fastbuild/bin/proto/prost/private/tests/shared_package_prefix/shared_pkg_prefix_proto.lib.rs:21:46
       |
    21 |         pub c: ::core::option::Option<super::CMessage>,
       |                                              ^^^^^^^^ not found in `super`
       |
    help: consider importing this struct
       |
    15 +     use crate::pkg::CMessage;
       |
    help: if you import `CMessage`, refer to it directly
       |
    21 -         pub c: ::core::option::Option<super::CMessage>,
    21 +         pub c: ::core::option::Option<CMessage>,
    ```
    
    This Patch refactors the module tree walk implementation to ensure
    generated rust code are wrapped with the correct rust module hierarchy.
    houqp committed Oct 6, 2024
    Configuration menu
    Copy the full SHA
    dbdddb7 View commit details
    Browse the repository at this point in the history