create a new project with the following Cargo.toml:
[package]
name = "tmp"
version = "0.1.0"
edition = "2024"
[dependencies]
eyre = "=0.6.12"
and the following src/main.rs:
use eyre::Context;
fn main() -> eyre::Result<()> {
let _ = std::fs::read_to_string("test.txt").context("context")?;
Ok(())
}
and then use cargo check:
$ cargo check
Checking tmp v0.1.0 (/tmp/tmp.hCK2EzDUeP)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.10s
and then change the Cargo.toml to the following (updating the eyre version):
[package]
name = "tmp"
version = "0.1.0"
edition = "2024"
[dependencies]
eyre = "=0.6.13"
and then use cargo check again:
$ cargo check
Updating crates.io index
Locking 2 packages to latest Rust 1.98.0-beta.5 compatible versions
Adding autocfg v1.5.1
Updating eyre v0.6.12 -> v0.6.13
Checking tmp v0.1.0 (/tmp/tmp.hCK2EzDUeP)
warning: unused import: `eyre::Context`
--> src/main.rs:1:5
|
1 | use eyre::Context;
| ^^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default
error[E0599]: no method named `context` found for enum `Result<T, E>` in the current scope
--> src/main.rs:4:49
|
4 | let _ = std::fs::read_to_string("test.txt").context("context")?;
| ^^^^^^^
|
::: /home/may/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/eyre-0.6.13/src/lib.rs:1238:8
|
1238 | fn context<D>(self, msg: D) -> Result<T, Report>
| ------- the method is available for `Result<String, std::io::Error>` here
|
= help: items from traits can only be used if the trait is in scope
help: trait `ContextCompat` which provides `context` is implemented but not in scope; perhaps you want to import it
|
1 + use eyre::ContextCompat;
|
help: there is a method `with_context` with a similar name
|
4 | let _ = std::fs::read_to_string("test.txt").with_context("context")?;
| +++++
For more information about this error, try `rustc --explain E0599`.
warning: `tmp` (bin "tmp") generated 1 warning
error: could not compile `tmp` (bin "tmp") due to 1 previous error; 1 warning emitted
this should still compile, as only a patch version was released.
create a new project with the following
Cargo.toml:and the following
src/main.rs:and then use
cargo check:$ cargo check Checking tmp v0.1.0 (/tmp/tmp.hCK2EzDUeP) Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.10sand then change the
Cargo.tomlto the following (updating the eyre version):and then use
cargo checkagain:$ cargo check Updating crates.io index Locking 2 packages to latest Rust 1.98.0-beta.5 compatible versions Adding autocfg v1.5.1 Updating eyre v0.6.12 -> v0.6.13 Checking tmp v0.1.0 (/tmp/tmp.hCK2EzDUeP) warning: unused import: `eyre::Context` --> src/main.rs:1:5 | 1 | use eyre::Context; | ^^^^^^^^^^^^^ | = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default error[E0599]: no method named `context` found for enum `Result<T, E>` in the current scope --> src/main.rs:4:49 | 4 | let _ = std::fs::read_to_string("test.txt").context("context")?; | ^^^^^^^ | ::: /home/may/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/eyre-0.6.13/src/lib.rs:1238:8 | 1238 | fn context<D>(self, msg: D) -> Result<T, Report> | ------- the method is available for `Result<String, std::io::Error>` here | = help: items from traits can only be used if the trait is in scope help: trait `ContextCompat` which provides `context` is implemented but not in scope; perhaps you want to import it | 1 + use eyre::ContextCompat; | help: there is a method `with_context` with a similar name | 4 | let _ = std::fs::read_to_string("test.txt").with_context("context")?; | +++++ For more information about this error, try `rustc --explain E0599`. warning: `tmp` (bin "tmp") generated 1 warning error: could not compile `tmp` (bin "tmp") due to 1 previous error; 1 warning emittedthis should still compile, as only a patch version was released.