Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions libs/@local/hashql/diagnostics/src/diagnostic/label.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,39 @@ impl<S> Labels<S> {
}
}

/// Returns the number of labels in the collection.
///
/// # Examples
///
/// ```
/// use hashql_diagnostics::{Label, diagnostic::Labels};
///
/// let mut labels = Labels::new(Label::new(0..5, "primary"));
/// labels.push(Label::new(10..15, "secondary"));
///
/// assert_eq!(labels.len(), 2);
/// ```
#[must_use]
pub const fn len(&self) -> usize {
self.labels.len()
}

/// Returns `true` if the collection contains no labels.
///
/// # Examples
///
/// ```
/// use hashql_diagnostics::{Label, diagnostic::Labels};
///
/// let labels = Labels::new(Label::new(0..5, "primary"));
///
/// assert!(!labels.is_empty());
/// ```
#[must_use]
pub const fn is_empty(&self) -> bool {
self.labels.is_empty()
}

/// Adds a secondary label to the collection.
///
/// All labels added via this method become secondary labels, which have the purpose of
Expand Down
2 changes: 1 addition & 1 deletion libs/@local/hashql/eval/src/postgres/filter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ impl<'ctx, 'heap, A: Allocator, S: Allocator> GraphReadFilterCompiler<'ctx, 'hea
constant: &Constant<'heap>,
) -> Expression {
match constant {
Constant::Int(int) if let Some(uint) = int.as_u32() => {
Constant::Int(int) if let Ok(uint) = u32::try_from(int.as_uint()) => {
Expression::Constant(query::Constant::U32(uint))
}
&Constant::Int(int) => db.parameters.int(int).into(),
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 5 additions & 9 deletions libs/@local/hashql/mir/benches/interpret.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use alloc::alloc::Global;

use codspeed_criterion_compat::{BenchmarkId, Criterion, criterion_group, criterion_main};
use hashql_core::{
collections::FastHashMap,
heap::{ResetAllocator as _, Scratch},
r#type::environment::Environment,
};
Expand All @@ -22,7 +21,7 @@ use hashql_mir::{
def::{DefId, DefIdSlice},
intern::Interner,
interpret::{
CallStack, Runtime, RuntimeConfig,
CallStack, Inputs, Runtime, RuntimeConfig,
value::{Int, Value},
},
pass::{
Expand Down Expand Up @@ -93,17 +92,14 @@ fn fibonacci_recursive(criterion: &mut Criterion) {
run_bencher(bencher, create_fibonacci_body, |_, bodies, scratch| {
let scratch = &*scratch;
let bodies = DefIdSlice::from_raw(bodies);
let inputs = Inputs::new_in(scratch);

let mut runtime = Runtime::new_in(
RuntimeConfig::default(),
bodies,
FastHashMap::default(),
scratch,
);
let mut runtime =
Runtime::new_in(RuntimeConfig::default(), bodies, &inputs, scratch);
let callstack =
CallStack::new(&runtime, DefId::new(0), [Value::Integer(Int::from(*n))]);

let Ok(Value::Integer(int)) = runtime.run(callstack) else {
let Ok(Value::Integer(int)) = runtime.run(callstack, |_| unreachable!()) else {
unreachable!()
};

Expand Down
2 changes: 1 addition & 1 deletion libs/@local/hashql/mir/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"fix:clippy": "just clippy --fix",
"lint:clippy": "just clippy",
"test:codspeed": "cargo codspeed run -p hashql-mir",
"test:miri": "cargo miri nextest run -- changed_bitor interpret::locals::tests pass::execution::block_partitioned_vec::tests pass::execution::cost::tests",
"test:miri": "cargo miri nextest run -- changed_bitor interpret::locals::tests interpret::value::r#struct::tests pass::execution::block_partitioned_vec::tests pass::execution::cost::tests",
"test:unit": "mise run test:unit @rust/hashql-mir"
},
"dependencies": {
Expand Down
Loading
Loading