RPM build fix (reverted CI changes which will need to be un-reverted or made conditional) and vendor Rust dependencies to make builds much faster in any CI system.

This commit is contained in:
Adam Ierymenko
2022-06-08 07:32:16 -04:00
parent 373ca30269
commit d5ca4e5f52
12611 changed files with 2898014 additions and 284 deletions

View File

@@ -0,0 +1,7 @@
use thiserror::Error;
#[derive(Error, Debug)]
#[error(transparent)]
pub struct Error(#[error(transparent)] std::io::Error);
fn main() {}

View File

@@ -0,0 +1,5 @@
error: #[error(transparent)] needs to go outside the enum or struct, not on an individual field
--> tests/ui/bad-field-attr.rs:5:18
|
5 | pub struct Error(#[error(transparent)] std::io::Error);
| ^^^^^^^^^^^^^^^^^^^^^

View File

@@ -0,0 +1,15 @@
use thiserror::Error;
macro_rules! error_type {
($name:ident, $what:expr) => {
// Use #[error("invalid {}", $what)] instead.
#[derive(Error, Debug)]
#[error(concat!("invalid ", $what))]
pub struct $name;
};
}
error_type!(Error, "foo");
fn main() {}

View File

@@ -0,0 +1,10 @@
error: expected string literal
--> tests/ui/concat-display.rs:8:17
|
8 | #[error(concat!("invalid ", $what))]
| ^^^^^^
...
13 | error_type!(Error, "foo");
| ------------------------- in this macro invocation
|
= note: this error originates in the macro `error_type` (in Nightly builds, run with -Z macro-backtrace for more info)

View File

@@ -0,0 +1,13 @@
use thiserror::Error;
#[derive(Error, Debug)]
pub enum ErrorEnum {
Confusing {
#[source]
a: std::io::Error,
#[source]
b: anyhow::Error,
},
}
fn main() {}

View File

@@ -0,0 +1,5 @@
error: duplicate #[source] attribute
--> tests/ui/duplicate-enum-source.rs:8:9
|
8 | #[source]
| ^^^^^^^^^

View File

@@ -0,0 +1,8 @@
use thiserror::Error;
#[derive(Error, Debug)]
#[error("...")]
#[error("...")]
pub struct Error;
fn main() {}

View File

@@ -0,0 +1,5 @@
error: only one #[error(...)] attribute is allowed
--> tests/ui/duplicate-fmt.rs:5:1
|
5 | #[error("...")]
| ^^^^^^^^^^^^^^^

View File

@@ -0,0 +1,11 @@
use thiserror::Error;
#[derive(Error, Debug)]
pub struct ErrorStruct {
#[source]
a: std::io::Error,
#[source]
b: anyhow::Error,
}
fn main() {}

View File

@@ -0,0 +1,5 @@
error: duplicate #[source] attribute
--> tests/ui/duplicate-struct-source.rs:7:5
|
7 | #[source]
| ^^^^^^^^^

View File

@@ -0,0 +1,8 @@
use thiserror::Error;
#[derive(Error, Debug)]
#[error(transparent)]
#[error(transparent)]
pub struct Error(anyhow::Error);
fn main() {}

View File

@@ -0,0 +1,5 @@
error: duplicate #[error(transparent)] attribute
--> tests/ui/duplicate-transparent.rs:5:1
|
5 | #[error(transparent)]
| ^^^^^^^^^^^^^^^^^^^^^

View File

@@ -0,0 +1,12 @@
// https://github.com/dtolnay/thiserror/issues/163
#![feature(backtrace)]
use std::backtrace::Backtrace;
use thiserror::Error;
#[derive(Error, Debug)]
#[error("...")]
pub struct Error(#[from] #[backtrace] std::io::Error, Backtrace);
fn main() {}

View File

@@ -0,0 +1,5 @@
error: deriving From requires no fields other than source and backtrace
--> tests/ui/from-backtrace-backtrace.rs:10:18
|
10 | pub struct Error(#[from] #[backtrace] std::io::Error, Backtrace);
| ^^^^^^^

View File

@@ -0,0 +1,11 @@
use thiserror::Error;
#[derive(Debug, Error)]
pub struct Error {
#[source]
source: std::io::Error,
#[from]
other: anyhow::Error,
}
fn main() {}

View File

@@ -0,0 +1,5 @@
error: #[from] is only supported on the source field, not any other field
--> tests/ui/from-not-source.rs:7:5
|
7 | #[from]
| ^^^^^^^

View File

@@ -0,0 +1,24 @@
use std::fmt::Debug;
use thiserror::Error;
#[derive(Error, Debug)]
#[error("error")]
struct Error<'a>(#[from] Inner<'a>);
#[derive(Error, Debug)]
#[error("{0}")]
struct Inner<'a>(&'a str);
#[derive(Error, Debug)]
enum Enum<'a> {
#[error("error")]
Foo(#[from] Generic<&'a str>),
}
#[derive(Error, Debug)]
#[error("{0:?}")]
struct Generic<T: Debug>(T);
fn main() -> Result<(), Error<'static>> {
Err(Error(Inner("some text")))
}

View File

@@ -0,0 +1,11 @@
error: non-static lifetimes are not allowed in the source of an error, because std::error::Error requires the source is dyn Error + 'static
--> tests/ui/lifetime.rs:6:26
|
6 | struct Error<'a>(#[from] Inner<'a>);
| ^^^^^^^^^
error: non-static lifetimes are not allowed in the source of an error, because std::error::Error requires the source is dyn Error + 'static
--> tests/ui/lifetime.rs:15:17
|
15 | Foo(#[from] Generic<&'a str>),
| ^^^^^^^^^^^^^^^^

View File

@@ -0,0 +1,10 @@
use thiserror::Error;
#[derive(Error, Debug)]
pub enum Error {
#[error("...")]
A(usize),
B(usize),
}
fn main() {}

View File

@@ -0,0 +1,5 @@
error: missing #[error("...")] display attribute
--> tests/ui/missing-fmt.rs:7:5
|
7 | B(usize),
| ^^^^^^^^

View File

@@ -0,0 +1,12 @@
use thiserror::Error;
#[derive(Debug)]
struct NoDisplay;
#[derive(Error, Debug)]
#[error("thread: {thread}")]
pub struct Error {
thread: NoDisplay,
}
fn main() {}

View File

@@ -0,0 +1,23 @@
error[E0599]: the method `as_display` exists for reference `&NoDisplay`, but its trait bounds were not satisfied
--> tests/ui/no-display.rs:7:9
|
4 | struct NoDisplay;
| ----------------- doesn't satisfy `NoDisplay: std::fmt::Display`
...
7 | #[error("thread: {thread}")]
| ^^^^^^^^^^^^^^^^^^ method cannot be called on `&NoDisplay` due to unsatisfied trait bounds
|
= note: the following trait bounds were not satisfied:
`NoDisplay: std::fmt::Display`
which is required by `&NoDisplay: DisplayAsDisplay`
note: the following trait must be implemented
--> $RUST/core/src/fmt/mod.rs
|
| / pub trait Display {
| | /// Formats the value using the given formatter.
| | ///
| | /// # Examples
... |
| | fn fmt(&self, f: &mut Formatter<'_>) -> Result;
| | }
| |_^

View File

@@ -0,0 +1,14 @@
use thiserror::Error;
#[derive(Debug)]
pub struct NotError;
#[derive(Error, Debug)]
#[error("...")]
pub enum ErrorEnum {
Broken {
source: NotError,
},
}
fn main() {}

View File

@@ -0,0 +1,28 @@
error[E0599]: the method `as_dyn_error` exists for reference `&NotError`, but its trait bounds were not satisfied
--> tests/ui/source-enum-not-error.rs:10:9
|
4 | pub struct NotError;
| --------------------
| |
| doesn't satisfy `NotError: AsDynError`
| doesn't satisfy `NotError: std::error::Error`
...
10 | source: NotError,
| ^^^^^^ method cannot be called on `&NotError` due to unsatisfied trait bounds
|
= note: the following trait bounds were not satisfied:
`NotError: std::error::Error`
which is required by `NotError: AsDynError`
`&NotError: std::error::Error`
which is required by `&NotError: AsDynError`
note: the following trait must be implemented
--> $RUST/std/src/error.rs
|
| / pub trait Error: Debug + Display {
| | /// The lower-level source of this error, if any.
| | ///
| | /// # Examples
... |
| | }
| | }
| |_^

View File

@@ -0,0 +1,12 @@
use thiserror::Error;
#[derive(Debug)]
struct NotError;
#[derive(Error, Debug)]
#[error("...")]
pub struct ErrorStruct {
source: NotError,
}
fn main() {}

View File

@@ -0,0 +1,27 @@
error[E0599]: the method `as_dyn_error` exists for struct `NotError`, but its trait bounds were not satisfied
--> tests/ui/source-struct-not-error.rs:9:5
|
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 cannot be called on `NotError` due to unsatisfied trait bounds
|
= note: the following trait bounds were not satisfied:
`NotError: std::error::Error`
which is required by `NotError: AsDynError`
note: the following trait must be implemented
--> $RUST/std/src/error.rs
|
| / pub trait Error: Debug + Display {
| | /// The lower-level source of this error, if any.
| | ///
| | /// # Examples
... |
| | }
| | }
| |_^

View File

@@ -0,0 +1,8 @@
use thiserror::Error;
#[derive(Error, Debug)]
#[error(transparent)]
#[error("...")]
pub struct Error(anyhow::Error);
fn main() {}

View File

@@ -0,0 +1,5 @@
error: cannot have both #[error(transparent)] and a display attribute
--> tests/ui/transparent-display.rs:5:1
|
5 | #[error("...")]
| ^^^^^^^^^^^^^^^

View File

@@ -0,0 +1,9 @@
use thiserror::Error;
#[derive(Error, Debug)]
pub enum Error {
#[error(transparent)]
Other(anyhow::Error, String),
}
fn main() {}

View File

@@ -0,0 +1,6 @@
error: #[error(transparent)] requires exactly one field
--> tests/ui/transparent-enum-many.rs:5:5
|
5 | / #[error(transparent)]
6 | | Other(anyhow::Error, String),
| |________________________________^

View File

@@ -0,0 +1,9 @@
use thiserror::Error;
#[derive(Error, Debug)]
pub enum Error {
#[error(transparent)]
Other(#[source] anyhow::Error),
}
fn main() {}

View File

@@ -0,0 +1,5 @@
error: transparent variant can't contain #[source]
--> tests/ui/transparent-enum-source.rs:6:11
|
6 | Other(#[source] anyhow::Error),
| ^^^^^^^^^

View File

@@ -0,0 +1,10 @@
use thiserror::Error;
#[derive(Error, Debug)]
#[error(transparent)]
pub struct Error {
inner: anyhow::Error,
what: String,
}
fn main() {}

View File

@@ -0,0 +1,5 @@
error: #[error(transparent)] requires exactly one field
--> tests/ui/transparent-struct-many.rs:4:1
|
4 | #[error(transparent)]
| ^^^^^^^^^^^^^^^^^^^^^

View File

@@ -0,0 +1,7 @@
use thiserror::Error;
#[derive(Error, Debug)]
#[error(transparent)]
pub struct Error(#[source] anyhow::Error);
fn main() {}

View File

@@ -0,0 +1,5 @@
error: transparent error struct can't contain #[source]
--> tests/ui/transparent-struct-source.rs:5:18
|
5 | pub struct Error(#[source] anyhow::Error);
| ^^^^^^^^^

View File

@@ -0,0 +1,11 @@
use thiserror::Error;
#[derive(Error, Debug)]
pub enum Error {
What {
#[error("...")]
io: std::io::Error,
},
}
fn main() {}

View File

@@ -0,0 +1,5 @@
error: not expected here; the #[error(...)] attribute belongs on top of a struct or an enum variant
--> tests/ui/unexpected-field-fmt.rs:6:9
|
6 | #[error("...")]
| ^^^^^^^^^^^^^^^

View File

@@ -0,0 +1,7 @@
use thiserror::Error;
#[derive(Error, Debug)]
#[source]
pub struct Error;
fn main() {}

View File

@@ -0,0 +1,5 @@
error: not expected here; the #[source] attribute belongs on a specific field
--> tests/ui/unexpected-struct-source.rs:4:1
|
4 | #[source]
| ^^^^^^^^^

View File

@@ -0,0 +1,9 @@
use thiserror::Error;
#[derive(Error)]
pub union U {
msg: &'static str,
num: usize,
}
fn main() {}

View File

@@ -0,0 +1,8 @@
error: union as errors are not supported
--> tests/ui/union.rs:4:1
|
4 | / pub union U {
5 | | msg: &'static str,
6 | | num: usize,
7 | | }
| |_^