Skip to content

Commit 0e4cc95

Browse files
committed
---
yaml --- r: 11484 b: refs/heads/master c: c28c258 h: refs/heads/master v: v3
1 parent 12e21e0 commit 0e4cc95

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
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 13781f3d8dbc966b2edc5d10747a62378d616287
2+
refs/heads/master: c28c258f915f0ab46a51519a2b79bd42af383891
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf

trunk/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)