dtolnay/typetag

Typetag 0.1.8 need user to explicitly include inventory = "0.2" in Cargo.toml

DataCorrupted opened this issue · 2 comments

I wrote a library hoping to unify all numerical types using typetag a year ago.
While I was updating it, the library stopped compiling, I have managed to get a minimal failure example here

The complaint is as follows:

   Compiling typetag-report v0.1.0 (/home/peter/typetag-report)
error[E0433]: failed to resolve: could not find `inventory` in `{{root}}`
   --> /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/inventory-0.2.0/src/lib.rs:393:13
    |
393 |             #[$crate::ctor]
    |             ^^^^^^^^^^^^^^^ could not find `inventory` in `{{root}}`

error[E0433]: failed to resolve: could not find `inventory` in `{{root}}`
   --> /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/inventory-0.2.0/src/lib.rs:393:13
    |
393 |             #[$crate::ctor]
    |             ^^^^^^^^^^^^^^^ not found in `inventory::core::cell`
    |
help: consider importing one of these items
    |
1   | use core::cell::UnsafeCell;
    |
1   | use std::cell::UnsafeCell;
    |

The only fix is to include inventory = "0.2" even when the project didn't explicitly use it.

  • If this is the desired behavior, please include inventory = "0.2" in README
  • If this is a bug, please advise how to fix it and I am happy to send a PR.

That's an old rustc bug. I believe it was fixed more than a year ago in rustc.

Thanks, the problem is resolved once I upgraded rustc to 1.56.

However, I am not familiar with the rustc bug you mentioned, would you care to elaborate?