-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Description
-Z minimal-versions is an unstable cargo flag to generate a Cargo.lock with the minimal versions possible, rather than the latest ones. This helps finding cases where a crate depends on features of a dependency which were released in a later semver-compatible version than the one reported in the Cargo.toml.
I tried running cargo minimal-versions (which automates a bunch of work you have to do to correctly use -Z minimal-versions) and the result was not that good, although most issues were due to dependencies not respecing minimal versions themself.
I found the following issues (though there could be more hidden, see the final note):
bevy_ecs/bevy_utilsshould depend ontracing 0.1.36, since that version implementedValueforStringwhich is used inbevy_ecs(although it uses the tracing macros re-exported frombevy_utils);bevy_reflectshould depend onlock_api 0.4.7, since that version introduced theconstnewfunction whichbevy_reflectuses (also see Bevy-reflect: cannot call non-const fn in constant functions #9374, this could be considered a bug inparking_lot, sincelock_apiis a transitive dependency through it);bevy_reflectshould depend onthiserror 1.0.25, since that version introduced the ability to deriveErroron non-'statictypes which is used bybevy_reflect;bevy_pbrshould depend onbitflags 2.3.1, since that version fixes the use ofSelf::in the macro, which is used bybevy_pbr;bevy_pbrshould depend onmeshopt 0.2.1since that version introducedmeshopt::ffi::{meshopt_optimizeMeshlet, simplify_scale}which are used inbevy_pbr(see also Use correct minimal version of meshopt #13551);bevy_rendershould depend onimage 0.24.3, since that version introduced theexrfeature flag (before it was calledopenexr), which is used bybevy_render(see Fixbevy_render'simagedependency version #14505);bevy_textshould depend onglam 0.24.1, since that version introduced theVec2::INFINITYassociated constant (should be fixed by Fix erronenous glam version #9653);bevy_rendershould depend onimage 0.25.2since that version introducedimage::ImageReaderused bybevy_render, instead it only depends onimage 0.25tools/example-showcaseshould depend onpbr 1.1.1, becausepbr 1.1.0had a bug with imports on Windows;bytemuckused to declare only a dependency onbytemuck_derive 1while it actually uses features ofbytemuck_derive 1.1and later. This was fixed onbytemuck 1.12, butbevycrates depend only on older versions ofbytemuck(bevy_pbrdepends onbytemuck 1,bevy_ui,bevy_core,bevy_spriteandbevy_renderonbytemuck 1.5; also, thebevycrate depends onbytemuck 1.7but only as adev-dependency);- some crate depend transitively on
winapi 0.2.5, but it doesn't compile.winapi 0.2.7worked though; gpu_allocatordeclares a dependency onbacktrace 0.3, but it uses features ofbacktrace 0.3.3and later. I would consider this a bug ofgpu_allocatorsince the use is internal. This hasn't been fixed yet, though I submitted a PR (Fix minimal versions Traverse-Research/gpu-allocator#174).
I decided to report the last three issues because, while they are not strictly bevy's fault, they impact building bevy with minimal versions.
Note that the analysis must consider the whole workspace together (crates in tools included), and this may hide problems in the single crates due to newer dependencies specified by other crates (and this could also apply to dependencies of dependencies...). So for example if bevy_ecs declared a dependency on foo 1 but actually used features from foo 1.1, and bevy_reflect declared a dependency on foo 1.1, then no error would be raised while compiling bevy_ecs, even though it technically declared a wrong dependency. To find some of these kind of errors you would have to compile the single crates outside the workspace, which is a lot more work to do. This could be doable just for crates that can be used alone, like bevy_ecs and bevy_reflect though.
It would be nice if in the future this was automatically tested, to ensure that people don't get weird errors like in #9374, or recently one posted on Discord with tracing older than 0.1.36 (which seems to not happen on the master branch likely due to some transitive dependency).