pub struct MacroTable { /* private fields */ }Expand description
Every macro currently defined.
Implementations§
Source§impl MacroTable
impl MacroTable
Sourcepub fn new() -> MacroTable
pub fn new() -> MacroTable
An empty table.
Sourcepub fn is_defined(&self, name: Symbol) -> bool
pub fn is_defined(&self, name: Symbol) -> bool
Whether name is defined, which is what #ifdef and defined ask.
Sourcepub fn define(
&mut self,
def: MacroDef,
interner: &Interner,
) -> Option<Diagnostic>
pub fn define( &mut self, def: MacroDef, interner: &Interner, ) -> Option<Diagnostic>
Adds a definition, returning a warning if it replaces a different one.
Redefining a macro to the same thing is legal and extremely common, because a header included twice through two paths does it. Redefining it to something else is a constraint violation, which GCC reports as a warning and accepts, and we match that because rejecting it would break real builds.
Sourcepub fn define_builtin(&mut self, name: Symbol, builtin: Builtin, span: Span)
pub fn define_builtin(&mut self, name: Symbol, builtin: Builtin, span: Span)
Defines one of the macros whose value is a question.
span is where to say the macro came from, which is the start of <built-in>, so that
a warning about redefining __FILE__ has somewhere to point.
Trait Implementations§
Source§impl Debug for MacroTable
impl Debug for MacroTable
Source§impl Default for MacroTable
impl Default for MacroTable
Source§fn default() -> MacroTable
fn default() -> MacroTable
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for MacroTable
impl RefUnwindSafe for MacroTable
impl Send for MacroTable
impl Sync for MacroTable
impl Unpin for MacroTable
impl UnsafeUnpin for MacroTable
impl UnwindSafe for MacroTable
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more