diff --git a/wgpu-core/src/pipeline.rs b/wgpu-core/src/pipeline.rs index 36b55dc20..2436f8cf2 100644 --- a/wgpu-core/src/pipeline.rs +++ b/wgpu-core/src/pipeline.rs @@ -5,7 +5,7 @@ use crate::{ id::{DeviceId, PipelineLayoutId, ShaderModuleId}, validation, Label, LifeGuard, Stored, }; -use std::{borrow::Cow, fmt}; +use std::{borrow::Cow, error::Error, fmt}; use thiserror::Error; #[allow(clippy::large_enum_variant)] @@ -46,11 +46,10 @@ impl Resource for ShaderModule { } } -#[derive(Clone, Debug, Error)] +#[derive(Clone, Debug)] pub struct ShaderError { pub source: String, pub label: Option, - #[source] pub inner: E, } impl fmt::Display for ShaderError { @@ -91,6 +90,15 @@ impl fmt::Display for ShaderError> ) } } +impl Error for ShaderError +where + ShaderError: fmt::Display, + E: Error + 'static, +{ + fn source(&self) -> Option<&(dyn Error + 'static)> { + Some(&self.inner) + } +} //Note: `Clone` would require `WithSpan: Clone`. #[derive(Debug, Error)]