What happens if you run mir-json-translate-libs and put the generated MIR JSON files in an rlibs directory that was created from a previous mir-json-translate-libs invocation? At the moment, it appears that mir-json-translate-libs will selectively overwrite some---but not necessarily all---of the files in the rlibs directory. Notably, if the previous mir-json-translate-libs invocation used a different MIR JSON schema version than the version that is being used in the new invocation, then this can potentially result in a mixture of MIR JSON files with different schema. This is disastrous, and it can cause mir-json to fail with inscrutable errors such as the following:
called `Result::unwrap()` on an `Err` value: ErrorImpl { code: Message("Expected MIR JSON schema version 10, but found a crate using version 5"), offset: 0 }
The most direct way to avoid this problem is to delete rlibs (and rlibs_real, which rlibs symlinks to) before re-invoking mir-json-translate-libs. This is easy to forget to do, however. It would be nice if mir-json-translate-libs could check to see if the directory it is about to write files to already exists, and if so, ask the user if they wish to delete the directory beforehand.
What happens if you run
mir-json-translate-libsand put the generated MIR JSON files in anrlibsdirectory that was created from a previousmir-json-translate-libsinvocation? At the moment, it appears thatmir-json-translate-libswill selectively overwrite some---but not necessarily all---of the files in therlibsdirectory. Notably, if the previousmir-json-translate-libsinvocation used a different MIR JSON schema version than the version that is being used in the new invocation, then this can potentially result in a mixture of MIR JSON files with different schema. This is disastrous, and it can causemir-jsonto fail with inscrutable errors such as the following:The most direct way to avoid this problem is to delete
rlibs(andrlibs_real, whichrlibssymlinks to) before re-invokingmir-json-translate-libs. This is easy to forget to do, however. It would be nice ifmir-json-translate-libscould check to see if the directory it is about to write files to already exists, and if so, ask the user if they wish to delete the directory beforehand.