@@ -188,7 +188,27 @@ impl LockfileMismatchHandler {
188
188
is_force_overwrite_lockfiles_v4_to_v3 : bool ,
189
189
) -> anyhow:: Result < ( ) > {
190
190
if !is_force_overwrite_lockfiles_v4_to_v3 {
191
- Self :: exit_with_v3v4_hack_suggestion ( ) ;
191
+ #[ expect( clippy:: needless_raw_strings, reason = "false positive" ) ]
192
+ const V3V4_HACK_SUGGESTION : & str = r"
193
+ Because `cargo gpu` uses a dedicated Rust toolchain for compiling shaders,
194
+ it's possible that the `Cargo.lock` manifest version of the shader crate
195
+ does not match the `Cargo.lock` manifest version of the workspace.
196
+ This is due to a change in the defaults introduced in Rust 1.83.0.
197
+
198
+ One way to resolve this is to force the workspace to use the same version
199
+ of Rust as required by the shader. However, that is not often ideal or even
200
+ possible. Another way is to exclude the shader from the workspace. This is
201
+ also not ideal if you have many shaders sharing config from the workspace.
202
+
203
+ Therefore, `cargo gpu build/install` offers a workaround with the argument:
204
+ --force-overwrite-lockfiles-v4-to-v3
205
+
206
+ See `cargo gpu build --help` for more information.
207
+ " ;
208
+ #[ expect( clippy:: non_ascii_literal, reason = "this character is really needed" ) ]
209
+ {
210
+ anyhow:: bail!( "conflicting `Cargo.lock` versions detected ⚠️{V3V4_HACK_SUGGESTION}" )
211
+ }
192
212
}
193
213
194
214
Self :: replace_cargo_lock_manifest_version ( offending_cargo_lock, "4" , "3" )
@@ -237,32 +257,6 @@ impl LockfileMismatchHandler {
237
257
238
258
Ok ( ( ) )
239
259
}
240
-
241
- /// Exit and give the user advice on how to deal with the infamous
242
- /// v3/v4 Cargo lockfile version problem.
243
- #[ expect( clippy:: unwrap_used, reason = "It's CLI output" ) ]
244
- fn exit_with_v3v4_hack_suggestion ( ) {
245
- crate :: user_output!(
246
- "Conflicting `Cargo.lock` versions detected ⚠️\n \
247
- Because `cargo gpu` uses a dedicated Rust toolchain for compiling shaders\n \
248
- it's possible that the `Cargo.lock` manifest version of the shader crate\n \
249
- does not match the `Cargo.lock` manifest version of the workspace. This is\n \
250
- due to a change in the defaults introduced in Rust 1.83.0.\n \
251
- \n \
252
- One way to resolve this is to force the workspace to use the same version\n \
253
- of Rust as required by the shader. However that is not often ideal or even\n \
254
- possible. Another way is to exclude the shader from the workspace. This is\n \
255
- also not ideal if you have many shaders sharing config from the workspace.\n \
256
- \n \
257
- Therefore `cargo gpu build/install` offers a workaround with the argument:\n \
258
- --force-overwrite-lockfiles-v4-to-v3\n \
259
- \n \
260
- See `cargo gpu build --help` for more information.\n \
261
- "
262
- )
263
- . unwrap ( ) ;
264
- std:: process:: exit ( 1 ) ;
265
- }
266
260
}
267
261
268
262
impl Drop for LockfileMismatchHandler {
0 commit comments