From e12b1f4459aee80ee333e90e3b56a3b09f81ae3e Mon Sep 17 00:00:00 2001 From: superwhiskers Date: Mon, 15 Sep 2025 13:38:14 -0500 Subject: node topological sorting Change-Id: I6a6a6964255d818be1bf9a8f4ec9e317befa19c5 --- crates/core/src/lib.rs | 114 +++++++++++++++++++++++++------------------------ 1 file changed, 58 insertions(+), 56 deletions(-) (limited to 'crates/core/src/lib.rs') diff --git a/crates/core/src/lib.rs b/crates/core/src/lib.rs index 54c04c5..24b7ac3 100644 --- a/crates/core/src/lib.rs +++ b/crates/core/src/lib.rs @@ -1,67 +1,69 @@ #![cfg_attr(not(test), no_std)] -#![warn( - clippy::cargo_common_metadata, - clippy::dbg_macro, - clippy::needless_pass_by_ref_mut, - clippy::needless_pass_by_value, - clippy::print_stderr, - clippy::print_stdout, - clippy::todo, - clippy::unimplemented -)] -#![deny( - clippy::await_holding_lock, - rustdoc::broken_intra_doc_links, - clippy::cast_lossless, - clippy::clone_on_ref_ptr, - clippy::default_trait_access, - clippy::doc_markdown, - clippy::empty_enum, - clippy::enum_glob_use, - clippy::exit, - clippy::expect_used, - clippy::explicit_deref_methods, - clippy::explicit_into_iter_loop, - clippy::explicit_iter_loop, - clippy::fallible_impl_from, - clippy::filetype_is_file, - clippy::float_cmp, - clippy::float_cmp_const, - clippy::imprecise_flops, - clippy::inefficient_to_string, - clippy::large_digit_groups, - clippy::large_stack_arrays, - clippy::manual_filter_map, - clippy::match_like_matches_macro, - missing_docs, - clippy::missing_errors_doc, - clippy::missing_safety_doc, - clippy::mut_mut, - clippy::option_option, - clippy::panic, - clippy::panic_in_result_fn, - clippy::redundant_clone, - clippy::redundant_else, - clippy::rest_pat_in_fully_bound_structs, - clippy::single_match_else, - clippy::implicit_clone, - trivial_casts, - trivial_numeric_casts, - clippy::undocumented_unsafe_blocks, - clippy::unused_self, - clippy::unwrap_used, - clippy::wildcard_dependencies, - clippy::wildcard_imports -)] #![feature(allocator_api)] #![feature(vec_push_within_capacity)] #![feature(trusted_len)] #![feature(assert_matches)] +#![feature(stmt_expr_attributes)] -//! A highly portable computer algebra system library implemented in Rust +//! A highly portable computer algebra system library implemented in Rust. extern crate alloc; +pub mod egraph; pub mod expressions; -pub mod hive; +pub mod id; pub mod numerics; +pub mod utilities; + +/// Asserts a condition at compile time. +#[macro_export] +macro_rules! static_assert { + ($cond:expr $(,)?) => { + const _: () = { + if !$cond { + panic!(concat!( + "static assertion failed: ", + stringify!($cond), + )); + } + }; + }; + ($cond:expr, $msg:literal $(,)?) => { + const _: () = { + if !$cond { + panic!($msg); + } + }; + }; +} + +/// Asserts equality at compile time. +#[macro_export] +macro_rules! static_assert_eq { + ($a:expr, $b:expr $(,)?) => { + const _: () = { + if $a != $b { + panic!(concat!( + "static assertion failed: ", + stringify!($a), + " == ", + stringify!($b), + )); + } + }; + }; + ($a:expr, $b:expr, $msg:literal $(,)?) => { + const _: () = { + if $a != $b { + panic!(concat!( + "static assertion failed: ", + stringify!($a), + " == ", + stringify!($b), + ": ", + $msg, + )); + } + }; + }; +} -- cgit 1.4.1-2-gfad0