-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add new tests for const global vars and generic params
- Loading branch information
1 parent
91cfc4a
commit ad14645
Showing
3 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
use compose_idents::compose_idents; | ||
|
||
compose_idents!(my_var = [foo, _, var]; { | ||
const my_var: u32 = 42; | ||
}); | ||
|
||
fn main() { | ||
assert_eq!(foo_var, 42); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
use compose_idents::compose_idents; | ||
|
||
compose_idents!(DATA_LEN = [FOO, _, BAR]; { | ||
fn my_fn<T, const DATA_LEN: usize>(_data: &[T; DATA_LEN]) -> usize { | ||
DATA_LEN | ||
} | ||
}); | ||
|
||
fn main() { | ||
assert_eq!(my_fn(&[1, 2, 3]), 3); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters