-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cargo check (mis)-reports errors on test targets, which all build and run fine #9349
Comments
Hm, that's a strange one! If you're able to still reproduce the problem, some things you could try:
|
@ehuss Sure, I've saved a snapshot of the project that consistently reproduce the issue on multiple machines. I've attached a terminal log of me executing the following command in order:
Here is a file structure of my project, and my Cargo.toml, in case it helps:
[package]
name = "ebony"
version = "0.0.1-dev"
license = "BSD-3-Clause"
authors = ["Yi Rong <[email protected]>"]
description = "Hybrid Parallelism Global Orchestration"
repository = "https://code.byted.org/rongyi/ebony"
homepage = "https://code.byted.org/rongyi/ebony"
edition = "2018"
exclude = [
"contrib/*",
"runtime/*",
"frontend/*",
"tools/*",
"exp/*",
"hlo-library/*",
"ci/*",
]
[lib]
name = "ebony"
path = "src/lib.rs"
crate-type = ["cdylib", "rlib"]
[[bin]]
name = "ebony_cli"
path = "src/main.rs"
[dependencies]
# Input HLO
protobuf = "2.22.0"
uuid = { version = "0.8", features = ["serde", "v4", "v5"] }
# Parallel Programming
itertools = "0.10.0"
rayon = "1.5"
ordered-float = "2.1"
dashmap = "3.11"
stacker = "0.1"
# EIR Graph
petgraph = "0.5"
# Serialization of EIR
serde = { version = "1.0", features = ["derive", "rc"] }
serde_yaml = "0.8"
serde_json = "1.0"
serde_cbor = "0.11.1"
serde_with = "1.8.0"
# Rust Helpers
thiserror = "1.0"
anyhow = "1.0"
log = { version = "0.4.14", features = ["kv_unstable", "std"] }
kv-log-macro = "1.0"
# Pretty Print
ansi_term = "0.12"
prettytable-rs = "0.8"
chrono = "0.4"
# Main CLI
structopt = "0.3"
# Python Binding
[dependencies.pyo3]
version = "0.13"
[features]
extension-module = ["pyo3/extension-module"]
default = ["extension-module"]
# TF RosenBridge
[dependencies.tensorflow_rosenbridge]
# NOTE: for GitHub OSS version
# git = "https://lab.rongyi.io/eng/mlsys/tensorflow-protos-rs"
# NOTE: for Monorepo build
# path = "../../../eng/mlsys/tensorflow-protos-rs/eng-mlsys-tensorflow-master"
path = "rosenbridge"
features = ["xla", "hlo", "xla_data", "hlo_execution_profile_data"]
package = "tensorflow_rosenbridge_emt_master" # ${Monorepo}/eng/mlsys/tensorflow@master
# Ebony macros
[dependencies.ebony_macros]
path = "macros"
[dev-dependencies]
cargo2junit = "0.1.7"
[package.metadata.maturin]
requires-dist = ["graphviz~=0.13"] |
Hm, yea, it looks like it is behaving as-if there are two copies of anyhow (the types are mismatching), as well as Would you mind clearing the target directory and posting the output of both |
Hi @ehuss , sorry for the late reply. The problem still persists, and here's my cargo check and build verbose log. rm -rf target
cargo check --all-targets --verbose &> check.log Log Pastebin: https://pastebin.ubuntu.com/p/b6TC9tX2Ct/ rm -rf target
cargo build --verbose &> build.log
cargo build --examples --no-default-features --verbose &>> build.log
cargo build --tests --no-default-features --verbose &>> build.log Log Pastebin: https://pastebin.ubuntu.com/p/tXsnJfG9wF/ Here's a rustc command copied from each pastebin log above, both compiling the same test: # Check
Running `rustc --crate-name test_dx_eir_io --edition=2018 tests/test_dx_eir_io.rs --error-format=json --json=diagnostic-rendered-ansi --emit=dep-info,metadata -C embed-bitcode=no -C debuginfo=2 --test --cfg 'feature="default"' --cfg 'feature="extension-module"' -C metadata=752d9008c081a063 -C extra-filename=-752d9008c081a063 --out-dir /home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps -C incremental=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/incremental -L dependency=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps --extern ansi_term=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libansi_term-8ce5d0a29c873f5b.rmeta --extern anyhow=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libanyhow-bbfde8b292a6254c.rmeta --extern chrono=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libchrono-1548f9516ca6365c.rmeta --extern dashmap=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libdashmap-2724b6154e11ce47.rmeta --extern dyn_clonable=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libdyn_clonable-bbf5239723dc1217.rmeta --extern ebony=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libebony.rlib --extern ebony_macros=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libebony_macros-88f6fc692d4802c8.so --extern itertools=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libitertools-47140419371f3318.rmeta --extern kv_log_macro=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libkv_log_macro-4be0b8dc4a1c89c2.rmeta --extern log=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/liblog-96e73fa8caefdd45.rmeta --extern ordered_float=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libordered_float-e950cb78843605b6.rmeta --extern petgraph=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libpetgraph-2f288a90bbb87435.rmeta --extern prettytable=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libprettytable-26f1e55d5e9aa22f.rmeta --extern protobuf=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libprotobuf-1880b3260f839d05.rmeta --extern pyo3=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libpyo3-c662c5000744e374.rmeta --extern rayon=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/librayon-ca4e6fa1e1ad8d51.rmeta --extern serde=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libserde-2a31be97e4bca51f.rmeta --extern serde_cbor=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libserde_cbor-5977b1fba8c0642c.rmeta --extern serde_json=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libserde_json-1221e05f4483a350.rmeta --extern serde_with=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libserde_with-724522e3513120e0.rmeta --extern serde_yaml=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libserde_yaml-4177d9964ea96727.rmeta --extern stacker=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libstacker-f9d6e9d1388061a2.rmeta --extern structopt=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libstructopt-e4a244da1e9e9318.rmeta --extern tensorflow_rosenbridge=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libtensorflow_rosenbridge_emt_master-965fa9ff4917598e.rmeta --extern thiserror=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libthiserror-4727584834cbedf2.rmeta --extern typetag=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libtypetag-7be8c9d47980b810.rmeta --extern uuid=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libuuid-5e925cbdcac4dc1c.rmeta -L native=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/build/psm-f8e633fbc74b891a/out`
# Build
Running `rustc --crate-name test_dx_eir_io --edition=2018 tests/test_dx_eir_io.rs --error-format=json --json=diagnostic-rendered-ansi --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 --test -C metadata=b27d93528af4f66c -C extra-filename=-b27d93528af4f66c --out-dir /home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps -C incremental=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/incremental -L dependency=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps --extern ansi_term=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libansi_term-389f8788aa0acea0.rlib --extern anyhow=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libanyhow-af47ab8c672d4ea6.rlib --extern chrono=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libchrono-1daa02e0ee90b929.rlib --extern dashmap=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libdashmap-d2c92c8cffb8a81b.rlib --extern dyn_clonable=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libdyn_clonable-6ba1af9dd15a91ff.rlib --extern ebony=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libebony.rlib --extern ebony_macros=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libebony_macros-88f6fc692d4802c8.so --extern itertools=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libitertools-cd6259a4fce34e80.rlib --extern kv_log_macro=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libkv_log_macro-eb2df51715a7153d.rlib --extern log=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/liblog-257e9d8e6616ac0e.rlib --extern ordered_float=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libordered_float-1c61cd1f9187f71d.rlib --extern petgraph=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libpetgraph-199069e4dad294c5.rlib --extern prettytable=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libprettytable-989290056fde5985.rlib --extern protobuf=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libprotobuf-e43f80596f921d2e.rlib --extern pyo3=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libpyo3-cadce405ca06c6ba.rlib --extern rayon=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/librayon-f2495bae360fbaf4.rlib --extern serde=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libserde-4234845126fbd5b8.rlib --extern serde_cbor=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libserde_cbor-5e756bf3c1271543.rlib --extern serde_json=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libserde_json-8fff24548708018b.rlib --extern serde_with=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libserde_with-f9594084f4fdfad0.rlib --extern serde_yaml=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libserde_yaml-3d09f420b85a9378.rlib --extern stacker=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libstacker-11daf17aa1307882.rlib --extern structopt=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libstructopt-33f13edd63981811.rlib --extern tensorflow_rosenbridge=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libtensorflow_rosenbridge_emt_master-f45ecc3801cf8785.rlib --extern thiserror=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libthiserror-52d24f5f7b3608b6.rlib --extern typetag=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libtypetag-5f2a268330bd28df.rlib --extern uuid=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/deps/libuuid-67f303e397ed29d6.rlib -L native=/usr/lib -L native=/home/rongyi/Monorepo/work/bytedance/ebony/target/debug/build/psm-f8e633fbc74b891a/out`
FYI, I use |
Thanks for posting the extra information. There's a piece of the puzzle I'm missing, and I can't quite fill in the blank. A few more questions:
|
@ehuss Is it because I specified the crate type as
Not really. The first one is a rosenbridge/Cargo.toml
macros/Cargo.toml
I do, but due to a rust-protobuf issue (stepancheg/rust-protobuf#551), it currently does not build under nightly Rust. |
The |
Indeed, thanks for the clarification. I've attached the formatted json dump here: https://pastebin.ubuntu.com/p/phzqTqQZpw/ |
Unfortunately I am running out of ideas on what could cause this. From what I can tell, checking the binaries, tests, and examples all decide that the library needs to be built instead of checked. The code for adding that is here. The key part is the call to
None of those are true, so I am a bit baffled on how that function could think the library is being built for the host. If you can create a reproduction that you can share, that would be helpful. Like, if you can take your project, remove all the code (just an empty |
Problem
Running
cargo build --all-targets
does NOT show any errors (not even a single warning), and all targets run fine. But runningcargo check --all-targets
gives out errors that should not exists, and exits prematurely witherror: could not compile xxx
. A detailed example is attached below.Steps
I haven't got the time to make a minimal reproducible case, but have a real project showcasing the error below.
Possible Solution(s)
Beyond my reach. But I would guess it's related to import resolution, in my case interpreting
Result
tostd::result::Result
instead of the importedanyhow::Result
.Notes
Output of
cargo version
:Screenshot of the issue
In the screenshot, the left pane of the integrated terminal is running
cargo check --all-targets
, and the right is runningcargo build --all-targets
. The build works fine butcargo check
gives out 22 errors which I'm sure are not valid errors after examination.Most errors say "the trait
std::error::Error
is not implemented foranyhow::Error
", which seems to me thatcargo check
thinks theResult
isstd::result::Result
, however all theResult
in this project isanyhow::Result
, so the error does not make sense.All the errors are reported by
cargo check
on test targetstests/*.rs
. Runningcargo build --tests
gives no error. Running the tests shows 100% pass. So it's likely a problem ofcargo check
.The text was updated successfully, but these errors were encountered: