Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
5274e997
R
Rust
项目概览
int
/
Rust
大约 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5274e997
编写于
7月 17, 2014
作者:
J
Jakub Wieczorek
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Assign more diagnostic codes
上级
5ddc7b4a
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
276 addition
and
282 deletion
+276
-282
src/librustc/diagnostics.rs
src/librustc/diagnostics.rs
+64
-1
src/librustc/middle/effect.rs
src/librustc/middle/effect.rs
+7
-8
src/librustc/middle/entry.rs
src/librustc/middle/entry.rs
+6
-9
src/librustc/middle/intrinsicck.rs
src/librustc/middle/intrinsicck.rs
+4
-6
src/librustc/middle/kind.rs
src/librustc/middle/kind.rs
+59
-71
src/librustc/middle/lang_items.rs
src/librustc/middle/lang_items.rs
+7
-6
src/librustc/middle/resolve.rs
src/librustc/middle/resolve.rs
+14
-15
src/librustc/middle/typeck/astconv.rs
src/librustc/middle/typeck/astconv.rs
+26
-44
src/librustc/middle/typeck/check/vtable.rs
src/librustc/middle/typeck/check/vtable.rs
+13
-19
src/librustc/middle/typeck/check/writeback.rs
src/librustc/middle/typeck/check/writeback.rs
+17
-31
src/librustc/middle/typeck/coherence.rs
src/librustc/middle/typeck/coherence.rs
+20
-26
src/librustc/middle/typeck/collect.rs
src/librustc/middle/typeck/collect.rs
+27
-32
src/librustc/middle/typeck/mod.rs
src/librustc/middle/typeck/mod.rs
+4
-6
src/libsyntax/diagnostics/macros.rs
src/libsyntax/diagnostics/macros.rs
+6
-6
src/test/compile-fail/multiple-main-2.rs
src/test/compile-fail/multiple-main-2.rs
+1
-1
src/test/compile-fail/multiple-main-3.rs
src/test/compile-fail/multiple-main-3.rs
+1
-1
未找到文件。
src/librustc/diagnostics.rs
浏览文件 @
5274e997
...
...
@@ -110,5 +110,68 @@
E0091
,
E0092
,
E0093
,
E0094
E0094
,
E0095
,
E0096
,
E0097
,
E0098
,
E0099
,
E0100
,
E0101
,
E0102
,
E0103
,
E0104
,
E0105
,
E0106
,
E0107
,
E0108
,
E0109
,
E0110
,
E0111
,
E0112
,
E0113
,
E0114
,
E0115
,
E0116
,
E0117
,
E0118
,
E0119
,
E0120
,
E0121
,
E0122
,
E0123
,
E0124
,
E0125
,
E0126
,
E0127
,
E0128
,
E0129
,
E0130
,
E0131
,
E0132
,
E0133
,
E0134
,
E0135
,
E0136
,
E0137
,
E0138
,
E0139
,
E0140
,
E0141
,
E0142
,
E0143
,
E0144
,
E0145
,
E0146
,
E0147
,
E0148
,
E0149
,
E0150
,
E0151
,
E0152
,
E0153
,
E0154
,
E0155
,
E0156
,
E0157
)
src/librustc/middle/effect.rs
浏览文件 @
5274e997
...
...
@@ -49,10 +49,9 @@ fn require_unsafe(&mut self, span: Span, description: &str) {
match
self
.unsafe_context
{
SafeContext
=>
{
// Report an error.
self
.tcx.sess
.span_err
(
span
,
format!
(
"{} requires unsafe function or
\
block"
,
description
)
.as_slice
())
span_err!
(
self
.tcx.sess
,
span
,
E0133
,
"{} requires unsafe function or block"
,
description
);
}
UnsafeBlock
(
block_id
)
=>
{
// OK, but record this.
...
...
@@ -73,14 +72,14 @@ fn check_str_index(&mut self, e: &ast::Expr) {
match
ty
::
get
(
base_type
)
.sty
{
ty
::
ty_uniq
(
ty
)
|
ty
::
ty_rptr
(
_
,
ty
::
mt
{
ty
,
..
})
=>
match
ty
::
get
(
ty
)
.sty
{
ty
::
ty_str
=>
{
s
elf
.tcx.sess
.span_err
(
e
.span
,
"modification of string types is not allowed"
);
s
pan_err!
(
self
.tcx.sess
,
e
.span
,
E0134
,
"modification of string types is not allowed"
);
}
_
=>
{}
},
ty
::
ty_str
=>
{
s
elf
.tcx.sess
.span_err
(
e
.span
,
"modification of string types is not allowed"
);
s
pan_err!
(
self
.tcx.sess
,
e
.span
,
E0135
,
"modification of string types is not allowed"
);
}
_
=>
{}
}
...
...
src/librustc/middle/entry.rs
浏览文件 @
5274e997
...
...
@@ -87,9 +87,8 @@ fn find_item(item: &Item, ctxt: &mut EntryContext) {
if
ctxt
.main_fn
.is_none
()
{
ctxt
.main_fn
=
Some
((
item
.id
,
item
.span
));
}
else
{
ctxt
.session
.span_err
(
item
.span
,
"multiple 'main' functions"
);
span_err!
(
ctxt
.session
,
item
.span
,
E0136
,
"multiple 'main' functions"
);
}
}
else
{
// This isn't main
...
...
@@ -102,9 +101,8 @@ fn find_item(item: &Item, ctxt: &mut EntryContext) {
if
ctxt
.attr_main_fn
.is_none
()
{
ctxt
.attr_main_fn
=
Some
((
item
.id
,
item
.span
));
}
else
{
ctxt
.session
.span_err
(
item
.span
,
"multiple 'main' functions"
);
span_err!
(
ctxt
.session
,
item
.span
,
E0137
,
"multiple functions with a #[main] attribute"
);
}
}
...
...
@@ -112,9 +110,8 @@ fn find_item(item: &Item, ctxt: &mut EntryContext) {
if
ctxt
.start_fn
.is_none
()
{
ctxt
.start_fn
=
Some
((
item
.id
,
item
.span
));
}
else
{
ctxt
.session
.span_err
(
item
.span
,
"multiple 'start' functions"
);
span_err!
(
ctxt
.session
,
item
.span
,
E0138
,
"multiple 'start' functions"
);
}
}
}
...
...
src/librustc/middle/intrinsicck.rs
浏览文件 @
5274e997
...
...
@@ -94,14 +94,12 @@ fn def_id_is_transmute(&self, def_id: DefId) -> bool {
fn
check_transmute
(
&
self
,
span
:
Span
,
from
:
ty
::
t
,
to
:
ty
::
t
)
{
if
type_size_is_affected_by_type_parameters
(
self
.tcx
,
from
)
{
self
.tcx.sess
.span_err
(
span
,
"cannot transmute from a type that
\
contains type parameters"
);
span_err!
(
self
.tcx.sess
,
span
,
E0139
,
"cannot transmute from a type that contains type parameters"
);
}
if
type_size_is_affected_by_type_parameters
(
self
.tcx
,
to
)
{
self
.tcx.sess
.span_err
(
span
,
"cannot transmute to a type that contains
\
type parameters"
);
span_err!
(
self
.tcx.sess
,
span
,
E0140
,
"cannot transmute to a type that contains type parameters"
);
}
let
restriction
=
TransmuteRestriction
{
...
...
src/librustc/middle/kind.rs
浏览文件 @
5274e997
...
...
@@ -92,22 +92,20 @@ fn check_struct_safe_for_destructor(cx: &mut Context,
let
struct_ty
=
ty
::
mk_struct
(
cx
.tcx
,
struct_did
,
subst
::
Substs
::
empty
());
if
!
ty
::
type_is_sendable
(
cx
.tcx
,
struct_ty
)
{
cx
.tcx.sess
.span_err
(
span
,
"cannot implement a destructor on a
\
structure that does not satisfy Send"
);
cx
.tcx.sess
.span_note
(
span
,
"use
\"
#[unsafe_destructor]
\"
on the
\
implementation to force the compiler to
\
allow this"
);
span_err!
(
cx
.tcx.sess
,
span
,
E0125
,
"cannot implement a destructor on a
\
structure that does not satisfy Send"
);
span_note!
(
cx
.tcx.sess
,
span
,
"use
\"
#[unsafe_destructor]
\"
on the implementation
\
to force the compiler to allow this"
);
}
}
else
{
cx
.tcx.sess
.span_err
(
span
,
"cannot implement a destructor on a structure
\
with type parameters"
);
cx
.tcx.sess
.span_note
(
span
,
"use
\"
#[unsafe_destructor]
\"
on the
\
implementation to force the compiler to
\
allow this"
);
span_err!
(
cx
.tcx.sess
,
span
,
E0141
,
"cannot implement a destructor on a structure
\
with type parameters"
);
span_note!
(
cx
.tcx.sess
,
span
,
"use
\"
#[unsafe_destructor]
\"
on the implementation
\
to force the compiler to allow this"
);
}
}
...
...
@@ -124,14 +122,12 @@ fn check_impl_of_trait(cx: &mut Context, it: &Item, trait_ref: &TraitRef, self_t
let
self_ty
:
ty
::
t
=
ty
::
node_id_to_type
(
cx
.tcx
,
it
.id
);
debug!
(
"checking impl with self type {}"
,
ty
::
get
(
self_ty
)
.sty
);
check_builtin_bounds
(
cx
,
self_ty
,
trait_def
.bounds
,
|
missing
|
{
cx
.tcx.sess
.span_err
(
self_type
.span
,
format!
(
"the type `{}', which does not fulfill `{}`, cannot implement this
\
trait"
,
ty_to_string
(
cx
.tcx
,
self_ty
),
missing
.user_string
(
cx
.tcx
))
.as_slice
());
cx
.tcx.sess
.span_note
(
self_type
.span
,
format!
(
"types implementing this trait must fulfill `{}`"
,
trait_def
.bounds
.user_string
(
cx
.tcx
))
.as_slice
());
span_err!
(
cx
.tcx.sess
,
self_type
.span
,
E0142
,
"the type `{}', which does not fulfill `{}`, cannot implement this trait"
,
ty_to_string
(
cx
.tcx
,
self_ty
),
missing
.user_string
(
cx
.tcx
));
span_note!
(
cx
.tcx.sess
,
self_type
.span
,
"types implementing this trait must fulfill `{}`"
,
trait_def
.bounds
.user_string
(
cx
.tcx
));
});
// If this is a destructor, check kinds.
...
...
@@ -191,10 +187,9 @@ fn check_for_block(cx: &Context, fv: &freevar_entry,
}
fn
check_for_bare
(
cx
:
&
Context
,
fv
:
&
freevar_entry
)
{
cx
.tcx.sess
.span_err
(
fv
.span
,
"can't capture dynamic environment in a fn item;
\
use the || { ... } closure form instead"
);
span_err!
(
cx
.tcx.sess
,
fv
.span
,
E0143
,
"can't capture dynamic environment in a fn item;
\
use the || {} closure form instead"
,
"{ ... }"
);
}
// same check is done in resolve.rs, but shouldn't be done
let
fty
=
ty
::
node_id_to_type
(
cx
.tcx
,
id
);
...
...
@@ -489,12 +484,11 @@ pub fn check_typaram_bounds(cx: &Context,
ty
,
type_param_def
.bounds.builtin_bounds
,
|
missing
|
{
cx
.tcx.sess
.span_err
(
sp
,
format!
(
"instantiating a type parameter with an incompatible type
\
`{}`, which does not fulfill `{}`"
,
ty_to_string
(
cx
.tcx
,
ty
),
missing
.user_string
(
cx
.tcx
))
.as_slice
());
span_err!
(
cx
.tcx.sess
,
sp
,
E0144
,
"instantiating a type parameter with an incompatible type
\
`{}`, which does not fulfill `{}`"
,
ty_to_string
(
cx
.tcx
,
ty
),
missing
.user_string
(
cx
.tcx
));
});
}
...
...
@@ -506,36 +500,32 @@ pub fn check_freevar_bounds(cx: &Context, sp: Span, ty: ty::t,
// Emit a less mysterious error message in this case.
match
referenced_ty
{
Some
(
rty
)
=>
{
cx
.tcx.sess
.span_err
(
sp
,
format!
(
"cannot implicitly borrow variable of type `{}` in a
\
bounded stack closure (implicit reference does not
\
fulfill `{}`)"
,
ty_to_string
(
cx
.tcx
,
rty
),
missing
.user_string
(
cx
.tcx
))
.as_slice
())
span_err!
(
cx
.tcx.sess
,
sp
,
E0145
,
"cannot implicitly borrow variable of type `{}` in a
\
bounded stack closure (implicit reference does not fulfill `{}`)"
,
ty_to_string
(
cx
.tcx
,
rty
),
missing
.user_string
(
cx
.tcx
));
}
None
=>
{
cx
.tcx.sess
.span_err
(
sp
,
format!
(
"cannot capture variable of type `{}`, which does
\
not fulfill `{}`, in a bounded closure"
,
ty_to_string
(
cx
.tcx
,
ty
),
missing
.user_string
(
cx
.tcx
))
.as_slice
())
span_err!
(
cx
.tcx.sess
,
sp
,
E0146
,
"cannot capture variable of type `{}`, which does
\
not fulfill `{}`, in a bounded closure"
,
ty_to_string
(
cx
.tcx
,
ty
),
missing
.user_string
(
cx
.tcx
));
}
}
cx
.tcx.sess
.span_note
(
sp
,
format!
(
"this closure's environment must satisfy `{}`"
,
bounds
.user_string
(
cx
.tcx
))
.as_slice
());
span_note!
(
cx
.tcx.sess
,
sp
,
"this closure's environment must satisfy `{}`"
,
bounds
.user_string
(
cx
.tcx
));
});
}
pub
fn
check_trait_cast_bounds
(
cx
:
&
Context
,
sp
:
Span
,
ty
:
ty
::
t
,
bounds
:
ty
::
BuiltinBounds
)
{
check_builtin_bounds
(
cx
,
ty
,
bounds
,
|
missing
|
{
cx
.tcx.sess
.span_err
(
sp
,
format!
(
"cannot pack type `{}`, which does not fulfill
\
`{}`, as a trait bounded by {}"
,
ty_to_string
(
cx
.tcx
,
ty
),
missing
.user_string
(
cx
.tcx
),
bounds
.user_string
(
cx
.tcx
))
.as_slice
(
));
span_err!
(
cx
.tcx.sess
,
sp
,
E0147
,
"cannot pack type `{}`, which does not fulfill `{}`, as a trait bounded by {}"
,
ty_to_string
(
cx
.tcx
,
ty
)
,
missing
.user_string
(
cx
.tcx
),
bounds
.user_string
(
cx
.tcx
));
});
}
...
...
@@ -544,26 +534,26 @@ fn check_copy(cx: &Context, ty: ty::t, sp: Span, reason: &str) {
ty_to_string
(
cx
.tcx
,
ty
),
ty
::
type_contents
(
cx
.tcx
,
ty
)
.to_string
());
if
ty
::
type_moves_by_default
(
cx
.tcx
,
ty
)
{
cx
.tcx.sess
.span_err
(
sp
,
format!
(
"copying a value of non-copyable type `{}`"
,
ty_to_string
(
cx
.tcx
,
ty
))
.as_slice
());
cx
.tcx.sess
.span_note
(
sp
,
format!
(
"{}"
,
reason
)
.as_slice
());
span_err!
(
cx
.tcx.sess
,
sp
,
E0148
,
"copying a value of non-copyable type `{}`"
,
ty_to_string
(
cx
.tcx
,
ty
));
span_note!
(
cx
.tcx.sess
,
sp
,
"{}"
,
reason
.as_slice
());
}
}
pub
fn
check_static
(
tcx
:
&
ty
::
ctxt
,
ty
:
ty
::
t
,
sp
:
Span
)
->
bool
{
if
!
ty
::
type_is_static
(
tcx
,
ty
)
{
match
ty
::
get
(
ty
)
.sty
{
ty
::
ty_param
(
..
)
=>
{
tcx
.sess
.span_err
(
sp
,
format!
(
"value may contain references;
\
add `'static` bound to `{}`"
,
ty_to_string
(
tcx
,
ty
))
.as_slice
());
}
_
=>
{
tcx
.sess
.span_err
(
sp
,
"value may contain references"
);
}
ty
::
ty_param
(
..
)
=>
{
span_err!
(
tcx
.sess
,
sp
,
E0149
,
"value may contain references;
\
add `'static` bound to `{}`"
,
ty_to_string
(
tcx
,
ty
));
}
_
=>
{
span_err!
(
tcx
.sess
,
sp
,
E0150
,
"value may contain references"
);
}
}
false
}
else
{
...
...
@@ -680,11 +670,9 @@ fn is_ReScope(r: ty::Region) -> bool {
// Ensure that `ty` has a statically known size (i.e., it has the `Sized` bound).
fn
check_sized
(
tcx
:
&
ty
::
ctxt
,
ty
:
ty
::
t
,
name
:
String
,
sp
:
Span
)
{
if
!
ty
::
type_is_sized
(
tcx
,
ty
)
{
tcx
.sess
.span_err
(
sp
,
format!
(
"variable `{}` has dynamically sized type
\
`{}`"
,
name
,
ty_to_string
(
tcx
,
ty
))
.as_slice
());
span_err!
(
tcx
.sess
,
sp
,
E0151
,
"variable `{}` has dynamically sized type `{}`"
,
name
,
ty_to_string
(
tcx
,
ty
));
}
}
...
...
src/librustc/middle/lang_items.rs
浏览文件 @
5274e997
...
...
@@ -27,6 +27,7 @@
use
syntax
::
ast
;
use
syntax
::
ast_util
::
local_def
;
use
syntax
::
attr
::
AttrMetaMethods
;
use
syntax
::
codemap
::{
DUMMY_SP
,
Span
};
use
syntax
::
parse
::
token
::
InternedString
;
use
syntax
::
visit
::
Visitor
;
use
syntax
::
visit
;
...
...
@@ -122,7 +123,7 @@ fn visit_item(&mut self, item: &ast::Item, _: ()) {
match
item_index
{
Some
(
item_index
)
=>
{
self
.collect_item
(
item_index
,
local_def
(
item
.id
))
self
.collect_item
(
item_index
,
local_def
(
item
.id
)
,
item
.span
)
}
None
=>
{}
}
...
...
@@ -147,13 +148,13 @@ pub fn new(session: &'a Session) -> LanguageItemCollector<'a> {
}
}
pub
fn
collect_item
(
&
mut
self
,
item_index
:
uint
,
item_def_id
:
ast
::
DefId
)
{
pub
fn
collect_item
(
&
mut
self
,
item_index
:
uint
,
item_def_id
:
ast
::
DefId
,
span
:
Span
)
{
// Check for duplicates.
match
self
.items.items
.get
(
item_index
)
{
&
Some
(
original_def_id
)
if
original_def_id
!=
item_def_id
=>
{
self
.session
.err
(
format!
(
"duplicate entry for `{}`"
,
LanguageItems
::
item_name
(
item_index
))
.as_slice
());
span_err!
(
self
.session
,
span
,
E0152
,
"duplicate entry for `{}`"
,
LanguageItems
::
item_name
(
item_index
));
}
&
Some
(
_
)
|
&
None
=>
{
// OK.
...
...
@@ -173,7 +174,7 @@ pub fn collect_external_language_items(&mut self) {
crate_store
.iter_crate_data
(|
crate_number
,
_
crate_metadata
|
{
each_lang_item
(
crate_store
,
crate_number
,
|
node_id
,
item_index
|
{
let
def_id
=
ast
::
DefId
{
krate
:
crate_number
,
node
:
node_id
};
self
.collect_item
(
item_index
,
def_id
);
self
.collect_item
(
item_index
,
def_id
,
DUMMY_SP
);
true
});
})
...
...
src/librustc/middle/resolve.rs
浏览文件 @
5274e997
...
...
@@ -4016,14 +4016,17 @@ fn resolve_struct(&mut self,
this
.record_def
(
path_id
,
(
def
,
lp
));
}
Some
((
DefStruct
(
_
),
_
))
=>
{
this
.session
.span_err
(
t
.span
,
"super-struct is defined
\
in a different crate"
)
span_err!
(
this
.session
,
t
.span
,
E0154
,
"super-struct is defined in a different crate"
);
},
Some
(
_
)
=>
this
.session
.span_err
(
t
.span
,
"super-struct is not a struct type"
),
None
=>
this
.session
.span_err
(
t
.span
,
"super-struct could not be resolved"
),
Some
(
_
)
=>
{
span_err!
(
this
.session
,
t
.span
,
E0155
,
"super-struct is not a struct type"
);
}
None
=>
{
span_err!
(
this
.session
,
t
.span
,
E0156
,
"super-struct could not be resolved"
);
}
}
},
_
=>
this
.session
.span_bug
(
t
.span
,
"path not mapped to a TyPath"
)
...
...
@@ -4297,17 +4300,13 @@ fn resolve_type(&mut self, ty: &Ty) {
if
path
.segments
.iter
()
.any
(|
s
|
!
s
.lifetimes
.is_empty
())
{
self
.session
.span_err
(
path
.span
,
"lifetime parameters
\
are not allowed on
\
this type"
)
span_err!
(
self
.session
,
path
.span
,
E0157
,
"lifetime parameters are not allowed on this type"
);
}
else
if
path
.segments
.iter
()
.any
(|
s
|
s
.types
.len
()
>
0
)
{
self
.session
.span_err
(
path
.span
,
"type parameters are
\
not allowed on this
\
type"
)
span_err!
(
self
.session
,
path
.span
,
E0153
,
"type parameters are not allowed on this type"
);
}
}
None
=>
{
...
...
src/librustc/middle/typeck/astconv.rs
浏览文件 @
5274e997
...
...
@@ -129,8 +129,8 @@ pub fn opt_ast_region_to_region<AC:AstConv,RS:RegionScope>(
match
rscope
.anon_regions
(
default_span
,
1
)
{
Err
(())
=>
{
debug!
(
"optional region in illegal location"
);
this
.tcx
()
.sess
.span_err
(
default_span
,
"missing lifetime specifier"
);
span_err!
(
this
.tcx
()
.sess
,
default_span
,
E0106
,
"missing lifetime specifier"
);
ty
::
ReStatic
}
...
...
@@ -187,12 +187,9 @@ fn ast_path_substs<AC:AstConv,RS:RegionScope>(
rscope
.anon_regions
(
path
.span
,
expected_num_region_params
);
if
supplied_num_region_params
!=
0
||
anon_regions
.is_err
()
{
tcx
.sess
.span_err
(
path
.span
,
format!
(
"wrong number of lifetime parameters:
\
expected {} but found {}"
,
expected_num_region_params
,
supplied_num_region_params
)
.as_slice
());
span_err!
(
tcx
.sess
,
path
.span
,
E0107
,
"wrong number of lifetime parameters: expected {} but found {}"
,
expected_num_region_params
,
supplied_num_region_params
);
}
match
anon_regions
{
...
...
@@ -235,10 +232,10 @@ fn ast_path_substs<AC:AstConv,RS:RegionScope>(
if
supplied_ty_param_count
>
required_ty_param_count
&&
!
this
.tcx
()
.sess.features.default_type_params
.get
()
{
this
.tcx
()
.sess
.span_err
(
path
.span
,
"default type parameters are
\
experimental and possibly buggy"
);
this
.tcx
()
.sess
.span_note
(
path
.span
,
"add #![feature(default_type_params)]
\
to the crate attributes to enable"
);
span_err!
(
this
.tcx
()
.sess
,
path
.span
,
E0108
,
"default type parameters are
experimental and possibly buggy"
);
span_note!
(
this
.tcx
()
.sess
,
path
.span
,
"add #![feature(default_type_params)]
to the crate attributes to enable"
);
}
let
tps
=
path
.segments
.iter
()
.flat_map
(|
s
|
s
.types
.iter
())
...
...
@@ -309,16 +306,14 @@ fn check_path_args(tcx: &ty::ctxt,
flags
:
uint
)
{
if
(
flags
&
NO_TPS
)
!=
0u
{
if
!
path
.segments
.iter
()
.all
(|
s
|
s
.types
.is_empty
())
{
tcx
.sess
.span_err
(
path
.span
,
span_err!
(
tcx
.sess
,
path
.span
,
E0109
,
"type parameters are not allowed on this type"
);
}
}
if
(
flags
&
NO_REGIONS
)
!=
0u
{
if
!
path
.segments
.last
()
.unwrap
()
.lifetimes
.is_empty
()
{
tcx
.sess
.span_err
(
path
.span
,
span_err!
(
tcx
.sess
,
path
.span
,
E0110
,
"region parameters are not allowed on this type"
);
}
}
...
...
@@ -359,8 +354,8 @@ pub fn ast_ty_to_prim_ty(tcx: &ty::ctxt, ast_ty: &ast::Ty) -> Option<ty::t> {
Some
(
ty
::
mk_mach_float
(
ft
))
}
ast
::
TyStr
=>
{
tcx
.sess
.span_err
(
ast_ty
.span
,
"bare `str` is not a type"
);
span_err!
(
tcx
.sess
,
ast_ty
.span
,
E0037
,
"bare `str` is not a type"
);
// return /something/ so they can at least get more errors
Some
(
ty
::
mk_uniq
(
tcx
,
ty
::
mk_str
(
tcx
)))
}
...
...
@@ -408,10 +403,8 @@ pub fn ast_ty_to_builtin_ty<AC:AstConv,
.iter
()
.flat_map
(|
s
|
s
.types
.iter
())
.count
()
>
1
{
this
.tcx
()
.sess
.span_err
(
path
.span
,
"`Box` has only one type parameter"
)
span_err!
(
this
.tcx
()
.sess
,
path
.span
,
E0047
,
"`Box` has only one type parameter"
);
}
for
inner_ast_type
in
path
.segments
...
...
@@ -428,16 +421,12 @@ pub fn ast_ty_to_builtin_ty<AC:AstConv,
|
typ
|
{
match
ty
::
get
(
typ
)
.sty
{
ty
::
ty_str
=>
{
this
.tcx
()
.sess
.span_err
(
path
.span
,
"`Box<str>` is not a type"
);
span_err!
(
this
.tcx
()
.sess
,
path
.span
,
E0111
,
"`Box<str>` is not a type"
);
ty
::
mk_err
()
}
ty
::
ty_vec
(
_
,
None
)
=>
{
this
.tcx
()
.sess
.span_err
(
path
.span
,
span_err!
(
this
.tcx
()
.sess
,
path
.span
,
E0112
,
"`Box<[T]>` is not a type"
);
ty
::
mk_err
()
}
...
...
@@ -445,9 +434,8 @@ pub fn ast_ty_to_builtin_ty<AC:AstConv,
}
}))
}
this
.tcx
()
.sess
.span_err
(
path
.span
,
"not enough type parameters
\
supplied to `Box<T>`"
);
span_err!
(
this
.tcx
()
.sess
,
path
.span
,
E0113
,
"not enough type parameters supplied to `Box<T>`"
);
Some
(
ty
::
mk_err
())
}
def
::
DefTy
(
did
)
|
def
::
DefStruct
(
did
)
...
...
@@ -456,10 +444,8 @@ pub fn ast_ty_to_builtin_ty<AC:AstConv,
.iter
()
.flat_map
(|
s
|
s
.types
.iter
())
.count
()
>
1
{
this
.tcx
()
.sess
.span_err
(
path
.span
,
"`Gc` has only one type parameter"
)
span_err!
(
this
.tcx
()
.sess
,
path
.span
,
E0048
,
"`Gc` has only one type parameter"
);
}
for
inner_ast_type
in
path
.segments
...
...
@@ -476,17 +462,13 @@ pub fn ast_ty_to_builtin_ty<AC:AstConv,
|
typ
|
{
match
ty
::
get
(
typ
)
.sty
{
ty
::
ty_str
=>
{
this
.tcx
()
.sess
.span_err
(
path
.span
,
"`Gc<str>` is not a type"
);
span_err!
(
this
.tcx
()
.sess
,
path
.span
,
E0114
,
"`Gc<str>` is not a type"
);
ty
::
mk_err
()
}
ty
::
ty_vec
(
_
,
None
)
=>
{
this
.tcx
()
.sess
.span_err
(
path
.span
,
"`Gc<[T]>` is not a type"
);
span_err!
(
this
.tcx
()
.sess
,
path
.span
,
E0115
,
"`Gc<[T]>` is not a type"
);
ty
::
mk_err
()
}
_
=>
ty
::
mk_box
(
this
.tcx
(),
typ
),
...
...
src/librustc/middle/typeck/check/vtable.rs
浏览文件 @
5274e997
...
...
@@ -203,11 +203,10 @@ fn relate_trait_refs(vcx: &VtableContext,
!
ty
::
trait_ref_contains_error
(
&
r_exp_trait_ref
)
{
let
tcx
=
vcx
.tcx
();
tcx
.sess
.span_err
(
span
,
format!
(
"expected {}, but found {} ({})"
,
ppaux
::
trait_ref_to_string
(
tcx
,
&
r_exp_trait_ref
),
ppaux
::
trait_ref_to_string
(
tcx
,
&
r_act_trait_ref
),
ty
::
type_err_to_str
(
tcx
,
err
))
.as_slice
());
span_err!
(
tcx
.sess
,
span
,
E0095
,
"expected {}, but found {} ({})"
,
ppaux
::
trait_ref_to_string
(
tcx
,
&
r_exp_trait_ref
),
ppaux
::
trait_ref_to_string
(
tcx
,
&
r_act_trait_ref
),
ty
::
type_err_to_str
(
tcx
,
err
));
}
}
}
...
...
@@ -449,7 +448,8 @@ fn search_for_vtable(vcx: &VtableContext,
1
=>
return
Some
(
found
.get
(
0
)
.clone
()),
_
=>
{
if
!
is_early
{
vcx
.tcx
()
.sess
.span_err
(
span
,
"multiple applicable methods in scope"
);
span_err!
(
vcx
.tcx
()
.sess
,
span
,
E0096
,
"multiple applicable methods in scope"
);
}
return
Some
(
found
.get
(
0
)
.clone
());
}
...
...
@@ -544,9 +544,7 @@ fn mutability_allowed(a_mutbl: ast::Mutability,
if
!
mutability_allowed
(
mt
.mutbl
,
mutbl
)
=>
{
match
ty
::
get
(
ty
)
.sty
{
ty
::
ty_trait
(
..
)
=>
{
fcx
.tcx
()
.sess
.span_err
(
ex
.span
,
"types differ in mutability"
);
span_err!
(
fcx
.tcx
()
.sess
,
ex
.span
,
E0097
,
"types differ in mutability"
);
}
_
=>
{}
}
...
...
@@ -622,11 +620,9 @@ fn mutability_allowed(a_mutbl: ast::Mutability,
(
&
ty
::
ty_uniq
(
ty
),
_
)
=>
{
match
ty
::
get
(
ty
)
.sty
{
ty
::
ty_trait
(
..
)
=>
{
fcx
.ccx.tcx.sess
.span_err
(
ex
.span
,
format!
(
"can only cast an boxed pointer
\
to a boxed object, not a {}"
,
ty
::
ty_sort_string
(
fcx
.tcx
(),
src_ty
))
.as_slice
());
span_err!
(
fcx
.ccx.tcx.sess
,
ex
.span
,
E0098
,
"can only cast an boxed pointer to a boxed object, not a {}"
,
ty
::
ty_sort_string
(
fcx
.tcx
(),
src_ty
));
}
_
=>
{}
}
...
...
@@ -635,11 +631,9 @@ fn mutability_allowed(a_mutbl: ast::Mutability,
(
&
ty
::
ty_rptr
(
_
,
ty
::
mt
{
ty
,
..
}),
_
)
=>
{
match
ty
::
get
(
ty
)
.sty
{
ty
::
ty_trait
(
..
)
=>
{
fcx
.ccx.tcx.sess
.span_err
(
ex
.span
,
format!
(
"can only cast an &-pointer
\
to an &-object, not a {}"
,
ty
::
ty_sort_string
(
fcx
.tcx
(),
src_ty
))
.as_slice
());
span_err!
(
fcx
.ccx.tcx.sess
,
ex
.span
,
E0099
,
"can only cast an &-pointer to an &-object, not a {}"
,
ty
::
ty_sort_string
(
fcx
.tcx
(),
src_ty
));
}
_
=>
{}
}
...
...
src/librustc/middle/typeck/check/writeback.rs
浏览文件 @
5274e997
...
...
@@ -237,9 +237,8 @@ fn visit_adjustments(&self, reason: ResolveReason, id: ast::NodeId) {
Some
(
&
def
::
DefStruct
(
_
))
=>
{
}
_
=>
{
self
.tcx
()
.sess
.span_err
(
reason
.span
(
self
.tcx
()),
"cannot coerce non-statically resolved bare fn"
)
span_err!
(
self
.tcx
()
.sess
,
reason
.span
(
self
.tcx
()),
E0100
,
"cannot coerce non-statically resolved bare fn"
);
}
}
...
...
@@ -399,47 +398,34 @@ fn report_error(&self, e: infer::fixup_err) {
if
!
self
.tcx.sess
.has_errors
()
{
match
self
.reason
{
ResolvingExpr
(
span
)
=>
{
self
.tcx.sess
.span_err
(
span
,
format!
(
"cannot determine a type for
\
this expression: {}"
,
infer
::
fixup_err_to_string
(
e
))
.as_slice
())
span_err!
(
self
.tcx.sess
,
span
,
E0101
,
"cannot determine a type for this expression: {}"
,
infer
::
fixup_err_to_string
(
e
));
}
ResolvingLocal
(
span
)
=>
{
self
.tcx.sess
.span_err
(
span
,
format!
(
"cannot determine a type for
\
this local variable: {}"
,
infer
::
fixup_err_to_string
(
e
))
.as_slice
())
span_err!
(
self
.tcx.sess
,
span
,
E0102
,
"cannot determine a type for this local variable: {}"
,
infer
::
fixup_err_to_string
(
e
));
}
ResolvingPattern
(
span
)
=>
{
self
.tcx.sess
.span_err
(
span
,
format!
(
"cannot determine a type for
\
this pattern binding: {}"
,
infer
::
fixup_err_to_string
(
e
))
.as_slice
())
span_err!
(
self
.tcx.sess
,
span
,
E0103
,
"cannot determine a type for this pattern binding: {}"
,
infer
::
fixup_err_to_string
(
e
));
}
ResolvingUpvar
(
upvar_id
)
=>
{
let
span
=
self
.reason
.span
(
self
.tcx
);
self
.tcx.sess
.span_err
(
span
,
format!
(
"cannot resolve lifetime for
\
captured variable `{}`: {}"
,
ty
::
local_var_name_str
(
self
.tcx
,
upvar_id
.var_id
)
.get
()
.to_string
(),
infer
::
fixup_err_to_string
(
e
))
.as_slice
());
span_err!
(
self
.tcx.sess
,
span
,
E0104
,
"cannot resolve lifetime for captured variable `{}`: {}"
,
ty
::
local_var_name_str
(
self
.tcx
,
upvar_id
.var_id
)
.get
()
.to_string
(),
infer
::
fixup_err_to_string
(
e
));
}
ResolvingImplRes
(
span
)
=>
{
self
.tcx
.sess
.span_err
(
span
,
"cannot determine a type for impl
\
supertrait"
);
span_err!
(
self
.tcx.sess
,
span
,
E0105
,
"cannot determine a type for impl supertrait"
);
}
}
}
...
...
src/librustc/middle/typeck/coherence.rs
浏览文件 @
5274e997
...
...
@@ -221,10 +221,10 @@ fn visit_item(&mut self, item: &Item, _: ()) {
if
!
self
.cc
.ast_type_is_defined_in_local_crate
(
&**
ast_ty
)
{
// This is an error.
let
session
=
&
self
.cc.crate_context.tcx.sess
;
s
ession
.span_err
(
item
.span
,
"cannot associate methods with a type outside the
\
crate the type is defined in; define and implement
\
a trait or new type instead"
);
s
pan_err!
(
session
,
item
.span
,
E0116
,
"cannot associate methods with a type outside the
\
crate the type is defined in; define and implement
\
a trait or new type instead"
);
}
}
ItemImpl
(
_
,
Some
(
ref
trait_ref
),
_
,
_
)
=>
{
...
...
@@ -241,9 +241,9 @@ fn visit_item(&mut self, item: &Item, _: ()) {
if
trait_def_id
.krate
!=
LOCAL_CRATE
{
let
session
=
&
self
.cc.crate_context.tcx.sess
;
s
ession
.span_err
(
item
.span
,
"cannot provide an extension implementation
\
where both trait and type are not defined in this crate"
);
s
pan_err!
(
session
,
item
.span
,
E0117
,
"cannot provide an extension implementation
\
where both trait and type are not defined in this crate"
);
}
}
...
...
@@ -299,9 +299,9 @@ fn check_implementation(&self, item: &Item,
self_type
.ty
)
{
None
=>
{
let
session
=
&
self
.crate_context.tcx.sess
;
s
ession
.span_err
(
item
.span
,
"no base type found for inherent implementation;
\
implement a trait or new type instead"
);
s
pan_err!
(
session
,
item
.span
,
E0118
,
"no base type found for inherent implementation;
\
implement a trait or new type instead"
);
}
Some
(
_
)
=>
{
// Nothing to do.
...
...
@@ -438,22 +438,18 @@ fn check_implementation_coherence_of(&self, trait_def_id: DefId) {
if
self
.polytypes_unify
(
polytype_a
.clone
(),
polytype_b
)
{
let
session
=
&
self
.crate_context.tcx.sess
;
session
.span_err
(
self
.span_of_impl
(
impl_a
),
format!
(
"conflicting implementations for trait `{}`"
,
ty
::
item_path_str
(
self
.crate_context.tcx
,
trait_def_id
))
.as_slice
());
span_err!
(
session
,
self
.span_of_impl
(
impl_a
),
E0119
,
"conflicting implementations for trait `{}`"
,
ty
::
item_path_str
(
self
.crate_context.tcx
,
trait_def_id
));
if
impl_b
.krate
==
LOCAL_CRATE
{
s
ession
.span_note
(
self
.span_of_impl
(
impl_b
),
"note conflicting implementation here"
);
s
pan_note!
(
session
,
self
.span_of_impl
(
impl_b
),
"note conflicting implementation here"
);
}
else
{
let
crate_store
=
&
self
.crate_context.tcx.sess.cstore
;
let
cdata
=
crate_store
.get_crate_data
(
impl_b
.krate
);
session
.note
(
format!
(
"conflicting implementation in crate
\
`{}`"
,
cdata
.name
)
.as_slice
());
span_note!
(
session
,
self
.span_of_impl
(
impl_a
),
"conflicting implementation in crate `{}`"
,
cdata
.name
);
}
}
}
...
...
@@ -702,10 +698,8 @@ fn populate_destructor_table(&self) {
{
match
tcx
.map
.find
(
impl_did
.node
)
{
Some
(
ast_map
::
NodeItem
(
item
))
=>
{
tcx
.sess
.span_err
((
*
item
)
.span
,
"the Drop trait may
\
only be implemented
\
on structures"
);
span_err!
(
tcx
.sess
,
item
.span
,
E0120
,
"the Drop trait may only be implemented on structures"
);
}
_
=>
{
tcx
.sess
.bug
(
"didn't find impl in ast
\
...
...
src/librustc/middle/typeck/collect.rs
浏览文件 @
5274e997
...
...
@@ -140,9 +140,8 @@ fn get_trait_def(&self, id: ast::DefId) -> Rc<ty::TraitDef> {
}
fn
ty_infer
(
&
self
,
span
:
Span
)
->
ty
::
t
{
self
.tcx.sess
.span_err
(
span
,
"the type placeholder `_` is not
\
allowed within types on item
\
signatures."
);
span_err!
(
self
.tcx.sess
,
span
,
E0121
,
"the type placeholder `_` is not allowed within types on item signatures."
);
ty
::
mk_err
()
}
}
...
...
@@ -417,10 +416,8 @@ pub fn ensure_no_ty_param_bounds(ccx: &CrateCtxt,
thing
:
&
'static
str
)
{
for
ty_param
in
generics
.ty_params
.iter
()
{
if
ty_param
.bounds
.len
()
>
0
{
ccx
.tcx.sess
.span_err
(
span
,
format!
(
"trait bounds are not allowed in {} definitions"
,
thing
)
.as_slice
());
span_err!
(
ccx
.tcx.sess
,
span
,
E0122
,
"trait bounds are not allowed in {} definitions"
,
thing
);
}
}
}
...
...
@@ -431,8 +428,8 @@ fn ensure_generics_abi(ccx: &CrateCtxt,
generics
:
&
ast
::
Generics
)
{
if
generics
.ty_params
.len
()
>
0
&&
!
(
abi
==
abi
::
Rust
||
abi
==
abi
::
RustIntrinsic
)
{
ccx
.tcx.sess
.span_err
(
span
,
"foreign functions may not use type parameters"
);
span_err!
(
ccx
.tcx.sess
,
span
,
E0123
,
"foreign functions may not use type parameters"
);
}
}
...
...
@@ -585,12 +582,10 @@ pub fn convert_struct(ccx: &CrateCtxt,
if
result
.name
!=
special_idents
::
unnamed_field
.name
{
let
dup
=
match
seen_fields
.find
(
&
result
.name
)
{
Some
(
prev_span
)
=>
{
tcx
.sess
.span_err
(
f
.span
,
format!
(
"field `{}` is already declared"
,
token
::
get_name
(
result
.name
))
.as_slice
());
tcx
.sess
.span_note
(
*
prev_span
,
"previously declared here"
);
span_err!
(
tcx
.sess
,
f
.span
,
E0124
,
"field `{}` is already declared"
,
token
::
get_name
(
result
.name
));
span_note!
(
tcx
.sess
,
*
prev_span
,
"previously declared here"
);
true
},
None
=>
false
,
...
...
@@ -619,9 +614,9 @@ pub fn convert_struct(ccx: &CrateCtxt,
Some
(
ast_map
::
NodeItem
(
i
))
=>
match
i
.node
{
ast
::
ItemStruct
(
struct_def
,
_
)
=>
{
if
!
struct_def
.is_virtual
{
tcx
.sess
.span_err
(
t
.span
,
"struct inheritance is only
\
allowed from virtual structs"
);
span_err!
(
tcx
.sess
,
t
.span
,
E0126
,
"struct inheritance is only
\
allowed from virtual structs"
);
}
},
_
=>
{},
...
...
@@ -840,8 +835,8 @@ fn ensure_supertraits(ccx: &CrateCtxt,
{
// This means a trait inherited from the same
// supertrait more than once.
tcx
.sess
.span_err
(
sp
,
"duplicate supertrait in
\
trait declaration"
);
span_err!
(
tcx
.sess
,
sp
,
E0127
,
"duplicate supertrait in
trait declaration"
);
break
;
}
else
{
ty_trait_refs
.push
(
trait_ref
);
...
...
@@ -1107,10 +1102,9 @@ fn get_or_create_type_parameter_def(ccx: &CrateCtxt,
ty
::
walk_ty
(
ty
,
|
t
|
{
match
ty
::
get
(
t
)
.sty
{
ty
::
ty_param
(
p
)
=>
if
p
.idx
>
cur_idx
{
ccx
.tcx.sess
.span_err
(
path
.span
,
"type parameters with a default cannot use
\
forward declared identifiers"
)
span_err!
(
ccx
.tcx.sess
,
path
.span
,
E0128
,
"type parameters with a default cannot use
\
forward declared identifiers"
);
},
_
=>
{}
}
...
...
@@ -1217,12 +1211,11 @@ fn check_bounds_compatible(tcx: &ty::ctxt,
|
trait_ref
|
{
let
trait_def
=
ty
::
lookup_trait_def
(
tcx
,
trait_ref
.def_id
);
if
trait_def
.bounds
.contains_elem
(
ty
::
BoundSized
)
{
tcx
.sess
.span_err
(
span
,
format!
(
"incompatible bounds on type parameter {},
\
bound {} does not allow unsized type"
,
token
::
get_ident
(
ident
),
ppaux
::
trait_ref_to_string
(
tcx
,
&*
trait_ref
))
.as_slice
());
span_err!
(
tcx
.sess
,
span
,
E0129
,
"incompatible bounds on type parameter {},
\
bound {} does not allow unsized type"
,
token
::
get_ident
(
ident
),
ppaux
::
trait_ref_to_string
(
tcx
,
&*
trait_ref
));
}
true
});
...
...
@@ -1241,8 +1234,10 @@ pub fn ty_of_foreign_fn_decl(ccx: &CrateCtxt,
match
(
*
i
)
.pat.node
{
ast
::
PatIdent
(
_
,
_
,
_
)
=>
(),
ast
::
PatWild
=>
(),
_
=>
ccx
.tcx.sess
.span_err
((
*
i
)
.pat.span
,
"patterns aren't allowed in foreign function declarations"
)
_
=>
{
span_err!
(
ccx
.tcx.sess
,
(
*
i
)
.pat.span
,
E0130
,
"patterns aren't allowed in foreign function declarations"
);
}
}
}
...
...
src/librustc/middle/typeck/mod.rs
浏览文件 @
5274e997
...
...
@@ -359,9 +359,8 @@ fn check_main_fn_ty(ccx: &CrateCtxt,
match
it
.node
{
ast
::
ItemFn
(
_
,
_
,
_
,
ref
ps
,
_
)
if
ps
.is_parameterized
()
=>
{
tcx
.sess
.span_err
(
main_span
,
"main function is not allowed to have type parameters"
);
span_err!
(
ccx
.tcx.sess
,
main_span
,
E0131
,
"main function is not allowed to have type parameters"
);
return
;
}
_
=>
()
...
...
@@ -408,9 +407,8 @@ fn check_start_fn_ty(ccx: &CrateCtxt,
match
it
.node
{
ast
::
ItemFn
(
_
,
_
,
_
,
ref
ps
,
_
)
if
ps
.is_parameterized
()
=>
{
tcx
.sess
.span_err
(
start_span
,
"start function is not allowed to have type parameters"
);
span_err!
(
tcx
.sess
,
start_span
,
E0132
,
"start function is not allowed to have type parameters"
);
return
;
}
_
=>
()
...
...
src/libsyntax/diagnostics/macros.rs
浏览文件 @
5274e997
...
...
@@ -44,24 +44,24 @@
#[macro_export]
macro_rules!
span_err
(
(
$session:expr
,
$span:expr
,
$code:ident
,
$
(
$
arg:expr
),
*
)
=>
({
(
$session:expr
,
$span:expr
,
$code:ident
,
$
(
$
message:tt
)
*
)
=>
({
__
diagnostic_used!
(
$code
);
(
$session
)
.span_err_with_code
(
$span
,
format!
(
$
(
$arg
),
*
)
.as_slice
(),
stringify!
(
$code
))
$session
.span_err_with_code
(
$span
,
format!
(
$
(
$message
)
*
)
.as_slice
(),
stringify!
(
$code
))
})
)
#[macro_export]
macro_rules!
span_warn
(
(
$session:expr
,
$span:expr
,
$code:ident
,
$
(
$
arg:expr
),
*
)
=>
({
(
$session:expr
,
$span:expr
,
$code:ident
,
$
(
$
message:tt
)
*
)
=>
({
__
diagnostic_used!
(
$code
);
(
$session
)
.span_warn_with_code
(
$span
,
format!
(
$
(
$arg
),
*
)
.as_slice
(),
stringify!
(
$code
))
$session
.span_warn_with_code
(
$span
,
format!
(
$
(
$message
)
*
)
.as_slice
(),
stringify!
(
$code
))
})
)
#[macro_export]
macro_rules!
span_note
(
(
$session:expr
,
$span:expr
,
$
(
$
arg:expr
),
*
)
=>
({
(
$session
)
.span_note
(
$span
,
format!
(
$
(
$
arg
),
*
)
.as_slice
())
(
$session:expr
,
$span:expr
,
$
(
$
message:tt
)
*
)
=>
({
(
$session
)
.span_note
(
$span
,
format!
(
$
(
$
message
)
*
)
.as_slice
())
})
)
...
...
src/test/compile-fail/multiple-main-2.rs
浏览文件 @
5274e997
...
...
@@ -13,5 +13,5 @@ fn bar() {
}
#[main]
fn
foo
()
{
//~ ERROR multiple
'main' functions
fn
foo
()
{
//~ ERROR multiple
functions with a #[main] attribute
}
src/test/compile-fail/multiple-main-3.rs
浏览文件 @
5274e997
...
...
@@ -14,6 +14,6 @@ fn main1() {
mod
foo
{
#[main]
fn
main2
()
{
//~ ERROR multiple
'main' functions
fn
main2
()
{
//~ ERROR multiple
functions with a #[main] attribute
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录