mirror of
https://github.com/dtolnay/thiserror.git
synced 2025-04-06 22:37:38 +03:00
Change ui tests to work whether or not rust-src is installed
This commit is contained in:
parent
663d835689
commit
04b91d7646
8 changed files with 57 additions and 58 deletions
|
@ -1,9 +0,0 @@
|
|||
use thiserror::Error;
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
pub enum MyError {
|
||||
First,
|
||||
Second,
|
||||
}
|
||||
|
||||
fn main() {}
|
|
@ -1,8 +0,0 @@
|
|||
error[E0277]: `MyError` doesn't implement `std::fmt::Display`
|
||||
--> $DIR/missing-display.rs:4:1
|
||||
|
|
||||
4 | pub enum MyError {
|
||||
| ^^^^^^^^^^^^^^^^ `MyError` cannot be formatted with the default formatter
|
||||
|
|
||||
= help: the trait `std::fmt::Display` is not implemented for `MyError`
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
|
@ -1,10 +1,12 @@
|
|||
use std::thread::Thread;
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug)]
|
||||
struct NoDisplay;
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
#[error("thread: {thread}")]
|
||||
pub struct Error {
|
||||
thread: Thread,
|
||||
thread: NoDisplay,
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
error[E0599]: no method named `as_display` found for reference `&Thread` in the current scope
|
||||
--> $DIR/no-display.rs:5:9
|
||||
error[E0599]: no method named `as_display` found for reference `&NoDisplay` in the current scope
|
||||
--> $DIR/no-display.rs:7:9
|
||||
|
|
||||
5 | #[error("thread: {thread}")]
|
||||
| ^^^^^^^^^^^^^^^^^^ method not found in `&Thread`
|
||||
4 | struct NoDisplay;
|
||||
| ----------------- doesn't satisfy `NoDisplay: std::fmt::Display`
|
||||
...
|
||||
7 | #[error("thread: {thread}")]
|
||||
| ^^^^^^^^^^^^^^^^^^ method not found in `&NoDisplay`
|
||||
|
|
||||
= note: the method `as_display` exists but the following trait bounds were not satisfied:
|
||||
`Thread: std::fmt::Display`
|
||||
which is required by `&Thread: DisplayAsDisplay`
|
||||
`NoDisplay: std::fmt::Display`
|
||||
which is required by `&NoDisplay: DisplayAsDisplay`
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct NotError;
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
#[error("...")]
|
||||
pub enum ErrorEnum {
|
||||
Broken {
|
||||
source: String,
|
||||
source: NotError,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
error[E0599]: no method named `as_dyn_error` found for reference `&String` in the current scope
|
||||
--> $DIR/source-enum-not-error.rs:7:9
|
||||
error[E0599]: no method named `as_dyn_error` found for reference `&NotError` in the current scope
|
||||
--> $DIR/source-enum-not-error.rs:10:9
|
||||
|
|
||||
7 | source: String,
|
||||
| ^^^^^^ method not found in `&String`
|
||||
4 | pub struct NotError;
|
||||
| --------------------
|
||||
| |
|
||||
| doesn't satisfy `NotError: AsDynError`
|
||||
| doesn't satisfy `NotError: std::error::Error`
|
||||
...
|
||||
10 | source: NotError,
|
||||
| ^^^^^^ method not found in `&NotError`
|
||||
|
|
||||
= note: the method `as_dyn_error` exists but the following trait bounds were not satisfied:
|
||||
`String: std::error::Error`
|
||||
which is required by `String: AsDynError`
|
||||
`&String: std::error::Error`
|
||||
which is required by `&String: AsDynError`
|
||||
`str: Sized`
|
||||
which is required by `str: AsDynError`
|
||||
`str: std::error::Error`
|
||||
which is required by `str: AsDynError`
|
||||
`NotError: std::error::Error`
|
||||
which is required by `NotError: AsDynError`
|
||||
`&NotError: std::error::Error`
|
||||
which is required by `&NotError: AsDynError`
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug)]
|
||||
struct NotError;
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
#[error("...")]
|
||||
pub struct ErrorStruct {
|
||||
source: String,
|
||||
source: NotError,
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
@ -1,13 +1,16 @@
|
|||
error[E0599]: no method named `as_dyn_error` found for struct `String` in the current scope
|
||||
--> $DIR/source-struct-not-error.rs:6:5
|
||||
error[E0599]: no method named `as_dyn_error` found for struct `NotError` in the current scope
|
||||
--> $DIR/source-struct-not-error.rs:9:5
|
||||
|
|
||||
6 | source: String,
|
||||
| ^^^^^^ method not found in `String`
|
||||
4 | struct NotError;
|
||||
| ----------------
|
||||
| |
|
||||
| method `as_dyn_error` not found for this
|
||||
| doesn't satisfy `NotError: AsDynError`
|
||||
| doesn't satisfy `NotError: std::error::Error`
|
||||
...
|
||||
9 | source: NotError,
|
||||
| ^^^^^^ method not found in `NotError`
|
||||
|
|
||||
= note: the method `as_dyn_error` exists but the following trait bounds were not satisfied:
|
||||
`String: std::error::Error`
|
||||
which is required by `String: AsDynError`
|
||||
`str: Sized`
|
||||
which is required by `str: AsDynError`
|
||||
`str: std::error::Error`
|
||||
which is required by `str: AsDynError`
|
||||
`NotError: std::error::Error`
|
||||
which is required by `NotError: AsDynError`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue