Skip to content

Commit 305cbf9

Browse files
committed
rustc: Parse crust functions
1 parent 6943b38 commit 305cbf9

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/comp/syntax/parse/parser.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ fn bad_expr_word_table() -> hashmap<str, ()> {
150150
"export", "fail", "fn", "for", "if", "iface", "impl",
151151
"import", "let", "log", "mod", "mutable", "native", "pure",
152152
"resource", "ret", "trait", "type", "unchecked", "unsafe",
153-
"while"] {
153+
"while, crust"] {
154154
words.insert(word, ());
155155
}
156156
words
@@ -2276,6 +2276,9 @@ fn parse_item(p: parser, attrs: [ast::attribute]) -> option<@ast::item> {
22762276
p.bump();
22772277
expect_word(p, "fn");
22782278
ret some(parse_item_fn(p, ast::unsafe_fn, attrs));
2279+
} else if eat_word(p, "crust") {
2280+
expect_word(p, "fn");
2281+
ret some(parse_item_fn(p, ast::crust_fn, attrs));
22792282
} else if eat_word(p, "mod") {
22802283
ret some(parse_item_mod(p, attrs));
22812284
} else if eat_word(p, "native") {

src/test/run-pass/crust-1.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
crust fn f() {
2+
}
3+
4+
fn main() {
5+
}

0 commit comments

Comments
 (0)