Implement abstractions over Structs and NDArray #554

Merged
sb10q merged 16 commits from ndstrides-neo into master 2024-11-21 18:16:28 +08:00
9 changed files with 21 additions and 65 deletions
Showing only changes of commit 2822074b2d - Show all commits

View File

@ -1,10 +1,4 @@
#![deny(
future_incompatible,
let_underscore,
nonstandard_style,
clippy::all
)]
#![warn(rust_2024_compatibility)]
#![deny(future_incompatible, let_underscore, nonstandard_style, clippy::all)]
#![warn(clippy::pedantic)]
#![allow(
unsafe_op_in_unsafe_fn,
@ -741,7 +735,7 @@ impl Nac3 {
};
let return_obj =
generator.gen_expr(ctx, &expr)?.map(|value| (expr.custom.unwrap(), value));
generator.gen_expr(ctx, expr)?.map(|value| (expr.custom.unwrap(), value));
has_return = return_obj.is_some();
registry.wait_tasks_complete(handles);
attributes_writeback(
@ -765,7 +759,7 @@ impl Nac3 {
let buffers = membuffers.lock();
let main = context
.create_module_from_ir(MemoryBuffer::create_from_memory_range(
&buffers.last().unwrap(),
buffers.last().unwrap(),
"main",
))
.unwrap();

View File

@ -1,10 +1,4 @@
#![deny(
future_incompatible,
let_underscore,
nonstandard_style,
clippy::all
)]
#![warn(rust_2024_compatibility)]
#![deny(future_incompatible, let_underscore, nonstandard_style, clippy::all)]
#![warn(clippy::pedantic)]
#![allow(
clippy::missing_errors_doc,

View File

@ -56,9 +56,8 @@ fn main() {
let output = Command::new("clang-irrt")
.args(flags)
.output()
.map(|o| {
.inspect(|o| {
assert!(o.status.success(), "{}", std::str::from_utf8(&o.stderr).unwrap());
o
})
.unwrap();

View File

@ -1,10 +1,4 @@
#![deny(
future_incompatible,
let_underscore,
nonstandard_style,
clippy::all
)]
#![warn(rust_2024_compatibility)]
#![deny(future_incompatible, let_underscore, nonstandard_style, clippy::all)]
#![warn(clippy::pedantic)]
#![allow(
dead_code,

View File

@ -536,9 +536,8 @@ impl<'a> Fold<()> for Inferencer<'a> {
}
ast::StmtKind::Assert { test, msg, .. } => {
self.unify(test.custom.unwrap(), self.primitives.bool, &test.location)?;
match msg {
Some(m) => self.unify(m.custom.unwrap(), self.primitives.str, &m.location)?,
None => (),
if let Some(m) = msg {
self.unify(m.custom.unwrap(), self.primitives.str, &m.location)?;
}
}
_ => return report_error("Unsupported statement type", stmt.location),

View File

@ -1,10 +1,4 @@
#![deny(
future_incompatible,
let_underscore,
nonstandard_style,
clippy::all
)]
#![warn(rust_2024_compatibility)]
#![deny(future_incompatible, let_underscore, nonstandard_style, clippy::all)]
#![warn(clippy::pedantic)]
#![allow(
clippy::cast_possible_truncation,

View File

@ -15,13 +15,7 @@
//!
//! ```
#![deny(
future_incompatible,
let_underscore,
nonstandard_style,
clippy::all
)]
#![warn(rust_2024_compatibility)]
#![deny(future_incompatible, let_underscore, nonstandard_style, clippy::all)]
#![warn(clippy::pedantic)]
#![allow(
clippy::enum_glob_use,

View File

@ -1,10 +1,4 @@
#![deny(
future_incompatible,
let_underscore,
nonstandard_style,
clippy::all
)]
#![warn(rust_2024_compatibility)]
#![deny(future_incompatible, let_underscore, nonstandard_style, clippy::all)]
#![warn(clippy::pedantic)]
#![allow(clippy::too_many_lines, clippy::wildcard_imports)]

View File

@ -1,10 +1,4 @@
#![deny(
future_incompatible,
let_underscore,
nonstandard_style,
clippy::all
)]
#![warn(rust_2024_compatibility)]
#![deny(future_incompatible, let_underscore, nonstandard_style, clippy::all)]
#![warn(clippy::pedantic)]
#![allow(clippy::semicolon_if_nothing_returned, clippy::uninlined_format_args)]
@ -12,47 +6,47 @@ use std::env;
static mut NOW: i64 = 0;
#[no_mangle]
#[unsafe(no_mangle)]
pub extern "C" fn now_mu() -> i64 {
unsafe { NOW }
}
#[no_mangle]
#[unsafe(no_mangle)]
pub extern "C" fn at_mu(t: i64) {
unsafe { NOW = t }
}
#[no_mangle]
#[unsafe(no_mangle)]
pub extern "C" fn delay_mu(dt: i64) {
unsafe { NOW += dt }
}
#[no_mangle]
#[unsafe(no_mangle)]
pub extern "C" fn rtio_init() {
println!("rtio_init");
}
#[no_mangle]
#[unsafe(no_mangle)]
pub extern "C" fn rtio_get_counter() -> i64 {
0
}
#[no_mangle]
#[unsafe(no_mangle)]
pub extern "C" fn rtio_output(target: i32, data: i32) {
println!("rtio_output @{} target={target:04x} data={data}", unsafe { NOW });
}
#[no_mangle]
#[unsafe(no_mangle)]
pub extern "C" fn print_int32(x: i32) {
println!("print_int32: {x}");
}
#[no_mangle]
#[unsafe(no_mangle)]
pub extern "C" fn print_int64(x: i64) {
println!("print_int64: {x}");
}
#[no_mangle]
#[unsafe(no_mangle)]
pub extern "C" fn __nac3_personality(_state: u32, _exception_object: u32, _context: u32) -> u32 {
unimplemented!();
}