Skip to main content

Gates

Struct Gates 

Source
pub struct Gates { /* private fields */ }
Expand description

The rules -fdisable-<pass> and -fenable-<pass> left behind, in the order they were given.

Empty by default, and an empty set of gates answers yes to everything, so the cost of the feature on a compilation nobody is debugging is one test of a Vec for emptiness per pass.

Implementations§

Source§

impl Gates

Source

pub fn add(&mut self, on: bool, spec: &str) -> Result<(), String>

Adds one -fdisable-<pass>[=<range>] or -fenable-<pass>[=<range>], with on saying which of the two it was and spec being everything after the second hyphen.

§Errors

When the pass is not one this compiler has, when the range list is empty, when an item of it is empty, or when a span runs backwards. A misspelled pass name is the error worth catching here: it would otherwise look exactly like a pass that is not guilty, and the bisection would carry on past the one thing it was looking for.

Source

pub fn is_empty(&self) -> bool

Whether anything was asked for at all.

Source

pub fn allows(&self, pass: &str, default: bool, id: u32, name: &str) -> bool

Whether that pass runs over that function, where default is what the optimization level already decided about the pass.

The function is identified both ways at once because both spellings are useful and neither is available in both places. A script bisecting a file it has never read counts functions and gives numbers. A person who has just read -fopt-info gives the name it printed.

Source

pub fn enabled(&self) -> Vec<&str>

Every pass some rule turns on, in the order the rules were given, without repeats.

A pass named by -fenable- that the level did not choose has to join the pipeline, or the flag would be a way of asking for something and being given nothing. That is also how the flag reaches a pass at -O0, which is where a bisection would rather start.

Source

pub fn note(&self, pass: &str) -> Option<String>

What --print-pipeline says after a pass a rule mentions, or nothing when no rule does.

The listing is the answer to why a program came out the way it did, and a pass that is in the list and did not run on the function being asked about is exactly the kind of thing that answer has to include.

Trait Implementations§

Source§

impl Clone for Gates

Source§

fn clone(&self) -> Gates

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 Debug for Gates

Source§

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

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

impl Default for Gates

Source§

fn default() -> Gates

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

impl Eq for Gates

Source§

impl PartialEq for Gates

Source§

fn eq(&self, other: &Gates) -> 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 Gates

Auto Trait Implementations§

§

impl Freeze for Gates

§

impl RefUnwindSafe for Gates

§

impl Send for Gates

§

impl Sync for Gates

§

impl Unpin for Gates

§

impl UnsafeUnpin for Gates

§

impl UnwindSafe for Gates

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.