Struct rustc_plugin::registry::Registry
[−]
[src]
pub struct Registry<'a> { pub sess: &'a Session, // some fields omitted }
rustc_private
)Structure used to register plugins.
A plugin registrar function takes an &mut Registry
and should call
methods to register its plugins.
This struct has public fields and other methods for use by rustc
itself. They are not documented here, and plugin authors should
not use them.
Fields
sess: &'a Session
rustc_private
)Compiler session. Useful if you want to emit diagnostic messages from the plugin registrar.
Methods
impl<'a> Registry<'a>
[src]
fn args<'b>(&'b self) -> &'b [P<MetaItem>]
rustc_private
)Get the plugin's arguments, if any.
These are specified inside the plugin
crate attribute as
#![plugin(my_plugin_name(... args ...))]
Returns empty slice in case the plugin was loaded
with --extra-plugins
fn register_syntax_extension(&mut self, name: Name, extension: SyntaxExtension)
rustc_private
)Register a syntax extension of any kind.
This is the most general hook into libsyntax
's expansion behavior.
fn register_macro(&mut self, name: &str, expander: MacroExpanderFn)
rustc_private
)Register a macro of the usual kind.
This is a convenience wrapper for register_syntax_extension
.
It builds for you a NormalTT
that calls expander
,
and also takes care of interning the macro's name.
fn register_early_lint_pass(&mut self, lint_pass: EarlyLintPassObject)
rustc_private
)Register a compiler lint pass.
fn register_late_lint_pass(&mut self, lint_pass: LateLintPassObject)
rustc_private
)Register a compiler lint pass.
fn register_lint_group(&mut self, name: &'static str, to: Vec<&'static Lint>)
rustc_private
)Register a lint group.
fn register_mir_pass(&mut self, pass: Box<for<'pcx> MirMapPass<'pcx>>)
rustc_private
)Register a MIR pass
fn register_llvm_pass(&mut self, name: &str)
rustc_private
)Register an LLVM pass.
Registration with LLVM itself is handled through static C++ objects with constructors. This method simply adds a name to the list of passes to execute.
fn register_attribute(&mut self, name: String, ty: AttributeType)
rustc_private
)Register an attribute with an attribute type.
Registered attributes will bypass the custom_attribute
feature gate.
Whitelisted
attributes will additionally not trigger the unused_attribute
lint. CrateLevel
attributes will not be allowed on anything other than a crate.