File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,15 +25,10 @@ trait Double {
2525
2626#[ thrust_macros:: context]
2727impl Double for A {
28- // Write concrete definitions for predicates in `impl` blocks
28+ // self.x * 3 (this isn't actually doubled!) does not comply with the trait.
2929 #[ thrust_macros:: predicate]
3030 fn is_double ( self , doubled : Self ) -> bool {
31- // (tuple_proj<Int>.0 self) is equivalent to self.x
32- // self.x * 3 == doubled.x (this isn't actually doubled!) is written as following:
33- "(=
34- (* (tuple_proj<Int>.0 self_) 3)
35- (tuple_proj<Int>.0 doubled)
36- )" ; true // This definition does not comply with annotations in trait!
31+ self . x * 3 == doubled. x
3732 }
3833
3934 // Check if this method complies with annotations in
Original file line number Diff line number Diff line change @@ -26,11 +26,7 @@ impl thrust_models::Model for A {
2626impl Double for A {
2727 #[ thrust_macros:: predicate]
2828 fn is_double ( self , doubled : Self ) -> bool {
29- // self.x * 2 == doubled.x
30- "(=
31- (* (tuple_proj<Int>.0 self_) 2)
32- (tuple_proj<Int>.0 doubled)
33- )" ; true
29+ self . x * 2 == doubled. x
3430 }
3531
3632 fn double ( & mut self ) {
@@ -50,19 +46,10 @@ impl thrust_models::Model for B {
5046
5147#[ thrust_macros:: context]
5248impl Double for B {
49+ // self.x * 3 (this isn't actually doubled!) does not comply with the trait.
5350 #[ thrust_macros:: predicate]
5451 fn is_double ( self , doubled : Self ) -> bool {
55- // self.x * 3 == doubled.x && self.y * 2 == doubled.y (this isn't actually doubled!)
56- "(and
57- (=
58- (* (tuple_proj<Int-Int>.0 self_) 3)
59- (tuple_proj<Int-Int>.0 doubled)
60- )
61- (=
62- (* (tuple_proj<Int-Int>.1 self_) 2)
63- (tuple_proj<Int-Int>.1 doubled)
64- )
65- )" ; true // This definition does not comply with annotations in trait!
52+ self . x * 3 == doubled. x && self . y * 2 == doubled. y
6653 }
6754
6855 fn double ( & mut self ) {
Original file line number Diff line number Diff line change @@ -25,15 +25,10 @@ trait Double {
2525
2626#[ thrust_macros:: context]
2727impl Double for A {
28- // Write concrete definitions for predicates in `impl` blocks
28+ // Write concrete definitions for predicates in `impl` blocks, in Rust syntax.
2929 #[ thrust_macros:: predicate]
3030 fn is_double ( self , doubled : Self ) -> bool {
31- // (tuple_proj<Int>.0 self) is equivalent to self.x
32- // self.x * 2 == doubled.x is written as following:
33- "(=
34- (* (tuple_proj<Int>.0 self_) 2)
35- (tuple_proj<Int>.0 doubled)
36- )" ; true
31+ self . x * 2 == doubled. x
3732 }
3833
3934 // Check if this method complies with annotations in
Original file line number Diff line number Diff line change @@ -26,11 +26,7 @@ impl thrust_models::Model for A {
2626impl Double for A {
2727 #[ thrust_macros:: predicate]
2828 fn is_double ( self , doubled : Self ) -> bool {
29- // self.x * 2 == doubled.x
30- "(=
31- (* (tuple_proj<Int>.0 self_) 2)
32- (tuple_proj<Int>.0 doubled)
33- )" ; true
29+ self . x * 2 == doubled. x
3430 }
3531
3632 fn double ( & mut self ) {
@@ -52,17 +48,7 @@ impl thrust_models::Model for B {
5248impl Double for B {
5349 #[ thrust_macros:: predicate]
5450 fn is_double ( self , doubled : Self ) -> bool {
55- // self.x * 2 == doubled.x && self.y * 2 == doubled.y
56- "(and
57- (=
58- (* (tuple_proj<Int-Int>.0 self_) 2)
59- (tuple_proj<Int-Int>.0 doubled)
60- )
61- (=
62- (* (tuple_proj<Int-Int>.1 self_) 2)
63- (tuple_proj<Int-Int>.1 doubled)
64- )
65- )" ; true
51+ self . x * 2 == doubled. x && self . y * 2 == doubled. y
6652 }
6753
6854 fn double ( & mut self ) {
You can’t perform that action at this time.
0 commit comments