Skip to content
This repository has been archived by the owner on Sep 10, 2024. It is now read-only.

Commit

Permalink
Speed up ref generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Kha committed Nov 16, 2016
1 parent bde3ccd commit e6a5687
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ build.ninja
*.ilean
*.olean
ref/index.html
ref/src/generated.lean
ref/src/generated.lean
mir
3 changes: 2 additions & 1 deletion dodo.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ def task_electrolysis_ref():
for p in list(ref.rglob('lib.rs')):
yield {
'name': str(p),
'actions': [['cargo', 'run', p]] +
'actions': [['cargo', 'run', p],
'rustc --crate-type lib -Z unstable-options --unpretty mir "{}" > "{}"'.format(p, p.with_name('mir'))] +
([['mv', p.with_name('generated.lean'), p.with_name('broken.lean')]]
if '!' in str(p) else []),
'file_dep': [p, 'target/debug/electrolysis'],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Mutable closures work out of the box as long as they don't close over mutable references - that would require [nested storing of `&mut`](#nested-storing-of-mut-refs.).
3 changes: 1 addition & 2 deletions ref/make_ref.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ def rec(path, depth):
yield markdown.markdown(open(os.path.join(path, 'pre.md')).read(), extensions=[CodeBlockExtension()])
if 'lib.rs' in entries:
rust = os.path.join(path, 'lib.rs')
mir = subprocess.run(['rustc', '--crate-type', 'lib', '-Z', 'unstable-options', '--unpretty', 'mir', rust],
stdout=subprocess.PIPE, check=True).stdout.decode('utf8')
mir = open(os.path.join(path, 'mir')).read()
generated = open(os.path.join(path, 'broken.lean' if '!' in path else 'generated.lean')).read()
if '5 Crates' not in path:
generated = re.search('(open [^\n]*\n)+\n(.*)', generated, flags=re.DOTALL).group(2)
Expand Down

0 comments on commit e6a5687

Please sign in to comment.