私はrust-nmeaAクレートに依存しB、B依存しているクレートを持っています。
クレートをビルドすると、 rust-nmea依存関係のビルド中に大量Aのエラー (すべて失敗use std::error::Error;) が発生しました。
error[E0599]: no method named `description` found for type `nom::Err<&[u8]>` in the current scope
--> /home/evgeniy/.cargo/registry/src/github.com-1ecc6299db9ec823/nmea-0.0.6/src/parse.rs:100:44
|
100 | IError::Error(e) => e.description().to_string(),
| ^^^^^^^^^^^
|
= help: items from traits can only be used if the trait is in scope
= note: the following trait is implemented but not in scope, perhaps add a `use` for it:
candidate #1: `use std::error::Error;`
しかし、crate のソースツリーに移動してBrun を実行するcargo buildと、すべてエラーなしでビルドされます (私に従っていれば、 rust-nmeaAに依存しB、B依存します)。
また、/home/evgeniy/.cargo/registry/src/github.com-1ecc6299db9ec823/nmea-0.0.6/(コンパイルエラーを参照)に移動して実行するとcargo build、すべて問題ありません。
のカーゴ ツリー ショーA:
│ ├── chrono v0.4.0
│ │ ├── num v0.1.40
│ │ │ ├── num-integer v0.1.35
│ │ │ │ └── num-traits v0.1.40
│ │ │ ├── num-iter v0.1.34
│ │ │ │ ├── num-integer v0.1.35 (*)
│ │ │ │ └── num-traits v0.1.40 (*)
│ │ │ └── num-traits v0.1.40 (*)
│ │ └── time v0.1.38
│ │ └── libc v0.2.27
├── nmea v0.0.6
│ ├── chrono v0.4.0 (*)
│ └── nom v3.2.0
│ └── memchr v1.0.1 (*)
そして、cargo rust-nmeaによってキャッシュされた場合:
├── chrono v0.4.0
│ ├── num v0.1.40
│ │ ├── num-integer v0.1.35
│ │ │ └── num-traits v0.1.40
│ │ ├── num-iter v0.1.34
│ │ │ ├── num-integer v0.1.35 (*)
│ │ │ └── num-traits v0.1.40 (*)
│ │ └── num-traits v0.1.40 (*)
│ └── time v0.1.38
│ └── libc v0.2.27
└── nom v3.2.0
└── memchr v1.0.1
└── libc v0.2.27 (*)
そのため、良いケースと悪いケースの両方で同じ依存関係を使用しました。
run の場合、両方のケースでコマンドラインcargo build -v -j1を取得しました。rustc
良いケースと悪いケースの唯一の違いは、次の部分です。
-L dependency=/home/evgeniy/.cargo/registry/src/github.com-1ecc6299db9ec823/nmea-0.0.6/target/debug/deps --extern chrono=/home/evgeniy/.cargo/registry/src/github.com-1ecc6299db9ec823/nmea-0.0.6/target/debug/deps/libchrono-8e9e54e691d9b988.rlib --extern nom=/home/evgeniy/.cargo/registry/src/github.com-1ecc6299db9ec823/nmea-0.0.6/target/debug/deps/libnom-b72336f662b090c1.rlib
悪いケースでは、ライブラリへのパスが異なり、libnom-e2ec53418967eac0.rlibの代わりにlibnom-b72336f662b090c1.rlib, while がlibchrono-8e9e54e691d9b988.rlib一致します。
クレートAとBソースは近いので、問題をより単純なケースに減らすことはできません。rust-nmea以外では使用されないnomクレート。
rust-nmeaは単純な方法で使用されます。フラグなどはありません。ABnmea = 0.0.6Cargo.toml
同じフラグ (フラグがまったくない) を持つクレートの依存関係が構文エラーを生成する場合と生成しない場合があるのはなぜですか?