tokio-rs / prost

PROST! a Protocol Buffers implementation for the Rust Language
Apache License 2.0
3.78k stars 489 forks source link

Unable to import proto from another library #984

Closed FreePhoenix888 closed 3 months ago

FreePhoenix888 commented 6 months ago

How to reproduce

git clone https://github.com/FreePhoenix888/prost-build-import-from-another-folder-error-example.git
cd prost-build-import-from-another-folder-error-example
cargo build

See build result:

PS C:\Users\FreePhoenix\Programming\prost-build-import-from-another-folder-error-example> cargo build
   Compiling egui_example v0.1.0 (C:\Users\FreePhoenix\Programming\prost-build-import-from-another-folder-error-example)
error[E0412]: cannot find type `StorageSettings` in module `super::storage_settings`                                                                                                                                               
 --> C:\Users\FreePhoenix\Programming\prost-build-import-from-another-folder-error-example\target\debug\build\egui_example-e3762171fe50578d\out/settings.rs:7:34
  |
7 |         super::storage_settings::StorageSettings,
  |                                  ^^^^^^^^^^^^^^^ not found in `super::storage_settings`
  |
help: consider importing this struct
 --> src\settings\mod.rs:8:5
  |
8 +     use crate::settings::storage_settings::storage_settings::StorageSettings;
  |
help: if you import `StorageSettings`, refer to it directly
  |
7 -         super::storage_settings::StorageSettings,
7 +         StorageSettings,
  |
...And other errors that are not related to this issue...

Additional Info

If we put another proto in the same folder the problem does not happen Here is the branch reproducing it: https://github.com/FreePhoenix888/prost-build-import-from-another-folder-error-example/tree/the_same_folder_working_way Use it the same way, just run cargo build in it

FreePhoenix888 commented 6 months ago

@LucioFranco , just pinging you to make sure you see this issue, I would be glad to get your help

caspermeijn commented 3 months ago

I don't understand what the problem is. Can you try to explain it differently?