fn preprocess_items(
        &mut self,
        items: &mut Vec<(ast::Item, Option<T![;]>)>,
    ) -> Result<(), CompileError> {
        let mut queue = items.drain(..).collect::<VecDeque<_>>();

        while let Some((item, semi)) = queue.pop_front() {
            match item {
                ast::Item::Use(item_use) => {
                    let visibility = ast_to_visibility(&item_use.visibility)?;

                    let import = Import {
                        kind: ImportKind::Global,
                        visibility,
                        module: self.mod_item.clone(),
                        item: self.items.item().clone(),
                        source: self.source.clone(),
                        source_id: self.source_id,
                        ast: item_use,
                    };

                    let queue = &mut self.queue;

                    import.process(self.context, &self.storage, &self.query, &mut |task| {
                        queue.push_back(task);
                    })?;
                }
                ast::Item::MacroCall(mut macro_call) => {
                    let mut attributes = attrs::Attributes::new(
                        macro_call.attributes.to_vec(),
                        self.storage.clone(),
                        self.source.clone(),
                    );

                    if self.try_expand_internal_macro(&mut attributes, &mut macro_call)? {
                        items.push((ast::Item::MacroCall(macro_call), semi));
                    } else {
                        let file = self.expand_macro::<ast::File>(&mut macro_call)?;

                        for entry in file.items.into_iter().rev() {
                            queue.push_front(entry);
                        }
                    }

                    if let Some(span) = attributes.remaining() {
                        return Err(CompileError::msg(span, "unsupported item attribute"));
                    }
                }
                item => {
                    items.push((item, semi));
                }
            }
        }

        Ok(())
    }
/// pre-process uses and expand item macros.
///
/// Uses are processed first in a file, and once processed any potential
/// macro expansions are expanded.
/// If these produce uses, these are processed, and so forth.
pre-process uses and expand item macros.
Uses are processed first in a file, and once processed any potential
macro expansions are expanded.
If these produce uses, these are processed, and so forth.
pre - process uses and expand item macros . Uses are processed first in a file and once processed any potential macro expansions are expanded . If these produce uses these are processed and so forth .
fn preprocess_items(
        &mut self,
        items: &mut Vec<(ast::Item, Option<T![;]>)>,
    ) -> Result<(), CompileError> {
        let mut queue = items.drain(..).collect::<VecDeque<_>>();
        while let Some((item, semi)) = queue.pop_front() {
            match item {
                ast::Item::Use(item_use) => {
                    let visibility = ast_to_visibility(&item_use.visibility)?;
                    let import = Import {
                        kind: ImportKind::Global,
                        visibility,
                        module: self.mod_item.clone(),
                        item: self.items.item().clone(),
                        source: self.source.clone(),
                        source_id: self.source_id,
                        ast: item_use,
                    };
                    let queue = &mut self.queue;
                    import.process(self.context, &self.storage, &self.query, &mut |task| {
                        queue.push_back(task);
                    })?;
                }
                ast::Item::MacroCall(mut macro_call) => {
                    let mut attributes = attrs::Attributes::new(
                        macro_call.attributes.to_vec(),
                        self.storage.clone(),
                        self.source.clone(),
                    );
                    if self.try_expand_internal_macro(&mut attributes, &mut macro_call)? {
                        items.push((ast::Item::MacroCall(macro_call), semi));
                    } else {
                        let file = self.expand_macro::<ast::File>(&mut macro_call)?;
                        for entry in file.items.into_iter().rev() {
                            queue.push_front(entry);
                        }
                    }
                    if let Some(span) = attributes.remaining() {
                        return Err(CompileError::msg(span, "unsupported item attribute"));
                    }
                }
                item => {
                    items.push((item, semi));
                }
            }
        }
        Ok(())
    }
fn preprocess_items ( & mut self , items : & mut Vec < ( ast :: Item , Option < T ! [ ] > ) > , ) -> Result < ( ) , CompileError > { let mut queue = items . drain ( .. ) . collect :: < VecDeque < _ > > ( ) ; while let Some ( ( item , semi ) ) = queue . pop_front ( ) { match item { ast :: Item :: Use ( item_use ) => { let visibility = ast_to_visibility ( & item_use . visibility ) ? ; let import = Import { kind : ImportKind :: Global , visibility , module : self . mod_item . clone ( ) , item : self . items . item ( ) . clone ( ) , source : self . source . clone ( ) , source_id : self . source_id , ast : item_use , } ; let queue = & mut self . queue ; import . process ( self . context , & self . storage , & self . query , & mut | task | { queue . push_back ( task ) ; } ) ? ; } ast :: Item :: MacroCall ( mut macro_call ) => { let mut attributes = attrs :: Attributes :: new ( macro_call . attributes . to_vec ( ) , self . storage . clone ( ) , self . source . clone ( ) , ) ; if self . try_expand_internal_macro ( & mut attributes , & mut macro_call ) ? { items . push ( ( ast :: Item :: MacroCall ( macro_call ) , semi ) ) ; } else { let file = self . expand_macro :: < ast :: File > ( & mut macro_call ) ? ; for entry in file . items . into_iter ( ) . rev ( ) { queue . push_front ( entry ) ; } } if let Some ( span ) = attributes . remaining ( ) { return Err ( CompileError :: msg ( span , " " ) ) ; } } item => { items . push ( ( item , semi ) ) ; } } } Ok ( ( ) ) }
pre-process uses and expand item macros.
pre - process uses and expand item macros .
&mut self
items
&mut Vec<(ast::Item, Option<T![;]>)>
&mut self
items
&mut Vec<(ast::Item, Option<T![;]>)>