[prost] Fix handling of message names with acronyms (#2193)

For example, the message name `SomeAPI`. Internally protoc-gen-prost
[converts](https://github.com/neoeinstein/protoc-gen-prost/blob/1a6d3593622af18b75a4a79f545f8530cdaf444f/protoc-gen-tonic/src/util.rs#L14)
this to upper camel case, but rules_rust is not doing that when
populating the `--extern_path` args. The result is that when a message
with an acroynym in its name is included in another proto file, the
generated code has a type name with the wrong casing.

Without this fix, the added test fails to build like this:

```
error[E0412]: cannot find type `NameWithCAPS` in module `camel_case_proto::camel_case`
 --> bazel-out/k8-fastbuild/bin/proto/prost/private/tests/camel_case/another_proto.lib.rs:9:75
  |
9 |         pub inner: ::core::option::Option<::camel_case_proto::camel_case::NameWithCAPS>,
  |                                                                           ^^^^^^^^^^^^ help: a struct with a similar name exists: `NameWithCaps`
 --> bazel-out/k8-fastbuild/bin/proto/prost/private/tests/camel_case/camel_case_proto.lib.rs:7:5
  |
  = note: similarly named struct `NameWithCaps` defined here

error: aborting due to previous error
```
5 files changed
tree: 05f1c2bc3baa6359fc696b68a120920a4b4d4f8e
  1. .bazelci/
  2. .github/
  3. bindgen/
  4. cargo/
  5. crate_universe/
  6. docs/
  7. examples/
  8. ffi/
  9. proto/
  10. rust/
  11. test/
  12. tools/
  13. util/
  14. wasm_bindgen/
  15. .bazelignore
  16. .bazelrc
  17. .clang-format
  18. .gitattributes
  19. .gitignore
  20. .rustfmt.toml
  21. ARCHITECTURE.md
  22. AUTHORS
  23. BUILD.bazel
  24. CODEOWNERS
  25. COMPATIBILITY.md
  26. CONTRIBUTING.md
  27. CONTRIBUTORS
  28. LICENSE.txt
  29. MODULE.bazel
  30. README.md
  31. version.bzl
  32. WORKSPACE.bazel
README.md

Rust Rules

  • Postsubmit Build status

Overview

This repository provides rules for building Rust projects with Bazel.

Community

General discussions and announcements take place in the GitHub Discussions, but there are additional places where community members gather to discuss rules_rust.

Documentation

Please refer to the full documentation.