Skip to content

Commit f826bf7

Browse files
committed
add extra bounds for better errors
1 parent 2b7ffb2 commit f826bf7

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

scopegraphs-lib/src/label.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub trait Label {
1313
macro_rules! query_regex {
1414
($label_type:path: $($regex:tt)*) => {
1515
{
16-
scopegraphs_macros::compile_regex!(type QueryRegex<$label_type> = $($regex)*);
16+
$crate::scopegraphs_macros::compile_regex!(type QueryRegex<$label_type> = $($regex)*);
1717
QueryRegex::new()
1818
}
1919
};

scopegraphs-lib/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ pub mod resolve;
66
mod scopegraph;
77

88
pub use scopegraph::*;
9+
pub use scopegraphs_macros;

scopegraphs-lib/src/resolve/mod.rs

+18-4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ use super::{Scope, ScopeGraph};
99

1010
mod params;
1111
pub use params::*;
12+
use scopegraphs_regular_expressions::RegexMatcher;
13+
1214
pub mod lookup;
1315

1416
/// Representation of either a labeled edge or the special 'data' label.
@@ -293,7 +295,10 @@ impl<'sg, 'rslv, LABEL, DATA, CMPL, PWF, DWF, LO, DEq>
293295
pub fn with_path_wellformedness<NPWF>(
294296
self,
295297
new_path_wellformedness: NPWF,
296-
) -> Query<'sg, 'rslv, LABEL, DATA, CMPL, NPWF, DWF, LO, DEq> {
298+
) -> Query<'sg, 'rslv, LABEL, DATA, CMPL, NPWF, DWF, LO, DEq>
299+
where
300+
NPWF: for<'a> RegexMatcher<&'a LABEL> + 'rslv,
301+
{
297302
Query {
298303
_phantom: PhantomData,
299304
scope_graph: self.scope_graph,
@@ -307,7 +312,10 @@ impl<'sg, 'rslv, LABEL, DATA, CMPL, PWF, DWF, LO, DEq>
307312
pub fn with_data_wellformedness<NDWF>(
308313
self,
309314
new_data_wellformedness: NDWF,
310-
) -> Query<'sg, 'rslv, LABEL, DATA, CMPL, PWF, NDWF, LO, DEq> {
315+
) -> Query<'sg, 'rslv, LABEL, DATA, CMPL, PWF, NDWF, LO, DEq>
316+
where
317+
NDWF: DataWellformedness<DATA> + 'rslv,
318+
{
311319
Query {
312320
_phantom: PhantomData,
313321
scope_graph: self.scope_graph,
@@ -321,7 +329,10 @@ impl<'sg, 'rslv, LABEL, DATA, CMPL, PWF, DWF, LO, DEq>
321329
pub fn with_label_order<NLO>(
322330
self,
323331
new_label_order: NLO,
324-
) -> Query<'sg, 'rslv, LABEL, DATA, CMPL, PWF, DWF, NLO, DEq> {
332+
) -> Query<'sg, 'rslv, LABEL, DATA, CMPL, PWF, DWF, NLO, DEq>
333+
where
334+
NLO: LabelOrder<LABEL> + 'rslv,
335+
{
325336
Query {
326337
_phantom: PhantomData,
327338
scope_graph: self.scope_graph,
@@ -335,7 +346,10 @@ impl<'sg, 'rslv, LABEL, DATA, CMPL, PWF, DWF, LO, DEq>
335346
pub fn with_data_equivalence<NDEq>(
336347
self,
337348
new_data_equivalence: NDEq,
338-
) -> Query<'sg, 'rslv, LABEL, DATA, CMPL, PWF, DWF, LO, NDEq> {
349+
) -> Query<'sg, 'rslv, LABEL, DATA, CMPL, PWF, DWF, LO, NDEq>
350+
where
351+
NDEq: DataEquiv<DATA> + 'rslv,
352+
{
339353
Query {
340354
_phantom: PhantomData,
341355
scope_graph: self.scope_graph,

0 commit comments

Comments
 (0)