http-rs / http-rs/http-types

backtrace problem on nightly

Open
#511 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
209
Forks
91
PR merge metrics
No merged PRs in 30d

Description

In a strange constellation I'm running into the following error:

```plain
error[E0308]: mismatched types
--> /Users/I563162/.cargo/registry/src/github.com-1ecc6299db9ec823/http-types-2.12.0/src/error.rs:114:18
|
114 | Some(backtrace)
| ---- ^^^^^^^^^ expected `&Backtrace`, found enum `std::option::Option`
| |
| arguments to this enum variant are incorrect
|
= note: expected reference `&Backtrace`
found enum `std::option::Option<&Backtrace>`
```

looking at the code:

https://github.com/http-rs/http-types/blob/6f38b3ea86602a8fa907c135373ff94400e11cd4/src/error.rs#L111-L118

I see no change in over 2 years. Also on the `anyhow` crate (`self.error` is of type `anyhow::Error`) I cannot see any change on the `backtrace()` method.

However a fix like this would solve the problem:

```patch
- let backtrace = self.error.backtrace();
+ let backtrace = self.error.backtrace()?;
```

## Things I've used:
- depdency tree to `http-types`:
```
http-types v2.12.0
├── async-h1 v2.3.3
│ └── tide v0.16.0
```
- `http-types` version `2.12.0`
- `anyhow` version `1.0.65`
- rust version
```sh
cargo --version && rustc --version
cargo 1.63.0-nightly (38472bc19 2022-05-31)
rustc 1.63.0-nightly (5435ed691 2022-06-07)
```

Contributor guide

Open the contributing guide

Research direction

Start with src/error.rs lines 111-118, linked in the issue, and compare the backtrace type returned by anyhow 1.0.65 with the Rust nightly compiler behavior. Reproduce the error using the reported http-types 2.12.0 dependency setup and verify that the project compiles successfully with the corrected backtrace handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.