Skip to content

Commit

Permalink
Add test of literal in const generic path argument
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Feb 19, 2022
1 parent 23a7fd5 commit 91b027e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/test_ensure.rs
Expand Up @@ -324,6 +324,14 @@ fn test_path() {
"Condition failed: `Chain::<'static>::new.t(1) == 2` (1 vs 2)",
);

fn f<const I: isize>() {}
let test = || Ok(ensure!(f::<1>() != ()));
assert_err(test, "Condition failed: `f::<1>() != ()` (() vs ())");

fn g<T, const I: isize>() {}
let test = || Ok(ensure!(g::<u8, 1>() != ()));
assert_err(test, "Condition failed: `g::<u8, 1>() != ()` (() vs ())");

#[derive(PartialOrd, PartialEq, Debug)]
enum E<'a, T> {
#[allow(dead_code)]
Expand Down

0 comments on commit 91b027e

Please sign in to comment.