Skip to content

Commit

Permalink
chore: rust 2024
Browse files Browse the repository at this point in the history
  • Loading branch information
MilkeeyCat committed Feb 21, 2025
1 parent 16622b6 commit 814bad9
Show file tree
Hide file tree
Showing 17 changed files with 22 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "meraki"
version = "0.1.0"
edition = "2021"
edition = "2024"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
2 changes: 1 addition & 1 deletion src/ast/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::lexer::{span::Span, Token, TokenKind};
use crate::lexer::{Token, TokenKind, span::Span};
use derive_more::derive::Display;
use thiserror::Error;

Expand Down
2 changes: 1 addition & 1 deletion src/codegen/amd64_asm/allocator.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use super::{register::Register, OperandSize};
use super::{OperandSize, register::Register};
use thiserror::Error;

#[derive(Error, Debug)]
Expand Down
2 changes: 1 addition & 1 deletion src/codegen/amd64_asm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ mod register;

use super::Codegen;
use crate::{
Context,
ast::{BinOp, BitwiseOp, CmpOp, IntTy, OpParseError, UintTy, UnOp},
ir::{Block, Expr, ExprKind, ExprLit, Id, Item, ItemFn, Node, Stmt, Ty, Variable},
Context,
};
use allocator::RegisterAllocator;
use derive_more::derive::Display;
Expand Down
2 changes: 1 addition & 1 deletion src/codegen/amd64_asm/operand.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use super::{register::Register, OperandSize};
use super::{OperandSize, register::Register};
use crate::ir::ExprLit;
use derive_more::derive::Display;
use thiserror::Error;
Expand Down
2 changes: 1 addition & 1 deletion src/codegen/amd64_asm/register.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::{
operand::{Base, Destination, EffectiveAddress, Offset, Source},
OperandSize,
operand::{Base, Destination, EffectiveAddress, Offset, Source},
};
use derive_more::derive::Display;

Expand Down
5 changes: 3 additions & 2 deletions src/compile.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
use crate::{
codegen::{amd64_asm::Amd64Asm, Codegen},
Context,
codegen::{Codegen, amd64_asm::Amd64Asm},
diagnostics::Diagnostics,
lexer::Lexer,
lowering::Lowering,
parser, Context,
parser,
};
use bumpalo::Bump;
use clap::Parser;
Expand Down
2 changes: 1 addition & 1 deletion src/diagnostics.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::lexer::{span::Span, TokenKind};
use crate::lexer::{TokenKind, span::Span};
use derive_more::derive::Display;

#[derive(Debug, Display)]
Expand Down
2 changes: 1 addition & 1 deletion src/ir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ impl<'ir> Ir<'ir> {
self.globals = globals;
}

pub fn iter_items(&self) -> impl Iterator<Item = Item<'ir>> {
pub fn iter_items(&self) -> impl Iterator<Item = Item<'ir>> + use<'ir> {
self.globals
.iter()
.map(|global| match global.0[0] {
Expand Down
7 changes: 4 additions & 3 deletions src/lowering/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
mod scopes;

use crate::{
Context,
ast::{self, BinOp, IntTy, Item, UintTy, UnOp, Variable},
ir::{self, Id, OrderedMap, Stmt},
ty_problem, Context,
ty_problem,
};
use scopes::Scopes;
use std::collections::HashMap;
Expand Down Expand Up @@ -389,7 +390,7 @@ impl<'a, 'ir> Lowering<'a, 'ir> {
ast::UintTy::U64 => self.ctx.allocator.alloc(ir::Ty::UInt(UintTy::U64)),
ast::UintTy::Usize => self.ctx.allocator.alloc(ir::Ty::UInt(UintTy::Usize)),
},
ast::Ty::Ptr(ref ty) => self
ast::Ty::Ptr(ty) => self
.ctx
.allocator
.alloc(ir::Ty::Ptr(self.lower_ty(*ty.clone()))),
Expand All @@ -399,7 +400,7 @@ impl<'a, 'ir> Lowering<'a, 'ir> {
ty: self.lower_ty(*ty.clone()),
}))
}
ast::Ty::Fn(ref params, ref ret_ty) => {
ast::Ty::Fn(params, ret_ty) => {
let mut alloced_params = Vec::new();

for ty in params {
Expand Down
2 changes: 1 addition & 1 deletion src/macros/macros.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::lexer;
use libloading::Symbol;
use std::ffi::{c_char, CStr, CString};
use std::ffi::{CStr, CString, c_char};

#[repr(C)]
#[derive(Debug)]
Expand Down
2 changes: 1 addition & 1 deletion src/macros/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
mod macros;

pub use macros::{symbol_to_macros, Macro, MacroFn, Slice, Token};
pub use macros::{Macro, MacroFn, Slice, Token, symbol_to_macros};
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use clap::Parser;
use meraki::compile::{compile, CompileArgs};
use meraki::compile::{CompileArgs, compile};

fn main() {
let options = CompileArgs::parse();
Expand Down
2 changes: 1 addition & 1 deletion src/parser/diagnostics.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use super::Parser;
use crate::{
diagnostics::Diagnostic,
lexer::{span::Span, Token, TokenKind},
lexer::{Token, TokenKind, span::Span},
};

impl<'a, 'src, T: Iterator<Item = Result<Token, Span>>> Parser<'a, 'src, T> {
Expand Down
2 changes: 1 addition & 1 deletion src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pub use precedence::Precedence;
use crate::{
ast::{BinOp, Block, Expr, ExprKind, ExprLit, IntTy, Item, Stmt, Ty, UintTy, UnOp, Variable},
diagnostics::{Diagnostic, Diagnostics},
lexer::{span::Span, Token, TokenKind},
lexer::{Token, TokenKind, span::Span},
};
use std::collections::HashMap;

Expand Down
2 changes: 1 addition & 1 deletion src/ty_problem/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{
Context,
ast::IntTy,
ir::{Ir, Item, Node, OrderedMap, Ty},
Context,
};

#[derive(Debug, Clone, Copy, PartialEq)]
Expand Down
2 changes: 1 addition & 1 deletion tests/meraki/run.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use meraki::compile::{compile, CompileArgs};
use meraki::compile::{CompileArgs, compile};
use std::{path::Path, process::Output};

pub fn run(path: &Path) -> std::io::Result<Output> {
Expand Down

0 comments on commit 814bad9

Please sign in to comment.