@@ -146,6 +146,7 @@ fn run_command(cmd: Command) -> anyhow::Result<()> {
146
146
let mut yanked_deps = false ;
147
147
let mut missing_deps = false ;
148
148
let mut broken_deps = false ;
149
+ let mut broken_lockfile = false ;
149
150
150
151
let mut process = |line : & str , _: & mut ProcessLinesActions | {
151
152
if line. contains ( "failed to select a version for the requirement" ) {
@@ -158,6 +159,8 @@ fn run_command(cmd: Command) -> anyhow::Result<()> {
158
159
|| line. contains ( "error: invalid table header" )
159
160
{
160
161
broken_deps = true ;
162
+ } else if line. contains ( "error: failed to parse lock file at" ) {
163
+ broken_lockfile = true ;
161
164
}
162
165
} ;
163
166
@@ -172,6 +175,9 @@ fn run_command(cmd: Command) -> anyhow::Result<()> {
172
175
Err ( CommandError :: ExecutionFailed { status : _, stderr } ) if broken_deps => {
173
176
Err ( PrepareError :: BrokenDependencies ( stderr) . into ( ) )
174
177
}
178
+ Err ( CommandError :: ExecutionFailed { status : _, stderr } ) if broken_lockfile => {
179
+ Err ( PrepareError :: InvalidCargoLock ( stderr) . into ( ) )
180
+ }
175
181
Err ( err) => Err ( err. into ( ) ) ,
176
182
}
177
183
}
@@ -390,6 +396,9 @@ pub enum PrepareError {
390
396
/// Some of the dependencies do not exist anymore.
391
397
#[ error( "the crate depends on missing dependencies: \n \n {0}" ) ]
392
398
MissingDependencies ( String ) ,
399
+ /// cargo rejected (generating) the lockfile
400
+ #[ error( "the crate has a broken lockfile: \n \n {0}" ) ]
401
+ InvalidCargoLock ( String ) ,
393
402
}
394
403
395
404
#[ cfg( test) ]
0 commit comments