pub enum Conversion {
Lvalue,
ArrayDecay,
FunctionDecay,
Arithmetic,
Pointer,
Bool,
NullPointer,
Void,
Broadcast,
}Expand description
A conversion the language performs without being asked.
Each of these is a node in the tree rather than a difference between two types that a later
pass notices. The IR builder is entitled to assume it never has to insert one, and the
verifier in spec/08-ir.md checks that assumption on every function.
Variants§
Lvalue
Reading an object, which drops the qualifiers and turns an lvalue into a value.
ArrayDecay
An array becoming a pointer to its first element.
FunctionDecay
A function becoming a pointer to itself.
Arithmetic
One arithmetic type to another. The integer promotions, the usual arithmetic conversions, and the conversions an assignment or an argument performs are all this.
Pointer
A pointer to another pointer type, which includes both directions of void *.
Bool
A scalar to bool, which is a comparison against zero rather than a truncation, and
which is why it is not Conversion::Arithmetic.
NullPointer
A null pointer constant becoming a pointer, which is not the same as converting the
integer zero, because the constant may have any integer type and (void *)0 is one.
Void
A value being discarded, which is what a cast to void and an expression statement do.
Broadcast
A scalar becoming a vector, by being copied into every lane of it.
Written where a scalar stands beside a vector in an operator, which GNU C reads as that
scalar in every lane. It is not Conversion::Arithmetic because the lane type and the
scalar’s type are already the same by the time this is reached: the narrowing that a
lane asks for is an arithmetic conversion of its own underneath this one, so that the
two questions are answered where each of them is usually answered.
Implementations§
Trait Implementations§
Source§impl Clone for Conversion
impl Clone for Conversion
Source§fn clone(&self) -> Conversion
fn clone(&self) -> Conversion
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more