-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add assert to check if tcx.sess has errors
This checks when trait bounds are introduced if the tcx.session has errors, not sure if this where the problem could come from but might as well look
- Loading branch information
1 parent
d08eb98
commit b134975
Showing
2 changed files
with
30 additions
and
3 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
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,25 @@ | ||
#![feature(const_generics)] | ||
#![allow(incomplete_features)] | ||
|
||
trait If<const COND: bool> {} | ||
impl If<true> for () {} | ||
|
||
trait IsZero<const N: u8> { | ||
type Answer; | ||
} | ||
|
||
struct True; | ||
struct False; | ||
|
||
impl<const N: u8> IsZero<N> for () | ||
where (): If<{N == 0}> { | ||
type Answer = True; | ||
} | ||
|
||
trait Foobar<const N: u8> {} | ||
|
||
impl<const N: u8> Foobar<N> for () | ||
where (): IsZero<N, Answer = True> {} | ||
|
||
impl<const N: u8> Foobar<N> for () | ||
where (): IsZero<N, Answer = False> {} |