Struct rustc_middle::ty::list::List[][src]

#[repr(C)]
pub struct List<T> { len: usize, data: [T; 0], opaque: OpaqueListContents, }
Expand description

A wrapper for slices with the additional invariant that the slice is interned and no other slice with the same contents can exist in the same context. This means we can use pointer for both equality comparisons and hashing.

Unlike slices, the types contained in List are expected to be Copy and iterating over a List returns T instead of a reference.

Note: Slice was already taken by the Ty.

Fields

len: usizedata: [T; 0]opaque: OpaqueListContents

Implementations

Interpret these substitutions as the substitutions of a closure type. Closure substitutions have a particular structure controlled by the compiler that encodes information like the signature and closure kind; see ty::ClosureSubsts struct for more comments.

Interpret these substitutions as the substitutions of a generator type. Generator substitutions have a particular structure controlled by the compiler that encodes information like the signature and generator kind; see ty::GeneratorSubsts struct for more comments.

Creates an InternalSubsts that maps each generic parameter to itself.

Creates an InternalSubsts for generic parameter definitions, by calling closures to obtain each kind. The closures get to observe the InternalSubsts as they’re being built, which can be used to correctly substitute defaults of generic parameters.

Transform from substitutions for a child of source_ancestor (e.g., a trait or impl) to substitutions for the same child in a different item, with target_substs as the base for the target impl/trait, with the source child-specific parameters (e.g., method parameters) on top of that base.

For example given:

trait X<S> { fn f<T>(); }
impl<U> X<U> for U { fn f<V>() {} }
  • If self is [Self, S, T]: the identity substs of f in the trait.
  • If source_ancestor is the def_id of the trait.
  • If target_substs is [U], the substs for the impl.
  • Then we will return [U, T], the subst for f in the impl that are needed for it to match the trait.

Returns the “principal DefId” of this set of existential predicates.

A Rust trait object type consists (in addition to a lifetime bound) of a set of trait bounds, which are separated into any number of auto-trait bounds, and at most one non-auto-trait bound. The non-auto-trait bound is called the “principal” of the trait object.

Only the principal can have methods or type parameters (because auto traits can have neither of them). This is important, because it means the auto traits can be treated as an unordered set (methods would force an order for the vtable, while relating traits with type parameters without knowing the order to relate them in is a rather non-trivial task).

For example, in the trait object dyn fmt::Debug + Sync, the principal bound is Some(fmt::Debug), while the auto-trait bounds are the set {Sync}.

It is also possible to have a “trivial” trait object that consists only of auto traits, with no principal - for example, dyn Send + Sync. In that case, the set of auto-trait bounds is {Send, Sync}, while there is no principal. These trait objects have a “trivial” vtable consisting of just the size, alignment, and destructor.

Trait Implementations

Performs the conversion.

Formats the value using the given formatter. Read more

The resulting type after dereferencing.

Dereferences the value.

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

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

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Most likely the value you want to use here is the following, unless your Pointee type is unsized (e.g., ty::List<T> in rustc) in which case you’ll need to manually figure out what the right type to pass to align_of is. Read more

Safety Read more

This provides a reference to the Pointer itself, rather than the Deref::Target. It is used for cases where we want to call methods that may be implement differently for the Pointer than the Pointee (e.g., Rc::clone vs cloning the inner value). Read more

Returns true if self has any late-bound regions that are either bound by binder or bound by some binder outside of binder. If binder is ty::INNERMOST, this indicates whether there are any late-bound regions that appear free. Read more

Returns true if this self has any regions that escape binder (and hence are not bound by it). Read more

“Free” regions in this context means that it has any region that is not (a) erased or (b) late-bound. Read more

True if there are any un-erased free regions.

Indicates whether this value definitely references only ‘global’ generic parameters that are the same regardless of what fn we are in. This is used for caching. Read more

Indicates whether this value references only ‘global’ generic parameters that are the same regardless of what fn we are in. This is used for caching. Read more

True if there are any late-bound regions

Indicates whether this value still has parameters/placeholders/inference variables which could be replaced later, in a way that would change the results of impl specialization. Read more

Returns true if self has any late-bound regions that are either bound by binder or bound by some binder outside of binder. If binder is ty::INNERMOST, this indicates whether there are any late-bound regions that appear free. Read more

Returns true if this self has any regions that escape binder (and hence are not bound by it). Read more

“Free” regions in this context means that it has any region that is not (a) erased or (b) late-bound. Read more

True if there are any un-erased free regions.

Indicates whether this value definitely references only ‘global’ generic parameters that are the same regardless of what fn we are in. This is used for caching. Read more

Indicates whether this value references only ‘global’ generic parameters that are the same regardless of what fn we are in. This is used for caching. Read more

True if there are any late-bound regions

Indicates whether this value still has parameters/placeholders/inference variables which could be replaced later, in a way that would change the results of impl specialization. Read more

Returns true if self has any late-bound regions that are either bound by binder or bound by some binder outside of binder. If binder is ty::INNERMOST, this indicates whether there are any late-bound regions that appear free. Read more

Returns true if this self has any regions that escape binder (and hence are not bound by it). Read more

“Free” regions in this context means that it has any region that is not (a) erased or (b) late-bound. Read more

True if there are any un-erased free regions.

Indicates whether this value definitely references only ‘global’ generic parameters that are the same regardless of what fn we are in. This is used for caching. Read more

Indicates whether this value references only ‘global’ generic parameters that are the same regardless of what fn we are in. This is used for caching. Read more

True if there are any late-bound regions

Indicates whether this value still has parameters/placeholders/inference variables which could be replaced later, in a way that would change the results of impl specialization. Read more

Returns true if self has any late-bound regions that are either bound by binder or bound by some binder outside of binder. If binder is ty::INNERMOST, this indicates whether there are any late-bound regions that appear free. Read more

Returns true if this self has any regions that escape binder (and hence are not bound by it). Read more

“Free” regions in this context means that it has any region that is not (a) erased or (b) late-bound. Read more

True if there are any un-erased free regions.

Indicates whether this value definitely references only ‘global’ generic parameters that are the same regardless of what fn we are in. This is used for caching. Read more

Indicates whether this value references only ‘global’ generic parameters that are the same regardless of what fn we are in. This is used for caching. Read more

True if there are any late-bound regions

Indicates whether this value still has parameters/placeholders/inference variables which could be replaced later, in a way that would change the results of impl specialization. Read more

Returns true if self has any late-bound regions that are either bound by binder or bound by some binder outside of binder. If binder is ty::INNERMOST, this indicates whether there are any late-bound regions that appear free. Read more

Returns true if this self has any regions that escape binder (and hence are not bound by it). Read more

“Free” regions in this context means that it has any region that is not (a) erased or (b) late-bound. Read more

True if there are any un-erased free regions.

Indicates whether this value definitely references only ‘global’ generic parameters that are the same regardless of what fn we are in. This is used for caching. Read more

Indicates whether this value references only ‘global’ generic parameters that are the same regardless of what fn we are in. This is used for caching. Read more

True if there are any late-bound regions

Indicates whether this value still has parameters/placeholders/inference variables which could be replaced later, in a way that would change the results of impl specialization. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Layout

Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.