Skip to content

Commit

Permalink
Make rustc 1.75 linter happy
Browse files Browse the repository at this point in the history
  • Loading branch information
Sword-Smith committed Jan 2, 2024
1 parent 2d0d75d commit 41225c6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/libraries/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub(crate) fn result_type(ok_type: DataType) -> crate::composite_types::TypeCont
let unwrap_method = unwrap_method(&enum_type);

crate::composite_types::TypeContext {
composite_type: enum_type.try_into().unwrap(),
composite_type: enum_type.into(),
methods: vec![is_ok_method, is_err_method, unwrap_method],
associated_functions: vec![],
}
Expand Down
19 changes: 4 additions & 15 deletions src/tasm_code_generator/data_type/enum_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,8 @@ impl EnumType {

let (field_pointer_pointer, get_variant_data_pointers, subroutines) =
self.get_variant_data_pointers_with_sizes(state);
let pointer_for_words_loaded_acc: u64 = state
.global_compiler_state
.snippet_state
.kmalloc(1)
.try_into()
.unwrap();
let pointer_for_discriminant_pointer: u64 = state
.global_compiler_state
.snippet_state
.kmalloc(1)
.try_into()
.unwrap();
let pointer_for_words_loaded_acc = state.global_compiler_state.snippet_state.kmalloc(1);
let pointer_for_discriminant_pointer = state.global_compiler_state.snippet_state.kmalloc(1);
let get_variant_data_pointers_label = get_variant_data_pointers.get_label();
for sr in [vec![get_variant_data_pointers], subroutines].concat() {
state.add_library_function(sr);
Expand Down Expand Up @@ -216,12 +206,11 @@ impl EnumType {
.unwrap_or_default();

// Allocate two words for each field: field size and field pointer
let field_pointer_pointer: u64 = state
let field_pointer_pointer = state
.global_compiler_state
.snippet_state
.kmalloc(2 * max_field_count as u32)
.try_into()
.unwrap();
.value();

let mut subroutines: Vec<SubRoutine> = vec![];
let mut set_all_field_pointers = vec![];
Expand Down
3 changes: 1 addition & 2 deletions src/tasm_code_generator/data_type/struct_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ impl ast_types::StructType {
.global_compiler_state
.snippet_state
.kmalloc(self.field_count() as u32)
.try_into()
.unwrap();
.value();

let number_of_fields = self.field_count();
for (field_count, (_field_id, field_type)) in
Expand Down
5 changes: 1 addition & 4 deletions src/tasm_code_generator/stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,12 @@ impl VStack {
seek_addr: &ValueIdentifier,
) -> (usize, ast_types::DataType, Option<BFieldElement>) {
let mut position: usize = 0;
for (_i, (found_addr, (data_type, spilled))) in self.inner.iter().rev().enumerate() {
for (found_addr, (data_type, spilled)) in self.inner.iter().rev() {
if seek_addr == found_addr {
return (position, data_type.to_owned(), spilled.to_owned());
}

position += data_type.stack_size();

// By asserting after `+= data_type.size_of()`, we check that the deepest part
// of the sought value is addressable, not just the top part of the value.
}

panic!("Cannot find {seek_addr} on vstack")
Expand Down

0 comments on commit 41225c6

Please sign in to comment.