ResolverExpand in rustc_expand::base - Rust
Description: API documentation for the Rust `ResolverExpand` trait in crate `rustc_expand`.

Skip to main content

## ResolverExpand

# Trait ResolverExpand

Source

    pub trait ResolverExpand {
    Show 23 methods    // Required methods
        fn next_node_id(&mut self) -> NodeId;
        fn invocation_parent(&self, id: LocalExpnId) -> LocalDefId;
        fn resolve_dollar_crates(&self);
        fn visit_ast_fragment_with_placeholders(
            &mut self,
            expn_id: LocalExpnId,
            fragment: &AstFragment,
        );
        fn register_builtin_macro(&mut self, name: Symbol, ext: SyntaxExtensionKind);
        fn expansion_for_ast_pass(
            &mut self,
            call_site: Span,
            pass: AstPass,
            features: &[Symbol],
            parent_module_id: Option<NodeId>,
        ) -> LocalExpnId;
        fn resolve_imports(&mut self);
        fn resolve_macro_invocation(
            &mut self,
            invoc: &Invocation,
            eager_expansion_root: LocalExpnId,
            force: bool,
        ) -> Result<Arc<SyntaxExtension>, Indeterminate>;
        fn record_macro_rule_usage(&mut self, mac_id: NodeId, rule_index: usize);
        fn check_unused_macros(&mut self);
        fn has_derive_copy(&self, expn_id: LocalExpnId) -> bool;
        fn resolve_derives(
            &mut self,
            expn_id: LocalExpnId,
            force: bool,
            derive_paths: &dyn Fn() -> Vec<DeriveResolution>,
        ) -> Result<(), Indeterminate>;
        fn take_derive_resolutions(
            &mut self,
            expn_id: LocalExpnId,
        ) -> Option<Vec<DeriveResolution>>;
        fn cfg_accessible(
            &mut self,
            expn_id: LocalExpnId,
            path: &Path,
        ) -> Result<bool, Indeterminate>;
        fn macro_accessible(
            &mut self,
            expn_id: LocalExpnId,
            path: &Path,
        ) -> Result<bool, Indeterminate>;
        fn get_proc_macro_quoted_span(&self, krate: CrateNum, id: usize) -> Span;
        fn declare_proc_macro(&mut self, id: NodeId);
        fn append_stripped_cfg_item(
            &mut self,
            parent_node: NodeId,
            ident: Ident,
            cfg: CfgEntry,
            cfg_span: Span,
        );
        fn registered_tools(&self) -> &RegisteredTools;
        fn register_glob_delegation(&mut self, invoc_id: LocalExpnId);
        fn glob_delegation_suffixes(
            &self,
            trait_def_id: DefId,
            impl_def_id: LocalDefId,
        ) -> Result<Vec<(Ident, Option<Ident>)>, Indeterminate>;
        fn insert_impl_trait_name(&mut self, id: NodeId, name: Symbol);
        fn mark_scope_with_compile_error(&mut self, parent_node: NodeId);
    }

## Required Methods§

Source

#### fn next_node_id(&mut self) -> NodeId

Source

#### fn invocation_parent(&self, id: LocalExpnId) -> LocalDefId

Source

#### fn resolve_dollar_crates(&self)

Source

#### fn visit_ast_fragment_with_placeholders( &mut self, expn_id: LocalExpnId, fragment: &AstFragment, )

Source

#### fn register_builtin_macro(&mut self, name: Symbol, ext: SyntaxExtensionKind)

Source

#### fn expansion_for_ast_pass( &mut self, call_site: Span, pass: AstPass, features: &[Symbol], parent_module_id: Option<NodeId>, ) -> LocalExpnId

Source

#### fn resolve_imports(&mut self)

Source

#### fn resolve_macro_invocation( &mut self, invoc: &Invocation, eager_expansion_root: LocalExpnId, force: bool, ) -> Result<Arc<SyntaxExtension>, Indeterminate>

Source

#### fn record_macro_rule_usage(&mut self, mac_id: NodeId, rule_index: usize)

Source

#### fn check_unused_macros(&mut self)

Source

#### fn has_derive_copy(&self, expn_id: LocalExpnId) -> bool

Does `#[derive(...)]` attribute with the given `ExpnId` have built-in `Copy` inside it?

Source

#### fn resolve_derives( &mut self, expn_id: LocalExpnId, force: bool, derive_paths: &dyn Fn() -> Vec<DeriveResolution>, ) -> Result<(), Indeterminate>

Resolve paths inside the `#[derive(...)]` attribute with the given `ExpnId`.

Source

#### fn take_derive_resolutions( &mut self, expn_id: LocalExpnId, ) -> Option<Vec<DeriveResolution>>

Take resolutions for paths inside the `#[derive(...)]` attribute with the given `ExpnId` back from resolver.

Source

#### fn cfg_accessible( &mut self, expn_id: LocalExpnId, path: &Path, ) -> Result<bool, Indeterminate>

Path resolution logic for `#[cfg_accessible(path)]`.

Source

#### fn macro_accessible( &mut self, expn_id: LocalExpnId, path: &Path, ) -> Result<bool, Indeterminate>

Source

#### fn get_proc_macro_quoted_span(&self, krate: CrateNum, id: usize) -> Span

Decodes the proc-macro quoted span in the specified crate, with the specified id. No caching is performed.

Source

#### fn declare_proc_macro(&mut self, id: NodeId)

The order of items in the HIR is unrelated to the order of items in the AST. However, we generate proc macro harnesses based on the AST order, and later refer to these harnesses from the HIR. This field keeps track of the order in which we generated proc macros harnesses, so that we can map HIR proc macros items back to their harness items.

Source

#### fn append_stripped_cfg_item( &mut self, parent_node: NodeId, ident: Ident, cfg: CfgEntry, cfg_span: Span, )

Source

#### fn registered_tools(&self) -> &RegisteredTools

Tools registered with `#![register_tool]` and used by tool attributes and lints.

Source

#### fn register_glob_delegation(&mut self, invoc_id: LocalExpnId)

Mark this invocation id as a glob delegation.

Source

#### fn glob_delegation_suffixes( &self, trait_def_id: DefId, impl_def_id: LocalDefId, ) -> Result<Vec<(Ident, Option<Ident>)>, Indeterminate>

Names of specific methods to which glob delegation expands.

Source

#### fn insert_impl_trait_name(&mut self, id: NodeId, name: Symbol)

Record the name of an opaque `Ty::ImplTrait` pre-expansion so that it can be used to generate an item name later that does not reference placeholder macros.

Source

#### fn mark_scope_with_compile_error(&mut self, parent_node: NodeId)

Mark the scope as having a compile error so that error for lookup in this scope should be suppressed

## Implementors§