@@ -146,6 +146,7 @@ fn run_command(cmd: Command) -> anyhow::Result<()> {
146146 let mut yanked_deps = false ;
147147 let mut missing_deps = false ;
148148 let mut broken_deps = false ;
149+ let mut broken_lockfile = false ;
149150
150151 let mut process = |line : & str , _: & mut ProcessLinesActions | {
151152 if line. contains ( "failed to select a version for the requirement" ) {
@@ -158,6 +159,8 @@ fn run_command(cmd: Command) -> anyhow::Result<()> {
158159 || line. contains ( "error: invalid table header" )
159160 {
160161 broken_deps = true ;
162+ } else if line. contains ( "error: failed to parse lock file at" ) {
163+ broken_lockfile = true ;
161164 }
162165 } ;
163166
@@ -172,6 +175,9 @@ fn run_command(cmd: Command) -> anyhow::Result<()> {
172175 Err ( CommandError :: ExecutionFailed { status : _, stderr } ) if broken_deps => {
173176 Err ( PrepareError :: BrokenDependencies ( stderr) . into ( ) )
174177 }
178+ Err ( CommandError :: ExecutionFailed { status : _, stderr } ) if broken_lockfile => {
179+ Err ( PrepareError :: InvalidCargoLock ( stderr) . into ( ) )
180+ }
175181 Err ( err) => Err ( err. into ( ) ) ,
176182 }
177183}
@@ -390,6 +396,9 @@ pub enum PrepareError {
390396 /// Some of the dependencies do not exist anymore.
391397 #[ error( "the crate depends on missing dependencies: \n \n {0}" ) ]
392398 MissingDependencies ( String ) ,
399+ /// cargo rejected (generating) the lockfile
400+ #[ error( "the crate has a broken lockfile: \n \n {0}" ) ]
401+ InvalidCargoLock ( String ) ,
393402 /// Uncategorized error
394403 #[ doc( hidden) ]
395404 #[ error( "uncategorized prepare error" ) ]
0 commit comments