| 1 | use proc_macrorust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro crate/::{Delimiterrust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro Delimiter#, Grouprust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro Group#, Identrust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro Ident#, Literalrust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro Literal#, Punctrust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro Punct#, Spacingrust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro Spacing#, Spanrust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro Span#, TokenStreamrust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro TokenStream#, TokenTreerust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro TokenTree#}; |
| 2 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/::FromIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/FromIterator#; |
| 3 | |
| 4 | pub type Resultrust-analyzer cargo pastey 0.2.3 error/Result#<T> = stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<T, Errorrust-analyzer cargo pastey 0.2.3 error/Error#>; |
| 5 | |
| 6 | pub struct Errorrust-analyzer cargo pastey 0.2.3 error/Error# { |
| 7 | beginrust-analyzer cargo pastey 0.2.3 error/Error#begin.: Spanrust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro Span#, |
| 8 | endrust-analyzer cargo pastey 0.2.3 error/Error#end.: Spanrust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro Span#, |
| 9 | msgrust-analyzer cargo pastey 0.2.3 error/Error#msg.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, |
| 10 | } |
| 11 | |
| 12 | impl Errorrust-analyzer cargo pastey 0.2.3 error/Error# { |
| 13 | pub fn newrust-analyzer cargo pastey 0.2.3 error/impl#[Error]new().(span: Spanrust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro Span#, msg: &str) -> Selfrust-analyzer cargo pastey 0.2.3 error/impl#[Error] { |
| 14 | Selfrust-analyzer cargo pastey 0.2.3 error/impl#[Error]::new2rust-analyzer cargo pastey 0.2.3 error/impl#[Error]new2().(span, span, msg) |
| 15 | } |
| 16 | |
| 17 | pub fn new2rust-analyzer cargo pastey 0.2.3 error/impl#[Error]new2().(begin: Spanrust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro Span#, end: Spanrust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro Span#, msg: &str) -> Selfrust-analyzer cargo pastey 0.2.3 error/impl#[Error] { |
| 18 | Errorrust-analyzer cargo pastey 0.2.3 error/Error# { |
| 19 | beginrust-analyzer cargo pastey 0.2.3 error/Error#begin., |
| 20 | endrust-analyzer cargo pastey 0.2.3 error/Error#end., |
| 21 | msgrust-analyzer cargo pastey 0.2.3 error/Error#msg.: msg.to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().(), |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | pub fn to_compile_errorrust-analyzer cargo pastey 0.2.3 error/impl#[Error]to_compile_error().(&self) -> TokenStreamrust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro TokenStream# { |
| 26 | // compile_error! { $msg } |
| 27 | TokenStreamrust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro TokenStream#::from_iterrust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro impl#[TokenStream][`FromIterator<TokenTree>`]from_iter().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 28 | TokenTreerust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro TokenTree#::Identrust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro TokenTree#Ident#(Identrust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro Ident#::newrust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro impl#[Ident]new().("compile_error", self.beginrust-analyzer cargo pastey 0.2.3 error/Error#begin.)), |
| 29 | TokenTreerust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro TokenTree#::Punctrust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro TokenTree#Punct#({ |
| 30 | let mut punct = Punctrust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro Punct#::newrust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro impl#[Punct]new().('!', Spacingrust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro Spacing#::Alonerust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro Spacing#Alone#); |
| 31 | punct.set_spanrust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro impl#[Punct]set_span().(self.beginrust-analyzer cargo pastey 0.2.3 error/Error#begin.); |
| 32 | punct |
| 33 | }), |
| 34 | TokenTreerust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro TokenTree#::Grouprust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro TokenTree#Group#({ |
| 35 | let mut group = Grouprust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro Group#::newrust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro impl#[Group]new().(Delimiterrust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro Delimiter#::Bracerust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro Delimiter#Brace#, { |
| 36 | TokenStreamrust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro TokenStream#::from_iterrust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro impl#[TokenStream][`FromIterator<TokenTree>`]from_iter().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![TokenTreerust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro TokenTree#::Literalrust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro TokenTree#Literal#({ |
| 37 | let mut string = Literalrust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro Literal#::stringrust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro impl#[Literal]string().(&self.msgrust-analyzer cargo pastey 0.2.3 error/Error#msg.); |
| 38 | string.set_spanrust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro impl#[Literal]set_span().(self.endrust-analyzer cargo pastey 0.2.3 error/Error#end.); |
| 39 | string |
| 40 | })]) |
| 41 | }); |
| 42 | group.set_spanrust-analyzer cargo proc_macro https://github.com/rust-lang/rust/library/proc_macro impl#[Group]set_span().(self.endrust-analyzer cargo pastey 0.2.3 error/Error#end.); |
| 43 | group |
| 44 | }), |
| 45 | ]) |
| 46 | } |
| 47 | } |