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

Function parameters cannot shadow statics #181

Closed
wouterdebie opened this issue Mar 9, 2023 · 3 comments
Closed

Function parameters cannot shadow statics #181

wouterdebie opened this issue Mar 9, 2023 · 3 comments

Comments

@wouterdebie
Copy link

wouterdebie commented Mar 9, 2023

Cross-post from #318, because I don't really know where I should ask this question.

I'm working on a project that is based on esp-idf-template and when I'm trying to include esp-idf-hal in my Cargo.toml compilation fails with the following error:

error[E0530]: function parameters cannot shadow statics
  --> /Users/wouter.de.bie/.cargo/registry/src/github.com-1ecc6299db9ec823/esp-idf-hal-0.40.1/src/adc.rs:88:17
   |
58 |     use esp_idf_sys::*;
   |         -------------- the static `resolution` is imported here
...
88 |         fn from(resolution: Resolution) -> Self {
   |                 ^^^^^^^^^^ cannot be named the same as a static

error[E0530]: function parameters cannot shadow statics
   --> /Users/wouter.de.bie/.cargo/registry/src/github.com-1ecc6299db9ec823/esp-idf-hal-0.40.1/src/adc.rs:117:37
    |
58  |     use esp_idf_sys::*;
    |         -------------- the static `resolution` is imported here
...
117 |         pub fn resolution(mut self, resolution: Resolution) -> Self {
    |                                     ^^^^^^^^^^ cannot be named the same as a static

error[E0530]: function parameters cannot shadow statics
  --> /Users/wouter.de.bie/.cargo/registry/src/github.com-1ecc6299db9ec823/esp-idf-hal-0.40.1/src/can.rs:76:17
   |
52 |     use esp_idf_sys::*;
   |         -------------- the static `resolution` is imported here
...
76 |         fn from(resolution: Timing) -> Self {
   |                 ^^^^^^^^^^ cannot be named the same as a static

For more information about this error, try `rustc --explain E0530`.
error: could not compile `esp-idf-hal` due to 3 previous errors

I'm compiling on MacOS with ESP IDF v5.0.

Any idea what is wrong?

@wouterdebie
Copy link
Author

After a bit more investigation, I noticed that this error occurs when adding an extra component esp-camera. My Cargo.toml contains:

package.metadata.esp-idf-sys]
extra_components = [
    { component_dirs = [ "vendor" ], bindings_header = "src/bindings.h" }
]

And I have a bindings.h that contains #include "esp_camera.h". When removing the extra_components my project compiles without errors.

@wouterdebie
Copy link
Author

And I've just pushed my code to https://github.com/wouterdebie/esp32-cam-rs

@ivmarkov
Copy link
Collaborator

ivmarkov commented Mar 9, 2023

Closing in favor of esp-rs/esp-idf-hal#182 and esp-rs/esp-idf-hal#183

@ivmarkov ivmarkov closed this as completed Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants