Skip to content

spurious coherence error using error-chain with nonexistent type #43400

Closed
@durka

Description

@durka
```rust
error_chain! {
    foreign_links {
        Bad(nope::Thing); // nonexistent type
    }
}
```

The first error is sensical:

```
error[E0433]: failed to resolve. Use of undeclared type or module `nope`
  --> /Users/alex/.cargo/.cargo/script-cache/expr-698cc781c70734ef/expr.rs:11:47
   |
11 |     match {error_chain! { foreign_links { Bad(nope::Thing); } }} {
   |                                               ^^^^^^^^^^^ Use of undeclared type or module `nope`
```

But the knock-on errors are not:

```
error[E0119]: conflicting implementations of trait `std::convert::From<[type error]>` for type `try_main::Error`:
  --> /Users/alex/.cargo/.cargo/script-cache/expr-698cc781c70734ef/expr.rs:11:12
   |
11 |     match {error_chain! { foreign_links { Bad(nope::Thing); } }} {
   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |            |
   |            first implementation here
   |            conflicting implementation for `try_main::Error`
   |
   = note: this error originates in a macro outside of the current crate
```

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions