Skip to content

Conversation

@dtolnay
Copy link
Owner

@dtolnay dtolnay commented Dec 25, 2023

Equivalent of dtolnay/thiserror#269.

Example failure mode without this PR:

pub fn repro(e: &anyhow::Error) -> &std::backtrace::Backtrace {
    e.backtrace()
}
$ cargo +stable check  #(expected failure)
   Compiling anyhow v1.0.76
    Checking repro v0.0.0
error[E0599]: no method named `backtrace` found for reference `&anyhow::Error` in the current scope
 --> src/lib.rs:2:7
  |
2 |     e.backtrace()
  |       ^^^^^^^^^ method not found in `&Error`

For more information about this error, try `rustc --explain E0599`.
error: could not compile `repro` due to previous error
$ RUSTC_BOOTSTRAP=1 cargo +stable check  #(should work, but doesn't)
    Checking repro v0.0.0
error[E0599]: no method named `backtrace` found for reference `&anyhow::Error` in the current scope
 --> src/lib.rs:2:7
  |
2 |     e.backtrace()
  |       ^^^^^^^^^ method not found in `&Error`

For more information about this error, try `rustc --explain E0599`.
error: could not compile `repro` due to previous error
$ cargo +stable clean
     Removed 30 files, 9.9MiB total
$ RUSTC_BOOTSTRAP=1 cargo +stable check
   Compiling anyhow v1.0.76
    Checking repro v0.0.0
    Finished dev [unoptimized + debuginfo] target(s) in 0.59s

After this PR: RUSTC_BOOTSTRAP=1 cargo +stable check works the first time.

@dtolnay dtolnay merged commit 5121cd2 into master Dec 25, 2023
@dtolnay dtolnay deleted the bootstrap branch December 25, 2023 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants