Add temporary ui test of 'multiple applicable items' error

This commit is contained in:
David Tolnay 2022-09-05 18:32:14 -07:00
parent 48f697af3d
commit 9e9afbff24
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
2 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,19 @@
#![feature(error_generic_member_access, provide_any)]
use thiserror::Error;
use std::any::Provider;
use std::error::Error;
// FIXME: this should work. https://github.com/dtolnay/thiserror/issues/185
#[derive(Error, Debug)]
#[error("...")]
struct MyError {
#[source]
#[backtrace]
x: std::io::Error,
}
fn main() {
let _: dyn Error;
let _: dyn Provider;
}

View File

@ -0,0 +1,16 @@
error[E0034]: multiple applicable items in scope
--> tests/ui/multiple-provide.rs:13:5
|
13 | x: std::io::Error,
| ^ multiple `provide` found
|
= note: candidate #1 is defined in an impl of the trait `Provider` for the type `E`
= note: candidate #2 is defined in an impl of the trait `std::error::Error` for the type `std::io::Error`
help: disambiguate the associated function for candidate #1
|
13 | Provider::provide(&x, Error): std::io::Error,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: disambiguate the associated function for candidate #2
|
13 | std::error::Error::provide(&x, Error): std::io::Error,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~