Minir typo/Grammar fixes (#6187)

* fix typo

* add test to check that Option<EntityRef> is twice as large as EntityRef

* grammar

* grammar

* reverse snakecase -- Not sure if folks want this type of change
This commit is contained in:
kevaundray
2023-04-10 20:39:25 +01:00
committed by GitHub
parent 435b6894d7
commit 4053ae9e08
6 changed files with 17 additions and 9 deletions

View File

@@ -138,10 +138,10 @@ pub struct DataFlowGraph {
/// Saves Value labels.
pub values_labels: Option<BTreeMap<Value, ValueLabelAssignments>>,
/// Constants used within the function
/// Constants used within the function.
pub constants: ConstantPool,
/// Stores large immediates that otherwise will not fit on InstructionData
/// Stores large immediates that otherwise will not fit on InstructionData.
pub immediates: PrimaryMap<Immediate, ConstantData>,
/// Jump tables used in this function.
@@ -275,12 +275,12 @@ fn resolve_aliases(values: &PrimaryMap<Value, ValueDataPacked>, value: Value) ->
}
}
/// Iterator over all Values in a DFG
/// Iterator over all Values in a DFG.
pub struct Values<'a> {
inner: entity::Iter<'a, Value, ValueDataPacked>,
}
/// Check for non-values
/// Check for non-values.
fn valid_valuedata(data: ValueDataPacked) -> bool {
let data = ValueData::from(data);
if let ValueData::Alias {

View File

@@ -336,7 +336,7 @@ entity_impl!(UserExternalNameRef, "userextname");
/// An opaque reference to a function [`Signature`](super::Signature).
///
/// `SigRef`s are used to declare a function with
/// [`FunctionBuiler::import_function`](https://docs.rs/cranelift-frontend/*/cranelift_frontend/struct.FunctionBuilder.html#method.import_function)
/// [`FunctionBuilder::import_function`](https://docs.rs/cranelift-frontend/*/cranelift_frontend/struct.FunctionBuilder.html#method.import_function)
/// as well as to make an [indirect function call](super::InstBuilder::call_indirect).
///
/// `SigRef`s can be created with
@@ -551,6 +551,14 @@ mod tests {
);
}
#[test]
fn memory_option() {
use core::mem;
// PackedOption is used because Option<EntityRef> is twice as large
// as EntityRef. If this ever fails to be the case, this test will fail.
assert_eq!(mem::size_of::<Value>() * 2, mem::size_of::<Option<Value>>());
}
#[test]
fn constant_with_number() {
assert_eq!(Constant::with_number(0).unwrap().to_string(), "const0");

View File

@@ -230,7 +230,7 @@ impl FunctionStencil {
self.global_values.push(data)
}
/// Find the global dyn_scale value associated with given DynamicType
/// Find the global dyn_scale value associated with given DynamicType.
pub fn get_dyn_scale(&self, ty: DynamicType) -> GlobalValue {
self.dfg.dynamic_types.get(ty).unwrap().dynamic_scale
}

View File

@@ -28,7 +28,7 @@ pub struct JumpTableData {
}
impl JumpTableData {
/// Create a new jump table with the provided blocks
/// Create a new jump table with the provided blocks.
pub fn new(def: BlockCall, table: &[BlockCall]) -> Self {
Self {
table: std::iter::once(def).chain(table.iter().copied()).collect(),

View File

@@ -375,7 +375,7 @@ impl Layout {
}
/// A single node in the linked-list of blocks.
// Whenever you add new fields here, don't forget to update the custom serializer for `Layout` too.
// **Note:** Whenever you add new fields here, don't forget to update the custom serializer for `Layout` too.
#[derive(Clone, Debug, Default, PartialEq, Hash)]
struct BlockNode {
prev: PackedOption<Block>,

View File

@@ -89,7 +89,7 @@ pub struct ValueLabelStart {
pub label: ValueLabel,
}
/// Value label assignements: label starts or value aliases.
/// Value label assignments: label starts or value aliases.
#[derive(Debug, Clone, PartialEq, Hash)]
#[cfg_attr(feature = "enable-serde", derive(Serialize, Deserialize))]
pub enum ValueLabelAssignments {