зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1716518 - Upgrade thiserror and thiserror-impl to v1.0.25.
Differential Revision: https://phabricator.services.mozilla.com/D117866
This commit is contained in:
Родитель
dbc951959f
Коммит
44c26254b5
|
@ -5070,18 +5070,18 @@ checksum = "3a33c69726da418b3ee54fedf0adf26ae4bf2174539025b1df0819420b5a8417"
|
|||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.21"
|
||||
version = "1.0.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "318234ffa22e0920fe9a40d7b8369b5f649d490980cf7aadcf1eb91594869b42"
|
||||
checksum = "fa6f76457f59514c7eeb4e59d891395fab0b2fd1d40723ae737d64153392e9c6"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.21"
|
||||
version = "1.0.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cae2447b6282786c3493999f40a9be2a6ad20cb8bd268b0a0dbf5a065535c0ab"
|
||||
checksum = "8a36768c0fbf1bb15eca10defa29526bda730a2376c2ab4393ccfa16fb1a318d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"files":{"Cargo.toml":"54394734b2da4db7bcb101443b4d5c539389b1edd377eef92cbba6c7fb10e448","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","src/ast.rs":"26e24eddfcaf6c430f6893b22fc2d1288b7c024b5ec956bd139e2c25f647b7a5","src/attr.rs":"9a270a64939274fe4b091e2e56fe375d3b6dc77cbd3c8a33d161dc4426b804b1","src/expand.rs":"d247d94836f55fde56d477a4ff135f64801c63aed9ea3a2a326882791a47e552","src/fmt.rs":"cf4c7f1257c8d7e8686ef20abd1ef07f308ee446196f0daa8679c61f784b82ea","src/lib.rs":"b42560cf713287c2059b7cd9c42e371967811da200b63f896a080dfd4367a053","src/prop.rs":"00e2d0711f8c82befedd7a970a127c929adcef5e7abbd0dee9c0163cd567a6ad","src/valid.rs":"b594f0a3b8e67f94365b17f6a3f74cfbfe0edd1281f98cdd16e132570d66899d"},"package":"cae2447b6282786c3493999f40a9be2a6ad20cb8bd268b0a0dbf5a065535c0ab"}
|
||||
{"files":{"Cargo.toml":"93945a1b18a8f84b3cba8d294d91d309acc520cf6520d59e6466e67ef77601bd","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","src/ast.rs":"26e24eddfcaf6c430f6893b22fc2d1288b7c024b5ec956bd139e2c25f647b7a5","src/attr.rs":"9a270a64939274fe4b091e2e56fe375d3b6dc77cbd3c8a33d161dc4426b804b1","src/expand.rs":"e696e6d8f89331035783814c3a3ecf62dfe6df231d185baab29a06bfd6661d78","src/fmt.rs":"eea3b4f917a2d1c72a6dadcefc0b171f3316f8008ac26f51d58d3414307f4a2d","src/lib.rs":"a39b07f7bb959a3a4959adcc5a44cfb7896ce752789a3e0740d16f3230e011cf","src/prop.rs":"00e2d0711f8c82befedd7a970a127c929adcef5e7abbd0dee9c0163cd567a6ad","src/valid.rs":"ef0be5ad1bf72277c8dc7a4c1d4efd6726b90c9e36a14bb63e95bcd0d7dc04cb"},"package":"8a36768c0fbf1bb15eca10defa29526bda730a2376c2ab4393ccfa16fb1a318d"}
|
|
@ -13,7 +13,7 @@
|
|||
[package]
|
||||
edition = "2018"
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.21"
|
||||
version = "1.0.25"
|
||||
authors = ["David Tolnay <dtolnay@gmail.com>"]
|
||||
description = "Implementation detail of the `thiserror` crate"
|
||||
license = "MIT OR Apache-2.0"
|
||||
|
@ -30,4 +30,4 @@ version = "1.0"
|
|||
version = "1.0"
|
||||
|
||||
[dependencies.syn]
|
||||
version = "1.0.11"
|
||||
version = "1.0.45"
|
||||
|
|
|
@ -171,9 +171,10 @@ fn impl_enum(input: Enum) -> TokenStream {
|
|||
} else {
|
||||
None
|
||||
};
|
||||
let dyn_error = quote_spanned!(source.span()=> source #asref.as_dyn_error());
|
||||
let varsource = quote!(source);
|
||||
let dyn_error = quote_spanned!(source.span()=> #varsource #asref.as_dyn_error());
|
||||
quote! {
|
||||
#ty::#ident {#source: source, ..} => std::option::Option::Some(#dyn_error),
|
||||
#ty::#ident {#source: #varsource, ..} => std::option::Option::Some(#dyn_error),
|
||||
}
|
||||
} else {
|
||||
quote! {
|
||||
|
@ -203,13 +204,14 @@ fn impl_enum(input: Enum) -> TokenStream {
|
|||
{
|
||||
let backtrace = &backtrace_field.member;
|
||||
let source = &source_field.member;
|
||||
let varsource = quote!(source);
|
||||
let source_backtrace = if type_is_option(source_field.ty) {
|
||||
quote_spanned! {source.span()=>
|
||||
source.as_ref().and_then(|source| source.as_dyn_error().backtrace())
|
||||
#varsource.as_ref().and_then(|source| source.as_dyn_error().backtrace())
|
||||
}
|
||||
} else {
|
||||
quote_spanned! {source.span()=>
|
||||
source.as_dyn_error().backtrace()
|
||||
#varsource.as_dyn_error().backtrace()
|
||||
}
|
||||
};
|
||||
let combinator = if type_is_option(backtrace_field.ty) {
|
||||
|
@ -224,7 +226,7 @@ fn impl_enum(input: Enum) -> TokenStream {
|
|||
quote! {
|
||||
#ty::#ident {
|
||||
#backtrace: backtrace,
|
||||
#source: source,
|
||||
#source: #varsource,
|
||||
..
|
||||
} => {
|
||||
use thiserror::private::AsDynError;
|
||||
|
|
|
@ -54,8 +54,9 @@ impl Display<'_> {
|
|||
member
|
||||
}
|
||||
'a'..='z' | 'A'..='Z' | '_' => {
|
||||
let ident = take_ident(&mut read);
|
||||
Member::Named(Ident::new(&ident, span))
|
||||
let mut ident = take_ident(&mut read);
|
||||
ident.set_span(span);
|
||||
Member::Named(ident)
|
||||
}
|
||||
_ => continue,
|
||||
};
|
||||
|
@ -64,6 +65,9 @@ impl Display<'_> {
|
|||
Member::Named(ident) => ident.clone(),
|
||||
};
|
||||
let mut formatvar = local.clone();
|
||||
if formatvar.to_string().starts_with("r#") {
|
||||
formatvar = format_ident!("r_{}", formatvar);
|
||||
}
|
||||
if formatvar.to_string().starts_with('_') {
|
||||
// Work around leading underscore being rejected by 1.40 and
|
||||
// older compilers. https://github.com/rust-lang/rust/pull/66847
|
||||
|
@ -98,7 +102,7 @@ fn explicit_named_args(input: ParseStream) -> Result<Set<Ident>> {
|
|||
while !input.is_empty() {
|
||||
if input.peek(Token![,]) && input.peek2(Ident::peek_any) && input.peek3(Token![=]) {
|
||||
input.parse::<Token![,]>()?;
|
||||
let ident: Ident = input.parse()?;
|
||||
let ident = input.call(Ident::parse_any)?;
|
||||
input.parse::<Token![=]>()?;
|
||||
named_args.insert(ident);
|
||||
} else {
|
||||
|
@ -123,8 +127,13 @@ fn take_int(read: &mut &str) -> String {
|
|||
int
|
||||
}
|
||||
|
||||
fn take_ident(read: &mut &str) -> String {
|
||||
fn take_ident(read: &mut &str) -> Ident {
|
||||
let mut ident = String::new();
|
||||
let raw = read.starts_with("r#");
|
||||
if raw {
|
||||
ident.push_str("r#");
|
||||
*read = &read[2..];
|
||||
}
|
||||
for (i, ch) in read.char_indices() {
|
||||
match ch {
|
||||
'a'..='z' | 'A'..='Z' | '0'..='9' | '_' => ident.push(ch),
|
||||
|
@ -134,5 +143,5 @@ fn take_ident(read: &mut &str) -> String {
|
|||
}
|
||||
}
|
||||
}
|
||||
ident
|
||||
Ident::parse_any.parse_str(&ident).unwrap()
|
||||
}
|
||||
|
|
|
@ -1,4 +1,14 @@
|
|||
#![allow(clippy::blocks_in_if_conditions, clippy::range_plus_one)]
|
||||
#![allow(
|
||||
clippy::blocks_in_if_conditions,
|
||||
clippy::cast_possible_truncation,
|
||||
clippy::manual_map,
|
||||
clippy::map_unwrap_or,
|
||||
clippy::needless_pass_by_value,
|
||||
clippy::option_if_let_else,
|
||||
clippy::range_plus_one,
|
||||
clippy::single_match_else,
|
||||
clippy::too_many_lines
|
||||
)]
|
||||
|
||||
extern crate proc_macro;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ impl Struct<'_> {
|
|||
"#[error(transparent)] requires exactly one field",
|
||||
));
|
||||
}
|
||||
if let Some(source) = self.fields.iter().filter_map(|f| f.attrs.source).next() {
|
||||
if let Some(source) = self.fields.iter().find_map(|f| f.attrs.source) {
|
||||
return Err(Error::new_spanned(
|
||||
source,
|
||||
"transparent error struct can't contain #[source]",
|
||||
|
@ -78,7 +78,7 @@ impl Variant<'_> {
|
|||
"#[error(transparent)] requires exactly one field",
|
||||
));
|
||||
}
|
||||
if let Some(source) = self.fields.iter().filter_map(|f| f.attrs.source).next() {
|
||||
if let Some(source) = self.fields.iter().find_map(|f| f.attrs.source) {
|
||||
return Err(Error::new_spanned(
|
||||
source,
|
||||
"transparent variant can't contain #[source]",
|
||||
|
@ -188,10 +188,10 @@ fn check_field_attrs(fields: &[Field]) -> Result<()> {
|
|||
}
|
||||
}
|
||||
if let Some(source_field) = source_field.or(from_field) {
|
||||
if contains_non_static_lifetime(source_field) {
|
||||
if contains_non_static_lifetime(&source_field.ty) {
|
||||
return Err(Error::new_spanned(
|
||||
source_field.original,
|
||||
"non-static lifetimes are not allowed in the source of an error",
|
||||
&source_field.original.ty,
|
||||
"non-static lifetimes are not allowed in the source of an error, because std::error::Error requires the source is dyn Error + 'static",
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@ -206,21 +206,28 @@ fn same_member(one: &Field, two: &Field) -> bool {
|
|||
}
|
||||
}
|
||||
|
||||
fn contains_non_static_lifetime(field: &Field) -> bool {
|
||||
let ty = match field.ty {
|
||||
Type::Path(ty) => ty,
|
||||
_ => return false, // maybe implement later if there are common other cases
|
||||
};
|
||||
let bracketed = match &ty.path.segments.last().unwrap().arguments {
|
||||
PathArguments::AngleBracketed(bracketed) => bracketed,
|
||||
_ => return false,
|
||||
};
|
||||
for arg in &bracketed.args {
|
||||
if let GenericArgument::Lifetime(lifetime) = arg {
|
||||
if lifetime.ident != "static" {
|
||||
return true;
|
||||
fn contains_non_static_lifetime(ty: &Type) -> bool {
|
||||
match ty {
|
||||
Type::Path(ty) => {
|
||||
let bracketed = match &ty.path.segments.last().unwrap().arguments {
|
||||
PathArguments::AngleBracketed(bracketed) => bracketed,
|
||||
_ => return false,
|
||||
};
|
||||
for arg in &bracketed.args {
|
||||
match arg {
|
||||
GenericArgument::Type(ty) if contains_non_static_lifetime(ty) => return true,
|
||||
GenericArgument::Lifetime(lifetime) if lifetime.ident != "static" => {
|
||||
return true
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
false
|
||||
}
|
||||
Type::Reference(ty) => ty
|
||||
.lifetime
|
||||
.as_ref()
|
||||
.map_or(false, |lifetime| lifetime.ident != "static"),
|
||||
_ => false, // maybe implement later if there are common other cases
|
||||
}
|
||||
false
|
||||
}
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -13,7 +13,7 @@
|
|||
[package]
|
||||
edition = "2018"
|
||||
name = "thiserror"
|
||||
version = "1.0.21"
|
||||
version = "1.0.25"
|
||||
authors = ["David Tolnay <dtolnay@gmail.com>"]
|
||||
description = "derive(Error)"
|
||||
documentation = "https://docs.rs/thiserror"
|
||||
|
@ -24,7 +24,7 @@ repository = "https://github.com/dtolnay/thiserror"
|
|||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
[dependencies.thiserror-impl]
|
||||
version = "=1.0.21"
|
||||
version = "=1.0.25"
|
||||
[dev-dependencies.anyhow]
|
||||
version = "1.0"
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ pub enum DataStoreError {
|
|||
```rust
|
||||
#[derive(Error, Debug)]
|
||||
pub enum Error {
|
||||
#[error("invalid rdo_lookahead_frames {0} (expected < {})", i32::max_value())]
|
||||
#[error("invalid rdo_lookahead_frames {0} (expected < {})", i32::MAX)]
|
||||
InvalidLookahead(u32),
|
||||
}
|
||||
```
|
||||
|
|
|
@ -1,33 +1,33 @@
|
|||
use std::error::Error;
|
||||
|
||||
pub trait AsDynError {
|
||||
fn as_dyn_error(&self) -> &(dyn Error + 'static);
|
||||
pub trait AsDynError<'a> {
|
||||
fn as_dyn_error(&self) -> &(dyn Error + 'a);
|
||||
}
|
||||
|
||||
impl<T: Error + 'static> AsDynError for T {
|
||||
impl<'a, T: Error + 'a> AsDynError<'a> for T {
|
||||
#[inline]
|
||||
fn as_dyn_error(&self) -> &(dyn Error + 'static) {
|
||||
fn as_dyn_error(&self) -> &(dyn Error + 'a) {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl AsDynError for dyn Error + 'static {
|
||||
impl<'a> AsDynError<'a> for dyn Error + 'a {
|
||||
#[inline]
|
||||
fn as_dyn_error(&self) -> &(dyn Error + 'static) {
|
||||
fn as_dyn_error(&self) -> &(dyn Error + 'a) {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl AsDynError for dyn Error + Send + 'static {
|
||||
impl<'a> AsDynError<'a> for dyn Error + Send + 'a {
|
||||
#[inline]
|
||||
fn as_dyn_error(&self) -> &(dyn Error + 'static) {
|
||||
fn as_dyn_error(&self) -> &(dyn Error + 'a) {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl AsDynError for dyn Error + Send + Sync + 'static {
|
||||
impl<'a> AsDynError<'a> for dyn Error + Send + Sync + 'a {
|
||||
#[inline]
|
||||
fn as_dyn_error(&self) -> &(dyn Error + 'static) {
|
||||
fn as_dyn_error(&self) -> &(dyn Error + 'a) {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,11 +62,12 @@
|
|||
//! which may be arbitrary expressions. For example:
|
||||
//!
|
||||
//! ```rust
|
||||
//! # use std::i32;
|
||||
//! # use thiserror::Error;
|
||||
//! #
|
||||
//! #[derive(Error, Debug)]
|
||||
//! pub enum Error {
|
||||
//! #[error("invalid rdo_lookahead_frames {0} (expected < {})", i32::max_value())]
|
||||
//! #[error("invalid rdo_lookahead_frames {0} (expected < {})", i32::MAX)]
|
||||
//! InvalidLookahead(u32),
|
||||
//! }
|
||||
//! ```
|
||||
|
@ -184,6 +185,8 @@
|
|||
//!
|
||||
//! [`anyhow`]: https://github.com/dtolnay/anyhow
|
||||
|
||||
#![allow(clippy::module_name_repetitions)]
|
||||
|
||||
mod aserror;
|
||||
mod display;
|
||||
|
||||
|
|
|
@ -230,3 +230,45 @@ fn test_macro_rules() {
|
|||
assert("0", Error0::Repro(0));
|
||||
assert("0", Error1::Repro(0));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_raw() {
|
||||
#[derive(Error, Debug)]
|
||||
#[error("braced raw error: {r#fn}")]
|
||||
struct Error {
|
||||
r#fn: &'static str,
|
||||
}
|
||||
|
||||
assert("braced raw error: T", Error { r#fn: "T" });
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_raw_enum() {
|
||||
#[derive(Error, Debug)]
|
||||
enum Error {
|
||||
#[error("braced raw error: {r#fn}")]
|
||||
Braced { r#fn: &'static str },
|
||||
}
|
||||
|
||||
assert("braced raw error: T", Error::Braced { r#fn: "T" });
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_raw_conflict() {
|
||||
#[derive(Error, Debug)]
|
||||
enum Error {
|
||||
#[error("braced raw error: {r#func}, {func}", func = "U")]
|
||||
Braced { r#func: &'static str },
|
||||
}
|
||||
|
||||
assert("braced raw error: T, U", Error::Braced { r#func: "T" });
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_keyword() {
|
||||
#[derive(Error, Debug)]
|
||||
#[error("error: {type}", type = 1)]
|
||||
struct Error;
|
||||
|
||||
assert("error: 1", Error);
|
||||
}
|
||||
|
|
|
@ -48,3 +48,20 @@ fn test_boxed_source() {
|
|||
let error = BoxedSource { source };
|
||||
error.source().unwrap().downcast_ref::<io::Error>().unwrap();
|
||||
}
|
||||
|
||||
macro_rules! error_from_macro {
|
||||
($($variants:tt)*) => {
|
||||
#[derive(Error)]
|
||||
#[derive(Debug)]
|
||||
pub enum MacroSource {
|
||||
$($variants)*
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Test that we generate impls with the proper hygiene
|
||||
#[rustfmt::skip]
|
||||
error_from_macro! {
|
||||
#[error("Something")]
|
||||
Variant(#[from] io::Error)
|
||||
}
|
||||
|
|
|
@ -57,3 +57,24 @@ fn test_anyhow() {
|
|||
assert_eq!("outer", error.to_string());
|
||||
assert_eq!("inner", error.source().unwrap().to_string());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_non_static() {
|
||||
#[derive(Error, Debug)]
|
||||
#[error(transparent)]
|
||||
struct Error<'a> {
|
||||
inner: ErrorKind<'a>,
|
||||
}
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
enum ErrorKind<'a> {
|
||||
#[error("unexpected token: {:?}", token)]
|
||||
Unexpected { token: &'a str },
|
||||
}
|
||||
|
||||
let error = Error {
|
||||
inner: ErrorKind::Unexpected { token: "error" },
|
||||
};
|
||||
assert_eq!("unexpected token: \"error\"", error.to_string());
|
||||
assert!(error.source().is_none());
|
||||
}
|
||||
|
|
|
@ -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() {}
|
|
@ -0,0 +1,10 @@
|
|||
error: expected string literal
|
||||
--> $DIR/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)
|
|
@ -1,3 +1,4 @@
|
|||
use std::fmt::Debug;
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
|
@ -8,6 +9,16 @@ struct Error<'a>(#[from] Inner<'a>);
|
|||
#[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")))
|
||||
}
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
error: non-static lifetimes are not allowed in the source of an error
|
||||
--> $DIR/lifetime.rs:5:18
|
||||
error: non-static lifetimes are not allowed in the source of an error, because std::error::Error requires the source is dyn Error + 'static
|
||||
--> $DIR/lifetime.rs:6:26
|
||||
|
|
||||
5 | struct Error<'a>(#[from] Inner<'a>);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
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
|
||||
--> $DIR/lifetime.rs:15:17
|
||||
|
|
||||
15 | Foo(#[from] Generic<&'a str>),
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
error[E0599]: no method named `as_display` found for reference `&NoDisplay` in the current scope
|
||||
error[E0599]: the method `as_display` exists for reference `&NoDisplay`, but its trait bounds were not satisfied
|
||||
--> $DIR/no-display.rs:7:9
|
||||
|
|
||||
4 | struct NoDisplay;
|
||||
| ----------------- doesn't satisfy `NoDisplay: std::fmt::Display`
|
||||
...
|
||||
7 | #[error("thread: {thread}")]
|
||||
| ^^^^^^^^^^^^^^^^^^ method not found in `&NoDisplay`
|
||||
| ^^^^^^^^^^^^^^^^^^ method cannot be called on `&NoDisplay` due to unsatisfied trait bounds
|
||||
|
|
||||
= note: the method `as_display` exists but the following trait bounds were not satisfied:
|
||||
= note: the following trait bounds were not satisfied:
|
||||
`NoDisplay: std::fmt::Display`
|
||||
which is required by `&NoDisplay: DisplayAsDisplay`
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
error[E0599]: no method named `as_dyn_error` found for reference `&NotError` in the current scope
|
||||
error[E0599]: the method `as_dyn_error` exists for reference `&NotError`, but its trait bounds were not satisfied
|
||||
--> $DIR/source-enum-not-error.rs:10:9
|
||||
|
|
||||
4 | pub struct NotError;
|
||||
|
@ -8,9 +8,9 @@ error[E0599]: no method named `as_dyn_error` found for reference `&NotError` in
|
|||
| doesn't satisfy `NotError: std::error::Error`
|
||||
...
|
||||
10 | source: NotError,
|
||||
| ^^^^^^ method not found in `&NotError`
|
||||
| ^^^^^^ method cannot be called on `&NotError` due to unsatisfied trait bounds
|
||||
|
|
||||
= note: the method `as_dyn_error` exists but the following trait bounds were not satisfied:
|
||||
= note: the following trait bounds were not satisfied:
|
||||
`NotError: std::error::Error`
|
||||
which is required by `NotError: AsDynError`
|
||||
`&NotError: std::error::Error`
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
error[E0599]: no method named `as_dyn_error` found for struct `NotError` in the current scope
|
||||
error[E0599]: the method `as_dyn_error` exists for struct `NotError`, but its trait bounds were not satisfied
|
||||
--> $DIR/source-struct-not-error.rs:9:5
|
||||
|
|
||||
4 | struct NotError;
|
||||
|
@ -9,8 +9,8 @@ error[E0599]: no method named `as_dyn_error` found for struct `NotError` in the
|
|||
| doesn't satisfy `NotError: std::error::Error`
|
||||
...
|
||||
9 | source: NotError,
|
||||
| ^^^^^^ method not found in `NotError`
|
||||
| ^^^^^^ method cannot be called on `NotError` due to unsatisfied trait bounds
|
||||
|
|
||||
= note: the method `as_dyn_error` exists but the following trait bounds were not satisfied:
|
||||
= note: the following trait bounds were not satisfied:
|
||||
`NotError: std::error::Error`
|
||||
which is required by `NotError: AsDynError`
|
||||
|
|
Загрузка…
Ссылка в новой задаче