Skip to main content

AttrSet

Struct AttrSet 

Source
pub struct AttrSet(/* private fields */);
Expand description

The attributes that are either set or not.

A bitset for the same reason crate::Flags is one, though the pressure is lower here since there is one of these per function rather than one per instruction.

Implementations§

Source§

impl AttrSet

Source

pub const NONE: Self

Nothing set.

Source

pub const NOUNWIND: Self

No exception unwinds out of this function. Every C function compiled without -fexceptions is one, and it is what lets a call be moved and lets the caller skip the landing pad.

Source

pub const NORETURN: Self

Control never comes back. _Noreturn, and __attribute__((noreturn)) for the same thing under the older spelling. The instruction after a call to one is unreachable.

Source

pub const RETURNS_TWICE: Self

Control may come back twice from one call. setjmp and vfork, under __attribute__((returns_twice)). Every value live across a call to one has to be in memory, so this switches off a large amount of the optimizer for the caller.

Source

pub const WILLRETURN: Self

Control comes back, eventually. This is what says an empty infinite loop is not in here, and without it a call cannot be deleted even when nothing uses its result.

Source

pub const COLD: Self

Rarely called, from __attribute__((cold)). Its code goes in the cold section and the path leading to a call to it is the unlikely one.

Source

pub const HOT: Self

Often called, from __attribute__((hot)).

Source

pub const INLINE_HINT: Self

The programmer wrote inline, which in C is a hint about linkage and about inlining and which the inliner treats as a small nudge rather than as an instruction.

Source

pub const ALWAYS_INLINE: Self

__attribute__((always_inline)), which is not a hint. Failing to inline one of these is an error, because the header that wrote it usually meant a target-specific builtin that does not work any other way.

Source

pub const NOINLINE: Self

__attribute__((noinline)).

Source

pub const OPTNONE: Self

__attribute__((optimize("O0"))) and the pragma for it. Nothing in this function is rewritten, which is what somebody debugging one function of a release build asks for.

Source

pub const READNONE: Self

Reads no memory and writes none, so its result depends only on its arguments and two calls with the same arguments are one call. __attribute__((const)).

Source

pub const READONLY: Self

Writes no memory, though it may read it. __attribute__((pure)). Two calls with the same arguments are one call only if nothing wrote memory in between.

Source

pub const ARGMEM_ONLY: Self

Touches no memory except through the pointers it was passed. This is what makes a call stop clobbering everything the caller knew about its own locals.

Source

pub const NAKED: Self

__attribute__((naked)). No prologue and no epilogue are emitted, the body is inline assembly, and the code generator does exactly what it is told.

Source

pub const USED: Self

Keep it even if nothing refers to it. __attribute__((used)), which is how a section of initializers survives a linker that garbage collects.

Source

pub const STACK_PROTECT: Self

Emit a stack protector for this frame, from -fstack-protector and the attribute.

Source

pub const NO_STACK_PROTECTOR: Self

Emit none, whatever the command line said. __attribute__((no_stack_protector)), which the kernel needs on the functions that run before the canary exists.

Source

pub const fn bits(self) -> u32

The underlying bits, for the printer and for hashing.

Source

pub const fn is_empty(self) -> bool

Whether nothing is set.

Source

pub const fn contains(self, other: Self) -> bool

Whether every attribute in other is set here.

Source

pub const fn union(self, other: Self) -> Self

Both sets.

Source

pub const fn without(self, other: Self) -> Self

This set without the attributes in other.

Source

pub fn iter(self) -> impl Iterator<Item = (Self, &'static str)>

Every attribute that is set, with its name, in the order the printer writes them.

Source

pub fn from_name(name: &str) -> Option<Self>

The attribute with that name, if there is one.

Trait Implementations§

Source§

impl BitOr for AttrSet

Source§

type Output = AttrSet

The resulting type after applying the | operator.
Source§

fn bitor(self, other: Self) -> Self

Performs the | operation. Read more
Source§

impl BitOrAssign for AttrSet

Source§

fn bitor_assign(&mut self, other: Self)

Performs the |= operation. Read more
Source§

impl Clone for AttrSet

Source§

fn clone(&self) -> AttrSet

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for AttrSet

Source§

impl Debug for AttrSet

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AttrSet

Source§

fn default() -> AttrSet

Returns the “default value” for a type. Read more
Source§

impl Eq for AttrSet

Source§

impl Hash for AttrSet

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for AttrSet

Source§

fn eq(&self, other: &AttrSet) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for AttrSet

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.