Skip to content

Commit c8f54f5

Browse files
committed
SerFunction: remove trailing newline in attrs field
close #69
1 parent 2a1c22c commit c8f54f5

24 files changed

+125
-125
lines changed

src/functions/serialization.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ impl SerFunction {
2727
pub fn new(fun: super::Function) -> Self {
2828
let inst = fun.instance;
2929
let def_id = format_def_id(&inst);
30-
let attrs: Vec<_> = fun.attrs.iter().map(|a| a.as_str().to_owned()).collect();
30+
let attrs: Vec<_> = fun.attrs.iter().map(|a| a.as_str().trim().to_owned()).collect();
3131
let kind = Kind::new(&attrs);
3232
// Though this is from body span, fn name and signature are included.
3333
let func = cache::get_source_code(&inst).unwrap_or_default();

tests/simplified/ad_hoc.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[
22
{
3-
"hash": "1169127772433107051910762480258862721704",
3+
"hash": "1229614748721749766913964449194572207950",
44
"attrs": [
5-
"#[kanitool::proof]\n"
5+
"#[kanitool::proof]"
66
],
77
"name": "adhoc::callee_defined_in_proof",
88
"file": "tests/proofs/ad_hoc.rs",
@@ -13,9 +13,9 @@
1313
]
1414
},
1515
{
16-
"hash": "45356353433292067411028081932824047592",
16+
"hash": "16071192516234258013908867822141086841",
1717
"attrs": [
18-
"#[kanitool::proof]\n"
18+
"#[kanitool::proof]"
1919
],
2020
"name": "adhoc::closure_in_proof",
2121
"file": "tests/proofs/ad_hoc.rs",
@@ -26,9 +26,9 @@
2626
]
2727
},
2828
{
29-
"hash": "376713398218856890112497690805164100930",
29+
"hash": "1315335617907881608515688324687253173446",
3030
"attrs": [
31-
"#[kanitool::proof]\n"
31+
"#[kanitool::proof]"
3232
],
3333
"name": "adhoc::proof_in_fn_item::proof",
3434
"file": "tests/proofs/ad_hoc.rs",

tests/simplified/gen_contracts_by_macros.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[
22
{
3-
"hash": "1464226525610256308612646858567537187198",
3+
"hash": "775265515052998156911238326129260793147",
44
"attrs": [
5-
"#[kanitool::proof_for_contract = \"contract1\"]\n"
5+
"#[kanitool::proof_for_contract = \"contract1\"]"
66
],
77
"name": "verify::proof1",
88
"file": "tests/proofs/gen_contracts_by_macros.rs",
@@ -262,9 +262,9 @@
262262
]
263263
},
264264
{
265-
"hash": "1102522625469360326811087974940169982141",
265+
"hash": "462859955844485637210180569593584318282",
266266
"attrs": [
267-
"#[kanitool::proof_for_contract = \"contract2\"]\n"
267+
"#[kanitool::proof_for_contract = \"contract2\"]"
268268
],
269269
"name": "verify::proof2",
270270
"file": "tests/proofs/gen_contracts_by_macros.rs",
@@ -524,9 +524,9 @@
524524
]
525525
},
526526
{
527-
"hash": "1775778566579290701410350421249473944550",
527+
"hash": "349265479360865536512022356632514339222",
528528
"attrs": [
529-
"#[kanitool::proof_for_contract = \"contract3\"]\n"
529+
"#[kanitool::proof_for_contract = \"contract3\"]"
530530
],
531531
"name": "verify::proof3",
532532
"file": "tests/proofs/gen_contracts_by_macros.rs",

tests/simplified/gen_proofs_by_macros.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[
22
{
3-
"hash": "1062562354670908564515699502517567470958",
3+
"hash": "621627085399168861817335896579039857609",
44
"attrs": [
5-
"#[kanitool::proof]\n"
5+
"#[kanitool::proof]"
66
],
77
"name": "verify::proof1",
88
"file": "tests/proofs/gen_proofs_by_macros.rs",
@@ -17,9 +17,9 @@
1717
]
1818
},
1919
{
20-
"hash": "164719725483480922244888053500348595462",
20+
"hash": "1057391189656170612910810424020292617315",
2121
"attrs": [
22-
"#[kanitool::proof]\n"
22+
"#[kanitool::proof]"
2323
],
2424
"name": "verify::proof2",
2525
"file": "tests/proofs/gen_proofs_by_macros.rs",
@@ -34,9 +34,9 @@
3434
]
3535
},
3636
{
37-
"hash": "534107120703765166610302713019419672799",
37+
"hash": "833388606508419100814630708153653821669",
3838
"attrs": [
39-
"#[kanitool::proof]\n"
39+
"#[kanitool::proof]"
4040
],
4141
"name": "verify::proof3",
4242
"file": "tests/proofs/gen_proofs_by_macros.rs",

tests/simplified/gen_proofs_by_nested_macros.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[
22
{
3-
"hash": "3073259831460681588375589925778396300",
3+
"hash": "726324090505156787311996482945835624445",
44
"attrs": [
5-
"#[kanitool::proof]\n"
5+
"#[kanitool::proof]"
66
],
77
"name": "verify::proof1",
88
"file": "tests/proofs/gen_proofs_by_nested_macros.rs",
@@ -17,9 +17,9 @@
1717
]
1818
},
1919
{
20-
"hash": "152878430041654804275051652568797552311",
20+
"hash": "43377569323293982678258661144821303728",
2121
"attrs": [
22-
"#[kanitool::proof]\n"
22+
"#[kanitool::proof]"
2323
],
2424
"name": "verify::proof2",
2525
"file": "tests/proofs/gen_proofs_by_nested_macros.rs",
@@ -34,9 +34,9 @@
3434
]
3535
},
3636
{
37-
"hash": "6758469002032171839668434863697666109",
37+
"hash": "79822416331020354410869048540304473445",
3838
"attrs": [
39-
"#[kanitool::proof]\n"
39+
"#[kanitool::proof]"
4040
],
4141
"name": "verify::proof3",
4242
"file": "tests/proofs/gen_proofs_by_nested_macros.rs",

tests/simplified/proofs_for_contract.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[
22
{
3-
"hash": "851605916363413882314526040400676270777",
3+
"hash": "1016061592544200302417250586290073911961",
44
"attrs": [
5-
"#[kanitool::proof_for_contract = \"contract\"]\n"
5+
"#[kanitool::proof_for_contract = \"contract\"]"
66
],
77
"name": "verify::single_contract",
88
"file": "tests/proofs/proofs_for_contract.rs",
@@ -258,9 +258,9 @@
258258
]
259259
},
260260
{
261-
"hash": "145246863610834819409708449810608066801",
261+
"hash": "700500219129831863416867412333651827717",
262262
"attrs": [
263-
"#[kanitool::proof_for_contract = \"contract_requires\"]\n"
263+
"#[kanitool::proof_for_contract = \"contract_requires\"]"
264264
],
265265
"name": "verify::single_contract_requires",
266266
"file": "tests/proofs/proofs_for_contract.rs",
@@ -515,9 +515,9 @@
515515
]
516516
},
517517
{
518-
"hash": "129440081802376421165426716140458600342",
518+
"hash": "1553804057268979798715912432476145008061",
519519
"attrs": [
520-
"#[kanitool::proof_for_contract = \"contract_ensures\"]\n"
520+
"#[kanitool::proof_for_contract = \"contract_ensures\"]"
521521
],
522522
"name": "verify::single_with_contract_ensures",
523523
"file": "tests/proofs/proofs_for_contract.rs",
@@ -772,9 +772,9 @@
772772
]
773773
},
774774
{
775-
"hash": "431936899498053344615635331878804832703",
775+
"hash": "1357685337012006638712573238406990638518",
776776
"attrs": [
777-
"#[kanitool::proof_for_contract = \"contract_requires\"]\n"
777+
"#[kanitool::proof_for_contract = \"contract_requires\"]"
778778
],
779779
"name": "verify::two_contracts_requires_and_ensures",
780780
"file": "tests/proofs/proofs_for_contract.rs",

tests/simplified/standard_proofs.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[
22
{
3-
"hash": "144395511941586929151010429962703469548",
3+
"hash": "133522091698482324913445025389957424582",
44
"attrs": [
5-
"#[kanitool::proof]\n"
5+
"#[kanitool::proof]"
66
],
77
"name": "verify::recursive_callees",
88
"file": "tests/proofs/standard_proofs.rs",
@@ -118,9 +118,9 @@
118118
]
119119
},
120120
{
121-
"hash": "1669482096648313876110327135750958490805",
121+
"hash": "840119249342052595317999269538187253072",
122122
"attrs": [
123-
"#[kanitool::proof]\n"
123+
"#[kanitool::proof]"
124124
],
125125
"name": "verify::standard_proof",
126126
"file": "tests/proofs/standard_proofs.rs",
@@ -135,9 +135,9 @@
135135
]
136136
},
137137
{
138-
"hash": "60301832969373045482782897484755767177",
138+
"hash": "12955202483297788019685504065104068987",
139139
"attrs": [
140-
"#[kanitool::proof]\n"
140+
"#[kanitool::proof]"
141141
],
142142
"name": "verify::standard_proof_empty",
143143
"file": "tests/proofs/standard_proofs.rs",

tests/simplified/standard_proofs_with_contracts.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[
22
{
3-
"hash": "180058511827000187034931936121000158434",
3+
"hash": "1675321767144373605018067837826152892819",
44
"attrs": [
5-
"#[kanitool::proof]\n"
5+
"#[kanitool::proof]"
66
],
77
"name": "verify::single_contract",
88
"file": "tests/proofs/standard_proofs_with_contracts.rs",
@@ -257,9 +257,9 @@
257257
]
258258
},
259259
{
260-
"hash": "1557490122580475452217724025495173148638",
260+
"hash": "101835639787005562175359912759350554059",
261261
"attrs": [
262-
"#[kanitool::proof]\n"
262+
"#[kanitool::proof]"
263263
],
264264
"name": "verify::single_contract_requires",
265265
"file": "tests/proofs/standard_proofs_with_contracts.rs",
@@ -513,9 +513,9 @@
513513
]
514514
},
515515
{
516-
"hash": "23933860994661289136622421249446475486",
516+
"hash": "110616922198289136304184217911503407204",
517517
"attrs": [
518-
"#[kanitool::proof]\n"
518+
"#[kanitool::proof]"
519519
],
520520
"name": "verify::single_with_contract_ensures",
521521
"file": "tests/proofs/standard_proofs_with_contracts.rs",
@@ -769,9 +769,9 @@
769769
]
770770
},
771771
{
772-
"hash": "1524815006725202329516601815563923580160",
772+
"hash": "89199870224850649846734611610114102642",
773773
"attrs": [
774-
"#[kanitool::proof]\n"
774+
"#[kanitool::proof]"
775775
],
776776
"name": "verify::two_contracts_requires_and_ensures",
777777
"file": "tests/proofs/standard_proofs_with_contracts.rs",

tests/snapshots/ad_hoc.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[
22
{
3-
"hash": "1169127772433107051910762480258862721704",
3+
"hash": "1229614748721749766913964449194572207950",
44
"def_id": "DefId { id: 0, name: \"adhoc::callee_defined_in_proof\" }",
55
"attrs": [
6-
"#[kanitool::proof]\n"
6+
"#[kanitool::proof]"
77
],
88
"kind": "Standard",
99
"func": {
@@ -53,10 +53,10 @@
5353
]
5454
},
5555
{
56-
"hash": "45356353433292067411028081932824047592",
56+
"hash": "16071192516234258013908867822141086841",
5757
"def_id": "DefId { id: 2, name: \"adhoc::closure_in_proof\" }",
5858
"attrs": [
59-
"#[kanitool::proof]\n"
59+
"#[kanitool::proof]"
6060
],
6161
"kind": "Standard",
6262
"func": {
@@ -106,10 +106,10 @@
106106
]
107107
},
108108
{
109-
"hash": "376713398218856890112497690805164100930",
109+
"hash": "1315335617907881608515688324687253173446",
110110
"def_id": "DefId { id: 5, name: \"adhoc::proof_in_fn_item::proof\" }",
111111
"attrs": [
112-
"#[kanitool::proof]\n"
112+
"#[kanitool::proof]"
113113
],
114114
"kind": "Standard",
115115
"func": {

tests/snapshots/by_macros/gen_contracts_by_macros.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[
22
{
3-
"hash": "1464226525610256308612646858567537187198",
3+
"hash": "775265515052998156911238326129260793147",
44
"def_id": "DefId { id: 13, name: \"verify::proof1\" }",
55
"attrs": [
6-
"#[kanitool::proof_for_contract = \"contract1\"]\n"
6+
"#[kanitool::proof_for_contract = \"contract1\"]"
77
],
88
"kind": "Contract",
99
"func": {
@@ -147,10 +147,10 @@
147147
]
148148
},
149149
{
150-
"hash": "1102522625469360326811087974940169982141",
150+
"hash": "462859955844485637210180569593584318282",
151151
"def_id": "DefId { id: 27, name: \"verify::proof2\" }",
152152
"attrs": [
153-
"#[kanitool::proof_for_contract = \"contract2\"]\n"
153+
"#[kanitool::proof_for_contract = \"contract2\"]"
154154
],
155155
"kind": "Contract",
156156
"func": {
@@ -294,10 +294,10 @@
294294
]
295295
},
296296
{
297-
"hash": "1775778566579290701410350421249473944550",
297+
"hash": "349265479360865536512022356632514339222",
298298
"def_id": "DefId { id: 41, name: \"verify::proof3\" }",
299299
"attrs": [
300-
"#[kanitool::proof_for_contract = \"contract3\"]\n"
300+
"#[kanitool::proof_for_contract = \"contract3\"]"
301301
],
302302
"kind": "Contract",
303303
"func": {

tests/snapshots/by_macros/gen_proofs_by_macros.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[
22
{
3-
"hash": "1062562354670908564515699502517567470958",
3+
"hash": "621627085399168861817335896579039857609",
44
"def_id": "DefId { id: 0, name: \"verify::proof1\" }",
55
"attrs": [
6-
"#[kanitool::proof]\n"
6+
"#[kanitool::proof]"
77
],
88
"kind": "Standard",
99
"func": {
@@ -24,10 +24,10 @@
2424
"callees": []
2525
},
2626
{
27-
"hash": "164719725483480922244888053500348595462",
27+
"hash": "1057391189656170612910810424020292617315",
2828
"def_id": "DefId { id: 1, name: \"verify::proof2\" }",
2929
"attrs": [
30-
"#[kanitool::proof]\n"
30+
"#[kanitool::proof]"
3131
],
3232
"kind": "Standard",
3333
"func": {
@@ -48,10 +48,10 @@
4848
"callees": []
4949
},
5050
{
51-
"hash": "534107120703765166610302713019419672799",
51+
"hash": "833388606508419100814630708153653821669",
5252
"def_id": "DefId { id: 2, name: \"verify::proof3\" }",
5353
"attrs": [
54-
"#[kanitool::proof]\n"
54+
"#[kanitool::proof]"
5555
],
5656
"kind": "Standard",
5757
"func": {

0 commit comments

Comments
 (0)