When running cargo clippy --tests --all-features --package bevy_image (--tests isn't technically required, but it prevents currently-existing errors with bevy_math from surfacing), bevy_core_pipeline will fail to compile due to not providing a required argument to bevy_image::Image::from_buffer().
Full compilation error log
error[E0061]: this function takes 7 arguments but 6 arguments were supplied
--> crates\bevy_core_pipeline\src\tonemapping\mod.rs:447:5
|
447 | Image::from_buffer(
| ^^^^^^^^^^^^^^^^^^
...
450 | bytes,
| ----- argument #1 of type `std::string::String` is missing
|
note: associated function defined here
--> crates\bevy_image\src\image.rs:873:12
|
873 | pub fn from_buffer(
| ^^^^^^^^^^^
help: provide the argument
|
447 | Image::from_buffer(/* std::string::String */, bytes, image_type, CompressedImageFormats::NONE, false, image_sampler, RenderAssetUsages::RENDER_WORLD)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For more information about this error, try `rustc --explain E0061`.
error: could not compile `bevy_core_pipeline` (lib) due to 1 previous error
After some investigation, I found the issue: if debug assertions are enabled, and bevy_image is compiled with --features dds, then bevy_core_pipeline must also be compiled with --features dds, otherwise a compilation error will occur with bevy_core_pipeline. To explain:
- Assume debug assertions are on
bevy_image::Image::from_buffer() takes a name parameter - but only if --features bevy_image/dds is specified [1]
bevy_core_pipeline will, under certain circumstances, call Image::from_buffer(). If --features bevy_core_pipeline/dds is specified, then bevy_core_pipeline will pass in the name parameter. [1] [2] [3]
- The
bevy_core_pipeline/dds feature will enable bevy_image/dds if it isn't already [1]
- However, because
bevy_image/dds does not enable bevy_core_pipeline/dds, it's possible to compile with bevy_image/dds but without bevy_core_pipeline/dds, leading to this compilation error.
I am unsure how to resolve this issue, hence I'm making this bug report.
When running
cargo clippy --tests --all-features --package bevy_image(--testsisn't technically required, but it prevents currently-existing errors withbevy_mathfrom surfacing),bevy_core_pipelinewill fail to compile due to not providing a required argument tobevy_image::Image::from_buffer().Full compilation error log
After some investigation, I found the issue: if debug assertions are enabled, and
bevy_imageis compiled with--features dds, thenbevy_core_pipelinemust also be compiled with--features dds, otherwise a compilation error will occur withbevy_core_pipeline. To explain:bevy_image::Image::from_buffer()takes anameparameter - but only if--features bevy_image/ddsis specified [1]bevy_core_pipelinewill, under certain circumstances, callImage::from_buffer(). If--features bevy_core_pipeline/ddsis specified, thenbevy_core_pipelinewill pass in thenameparameter. [1] [2] [3]bevy_core_pipeline/ddsfeature will enablebevy_image/ddsif it isn't already [1]bevy_image/ddsdoes not enablebevy_core_pipeline/dds, it's possible to compile withbevy_image/ddsbut withoutbevy_core_pipeline/dds, leading to this compilation error.I am unsure how to resolve this issue, hence I'm making this bug report.