Closed
Description
Code
I tried this code:
use thiserror::Error;
#[derive(Error, Debug)]
pub enum Error {
#[error("error")]
Error,
}
fn main() {
let err = Error::Error;
dbg!(err);
}
with this Cargo.toml
[package]
name = "test"
version = "0.1.0"
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
thiserror = "1.0.30"
I expected to see this happen:
$ cargo clean && cargo +1.40.0 run && touch src/lib.rs && cargo +1.57.0 run
Compiling proc-macro2 v1.0.34
Compiling unicode-xid v0.2.2
Compiling syn v1.0.82
Compiling quote v1.0.10
Compiling thiserror-impl v1.0.30
Compiling thiserror v1.0.30
Compiling test v0.1.0 (/home/hatta/work/repos/playground/test62)
Finished dev [unoptimized + debuginfo] target(s) in 7.30s
Running `target/debug/test`
[src/main.rs:11] err = Error
13.10s user 1.63s system 200% cpu 7.336 total
Compiling proc-macro2 v1.0.34
Compiling unicode-xid v0.2.2
Compiling syn v1.0.82
Compiling quote v1.0.10
Compiling thiserror-impl v1.0.30
Compiling thiserror v1.0.30
Compiling test v0.1.0 (/home/hatta/work/repos/playground/test62)
Finished dev [unoptimized + debuginfo] target(s) in 6.34s
Running `target/debug/test`
[src/main.rs:11] err = Error
Instead, this happened:
$ cargo clean && cargo +1.40.0 run && touch src/lib.rs && cargo +1.57.0 run
Compiling proc-macro2 v1.0.34
Compiling unicode-xid v0.2.2
Compiling syn v1.0.82
Compiling quote v1.0.10
Compiling thiserror-impl v1.0.30
Compiling thiserror v1.0.30
Compiling test v0.1.0 (/home/hatta/work/repos/playground/test62)
Finished dev [unoptimized + debuginfo] target(s) in 7.30s
Running `target/debug/test`
[src/main.rs:11] err = Error
13.10s user 1.63s system 200% cpu 7.336 total
Compiling proc-macro2 v1.0.34
Compiling unicode-xid v0.2.2
Compiling syn v1.0.82
Compiling quote v1.0.10
Compiling thiserror-impl v1.0.30
Compiling thiserror v1.0.30
Compiling test v0.1.0 (/home/hatta/work/repos/playground/test62)
WARN rustc_metadata::locator no metadata found: incompatible metadata version found: '/home/hatta/work/repos/playground/test62/target/debug/deps/libthiserror_impl-fb3604e0cefc2e39.so'
Finished dev [unoptimized + debuginfo] target(s) in 6.34s
Running `target/debug/test`
[src/main.rs:11] err = Error
The unexpected message "WARN rustc_metadata::locator no metadata found: incompatible metadata version found:" is shown.
Version it worked on
It most recently worked on: Rust 1.56
$ cargo clean && cargo +1.40.0 run && touch src/lib.rs && cargo +1.56.0 run
Compiling proc-macro2 v1.0.34
Compiling unicode-xid v0.2.2
Compiling syn v1.0.82
Compiling quote v1.0.10
Compiling thiserror-impl v1.0.30
Compiling thiserror v1.0.30
Compiling test v0.1.0 (/home/hatta/work/repos/playground/test62)
Finished dev [unoptimized + debuginfo] target(s) in 7.95s
Running `target/debug/test`
[src/main.rs:11] err = Error
14.01s user 2.04s system 201% cpu 7.979 total
Compiling proc-macro2 v1.0.34
Compiling unicode-xid v0.2.2
Compiling syn v1.0.82
Compiling quote v1.0.10
Compiling thiserror-impl v1.0.30
Compiling thiserror v1.0.30
Compiling test v0.1.0 (/home/hatta/work/repos/playground/test62)
Finished dev [unoptimized + debuginfo] target(s) in 6.81s
Running `target/debug/test`
[src/main.rs:11] err = Error
Version with regression
rustc --version --verbose
:
rustc 1.57.0 (f1edd0429 2021-11-29)
binary: rustc
commit-hash: f1edd0429582dd29cccacaf50fd134b05593bd9c
commit-date: 2021-11-29
host: x86_64-unknown-linux-gnu
release: 1.57.0
LLVM version: 13.0.0
Backtrace
Backtrace
<backtrace>