pub enum ParseError {
RustcWillCatch {
reason: &'static str,
},
FacetError {
message: String,
span: Span,
},
}Expand description
Errors that can occur during parsing of derive macro attributes.
Some errors are caught by rustc itself, so we don’t emit duplicate diagnostics. Others are facet-specific and need our own compile_error!.
Variants§
RustcWillCatch
An error that rustc will catch on its own - we don’t emit a diagnostic.
We track these so the code is explicit about why we’re not panicking, and to document what rustc catches.
FacetError
A facet-specific error that rustc won’t catch - we emit compile_error!
Implementations§
Source§impl ParseError
impl ParseError
Sourcepub fn rustc_will_catch(reason: &'static str) -> Self
pub fn rustc_will_catch(reason: &'static str) -> Self
Create a “rustc will catch this” error.
Use this when we detect an error that rustc will also catch, so we avoid duplicate diagnostics.
Sourcepub fn facet_error(message: impl Into<String>, span: Span) -> Self
pub fn facet_error(message: impl Into<String>, span: Span) -> Self
Create a facet-specific error with a span.
Sourcepub fn to_compile_error(&self) -> Option<TokenStream>
pub fn to_compile_error(&self) -> Option<TokenStream>
Convert to a compile_error! TokenStream, or None if rustc will catch it.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ParseError
impl RefUnwindSafe for ParseError
impl !Send for ParseError
impl !Sync for ParseError
impl Unpin for ParseError
impl UnwindSafe for ParseError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more