Skip to main content

PositionalMacros

Struct PositionalMacros 

Source
pub struct PositionalMacros<'a> { /* private fields */ }
Expand description

A macro table that answers as of one offset.

This is what crate::condition::MacroValues is implemented for, so a condition is evaluated against the macros that were in force where it was written — not against the file’s final table, which is a different question with different answers.

The table is a &dyn because the same offset question is asked of a per-file table and of a whole walked translation unit’s view — see MacroBindings, which is where the three sources of an answer are named.

Trait Implementations§

Source§

impl MacroValues for PositionalMacros<'_>

Source§

fn builtin_operator(&self, name: &str, operand: &str) -> Option<Value>

Forwarded, with the offset this wrapper exists to add.

The cooks all evaluate through a PositionalMacros, so an operator answered by the table underneath is answered here or nowhere: __has_include would be Unknown in every real cook while its implementation sat one layer down, unreachable. The wrapper’s whole job is to add the offset.

§The offset is not decoration

An earlier version of this forwarded the operator with no position, and for __has_cpp_attribute that was the whole bug: the answer depends on whether the bare name is a macro at that point, and the walking table answers a question without a position from the end of the file — where xtr1common:22’s #undef msvc has already happened, so every msvc:: attribute read as unsupported and [[msvc::no_specializations(...)]] was missing from the stream while cl.exe emitted it 17 times.

Source§

fn lookup(&self, name: &str) -> Lookup<'_>

What this table knows about name at the position being evaluated.
Source§

fn is_complete(&self) -> bool

Does this table know every name a compilation defines? — the difference between Lookup::Undefined and Lookup::Unanswered for a name the table has never seen. Read more

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for PositionalMacros<'a>

§

impl<'a> !Send for PositionalMacros<'a>

§

impl<'a> !Sync for PositionalMacros<'a>

§

impl<'a> !UnwindSafe for PositionalMacros<'a>

§

impl<'a> Forget for PositionalMacros<'a>

§

impl<'a> Freeze for PositionalMacros<'a>

§

impl<'a> Move for PositionalMacros<'a>

§

impl<'a> Unpin for PositionalMacros<'a>

§

impl<'a> UnsafeUnpin for PositionalMacros<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.