-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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_utils
should depend ontracing 0.1.36
, since that version implementedValue
forString
which is used inbevy_ecs
(although it uses the tracing macros re-exported frombevy_utils
);bevy_reflect
should depend onlock_api 0.4.7
, since that version introduced theconst
new
function whichbevy_reflect
uses (also see Bevy-reflect: cannot call non-const fn in constant functions #9374, this could be considered a bug inparking_lot
, sincelock_api
is a transitive dependency through it);bevy_reflect
should depend onthiserror 1.0.25
, since that version introduced the ability to deriveError
on non-'static
types which is used bybevy_reflect
;bevy_pbr
should depend onbitflags 2.3.1
, since that version fixes the use ofSelf::
in the macro, which is used bybevy_pbr
;bevy_pbr
should depend onmeshopt 0.2.1
since that version introducedmeshopt::ffi::{meshopt_optimizeMeshlet, simplify_scale}
which are used inbevy_pbr
(see also Use correct minimal version of meshopt #13551);bevy_render
should depend onimage 0.24.3
, since that version introduced theexr
feature flag (before it was calledopenexr
), which is used bybevy_render
(see Fixbevy_render
'simage
dependency version #14505);bevy_text
should depend onglam 0.24.1
, since that version introduced theVec2::INFINITY
associated constant (should be fixed by Fix erronenous glam version #9653);bevy_render
should depend onimage 0.25.2
since that version introducedimage::ImageReader
used bybevy_render
, instead it only depends onimage 0.25
tools/example-showcase
should depend onpbr 1.1.1
, becausepbr 1.1.0
had a bug with imports on Windows;bytemuck
used to declare only a dependency onbytemuck_derive 1
while it actually uses features ofbytemuck_derive 1.1
and later. This was fixed onbytemuck 1.12
, butbevy
crates depend only on older versions ofbytemuck
(bevy_pbr
depends onbytemuck 1
,bevy_ui
,bevy_core
,bevy_sprite
andbevy_render
onbytemuck 1.5
; also, thebevy
crate depends onbytemuck 1.7
but only as adev-dependency
);- some crate depend transitively on
winapi 0.2.5
, but it doesn't compile.winapi 0.2.7
worked though; gpu_allocator
declares a dependency onbacktrace 0.3
, but it uses features ofbacktrace 0.3.3
and later. I would consider this a bug ofgpu_allocator
since 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).