Skip to content

Commit dd3dffb

Browse files
committed
minimize minirust subset
1 parent 97430cf commit dd3dffb

File tree

2 files changed

+8
-21
lines changed

2 files changed

+8
-21
lines changed

crates/formality-rust/src/grammar.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use formality_types::{
99
},
1010
rust::Term,
1111
};
12-
use minirust::Body;
1312

1413
pub mod minirust;
1514

crates/formality-rust/src/grammar/minirust.rs

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
use std::sync::Arc;
21

3-
use formality_core::{id, Downcast, DowncastFrom, Upcast};
2+
use formality_core::id;
43
use formality_macros::term;
5-
use formality_types::grammar::{FieldId, Ty};
4+
use formality_types::grammar::Ty;
65

76
// This definition is based on [MiniRust](https://github.com/minirust/minirust/blob/master/spec/lang/syntax.md).
87

@@ -62,10 +61,10 @@ pub enum Terminator {
6261
// Unreachable
6362
// Intrinsic
6463

65-
#[grammar(call $?cc $callee$(arguments) -> $ret $:goto $next_block)]
64+
#[grammar(call $callee$(arguments) -> $ret $:goto $next_block)]
6665
Call {
6766
callee: ValueExpression,
68-
cc: CallingConvention,
67+
// cc: CallingConvention,
6968
arguments: Vec<ArgumentExpression>,
7069
ret: PlaceExpression,
7170
next_block: Option<BbId>,
@@ -75,17 +74,6 @@ pub enum Terminator {
7574
Return,
7675
}
7776

78-
#[term]
79-
#[derive(Default)]
80-
pub enum CallingConvention {
81-
#[default]
82-
#[grammar((Rust))]
83-
Rust,
84-
85-
#[grammar((C))]
86-
C,
87-
}
88-
8977
#[term]
9078
pub enum ArgumentExpression {
9179
ByValue(ValueExpression),
@@ -95,8 +83,8 @@ pub enum ArgumentExpression {
9583
#[term]
9684
pub enum ValueExpression {
9785
// Const
98-
#[grammar($(v0) as $v1)]
99-
Tuple(Vec<ValueExpression>, Ty),
86+
// #[grammar($(v0) as $v1)]
87+
// Tuple(Vec<ValueExpression>, Ty),
10088
// Union
10189
// Variant
10290
// GetDiscriminant
@@ -110,8 +98,8 @@ pub enum ValueExpression {
11098
#[term]
11199
pub enum PlaceExpression {
112100
Local(LocalId),
113-
Deref(Arc<ValueExpression>),
114-
Field(Arc<PlaceExpression>, FieldId),
101+
// Deref(Arc<ValueExpression>),
102+
// Field(Arc<PlaceExpression>, FieldId),
115103
// Index
116104
// Downcast
117105
}

0 commit comments

Comments
 (0)