Skip to content

Commit cf3efb0

Browse files
committed
---
yaml --- r: 14490 b: refs/heads/try c: c28c258 h: refs/heads/master v: v3
1 parent baeeff5 commit cf3efb0

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: 13781f3d8dbc966b2edc5d10747a62378d616287
5+
refs/heads/try: c28c258f915f0ab46a51519a2b79bd42af383891
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/comp/middle/typeck.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3066,6 +3066,19 @@ fn check_main_fn_ty(tcx: ty::ctxt, main_id: ast::node_id, main_span: span) {
30663066
alt ty::get(main_t).struct {
30673067
ty::ty_fn({proto: ast::proto_bare, inputs, output,
30683068
ret_style: ast::return_val, constraints}) {
3069+
alt tcx.items.find(main_id) {
3070+
some(ast_map::node_item(it,_)) {
3071+
alt it.node {
3072+
ast::item_fn(_,ps,_) if vec::is_not_empty(ps) {
3073+
tcx.sess.span_err(main_span,
3074+
"main function is not allowed to have type parameters");
3075+
ret;
3076+
}
3077+
_ {}
3078+
}
3079+
}
3080+
_ {}
3081+
}
30693082
let ok = vec::len(constraints) == 0u;
30703083
ok &= ty::type_is_nil(output);
30713084
let num_args = vec::len(inputs);
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// error-pattern: main function is not allowed to have type parameters
2+
fn main<T>() { }

0 commit comments

Comments
 (0)