Struct syntax::ext::base::ExtCtxt[src]
pub struct ExtCtxt<'a> {
pub parse_sess: &'a ParseSess,
pub cfg: CrateConfig,
pub backtrace: Option<Gc<ExpnInfo>>,
pub ecfg: ExpansionConfig,
pub mod_path: Vec<Ident>,
pub trace_mac: bool,
}Fields
parse_sess | |
cfg | |
backtrace | |
ecfg | |
mod_path | |
trace_mac |
Methods
impl<'a> ExtCtxt<'a>
fn new<'a>(parse_sess: &'a ParseSess, cfg: CrateConfig, ecfg: ExpansionConfig) -> ExtCtxt<'a>
fn expand_expr(&mut self, e: Gc<Expr>) -> Gc<Expr>
fn codemap(&self) -> &'a CodeMap
fn parse_sess(&self) -> &'a ParseSess
fn cfg(&self) -> CrateConfig
fn call_site(&self) -> Span
fn print_backtrace(&self)
fn backtrace(&self) -> Option<Gc<ExpnInfo>>
fn mod_push(&mut self, i: Ident)
fn mod_pop(&mut self)
fn mod_path(&self) -> Vec<Ident>
fn bt_push(&mut self, ei: ExpnInfo)
fn bt_pop(&mut self)
fn span_fatal(&self, sp: Span, msg: &str) -> !
Emit msg attached to sp, and stop compilation immediately.
span_err should be strongly prefered where-ever possible:
this should only be used when
- continuing has a high risk of flow-on errors (e.g. errors in
declaring a macro would cause all uses of that macro to
complain about "undefined macro"), or
- there is literally nothing else that can be done (however,
in most cases one can construct a dummy expression/item to
substitute; we never hit resolve/type-checking so the dummy
value doesn't have to match anything)
fn span_err(&self, sp: Span, msg: &str)
Emit msg attached to sp, without immediately stopping
compilation.
Compilation will be stopped in the near future (at the end of the macro expansion phase).