Skip to content
Myr

Add basic trybuild test for error missing Display impl

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Tolnay · committed by David Tolnay · parent d9957be · Browse files · 4 files+31 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

4 files+31 added−0 removed

  • tests:+30 added−0 removed
  • other:+1 added−0 removed

4 files+31 added−0 removed

added:tests/ui/no-impl.rs+8 added
1use anyhow::anyhow;23#[derive(Debug)]4struct Error;56fn main() {7 let _ = anyhow!(Error);8}
added:tests/ui/no-impl.stderr+16 added
1error[E0599]: no method named `anyhow_kind` found for type `&Error` in the current scope2 --> $DIR/no-impl.rs:7:133 |47 | let _ = anyhow!(Error);5 | ^^^^^^^^^^^^^^ method not found in `&Error`6 |7 = note: the method `anyhow_kind` exists but the following trait bounds were not satisfied:8 `&Error : anyhow::kind::AdhocKind`9 `&Error : anyhow::kind::TraitKind`10 `Error : anyhow::kind::TraitKind`11 = help: items from traits can only be used if the trait is implemented and in scope12 = note: the following traits define an item `anyhow_kind`, perhaps you need to implement one of them:13 candidate #1: `anyhow::kind::AdhocKind`14 candidate #2: `anyhow::kind::TraitKind`15 candidate #3: `anyhow::kind::BoxedKind`16 = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
added:tests/compiletest.rs+6 added
1#[rustversion::attr(not(nightly), ignore)]2#[test]3fn ui() {4 let t = trybuild::TestCases::new();5 t.compile_fail("tests/ui/*.rs");6}
modified:Cargo.toml+1 added