Lines Matching defs:Error
14 pub type Result<T> = std::result::Result<T, Error>;
16 /// Error returned when a Syn parser cannot parse the input tokens.
18 /// # Error reporting in proc macros
70 /// [`.to_compile_error()`]: Error::to_compile_error
71 /// [`.into_compile_error()`]: Error::into_compile_error
87 /// .unwrap_or_else(syn::Error::into_compile_error)
100 pub struct Error {
125 Error: Send + Sync;
127 impl Error {
132 /// Use `Error::new` when the error needs to be triggered on some span other
140 /// use syn::{Error, Ident, LitStr, Result, Token};
151 /// return Err(Error::new(name_token.span(), "expected `name`"));
161 fn new(span: Span, message: String) -> Error {
162 Error {
177 /// Unlike the `Error::new` constructor, this constructor takes an argument
178 /// `tokens` which is a syntax tree node. This allows the resulting `Error`
180 /// typically be able to use the `Spanned` trait with the above `Error::new`
182 /// `Error::new_spanned` may provide a higher-quality error message on
185 /// When in doubt it's recommended to stick to `Error::new` (or
192 fn new_spanned(tokens: TokenStream, message: String) -> Error {
196 Error {
208 /// if called from a different thread than the one on which the `Error` was
242 /// use syn::{parse_macro_input, DeriveInput, Error};
250 /// .unwrap_or_else(Error::into_compile_error)
270 pub fn combine(&mut self, another: Error) {
327 pub(crate) fn new_at<T: Display>(scope: Span, cursor: Cursor, message: T) -> Error {
329 Error::new(scope, format!("unexpected end of input, {}", message))
332 Error::new(span, message)
337 pub(crate) fn new2<T: Display>(start: Span, end: Span, message: T) -> Error {
340 fn new2(start: Span, end: Span, message: String) -> Error {
341 Error {
350 impl Debug for Error {
354 .debug_tuple("Error")
359 .debug_tuple("Error")
372 impl Display for Error {
378 impl Clone for Error {
380 Error {
403 impl std::error::Error for Error {}
405 impl From<LexError> for Error {
407 Error::new(err.span(), err)
411 impl IntoIterator for Error {
412 type Item = Error;
427 type Item = Error;
430 Some(Error {
436 impl<'a> IntoIterator for &'a Error {
437 type Item = Error;
452 type Item = Error;
455 Some(Error {
461 impl Extend<Error> for Error {
462 fn extend<T: IntoIterator<Item = Error>>(&mut self, iter: T) {