Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
cbf0b1b3
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,发现更多精彩内容 >>
提交
cbf0b1b3
编写于
7月 13, 2015
作者:
G
Guillaume Gomez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove warnings by centralizing error codes usage
上级
48ee57e6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
63 addition
and
42 deletion
+63
-42
src/librustc_resolve/lib.rs
src/librustc_resolve/lib.rs
+56
-36
src/librustc_resolve/resolve_imports.rs
src/librustc_resolve/resolve_imports.rs
+7
-6
未找到文件。
src/librustc_resolve/lib.rs
浏览文件 @
cbf0b1b3
...
...
@@ -116,6 +116,26 @@
mod
build_reduced_graph
;
mod
resolve_imports
;
fn
resolve_err_417
<
'a
,
'tcx
>
(
this
:
&
Resolver
<
'a
,
'tcx
>
,
span
:
syntax
::
codemap
::
Span
,
formatted
:
&
str
)
{
resolve_err!
(
this
,
span
,
E0417
,
"{}"
,
formatted
);
}
fn
resolve_err_422
<
'a
,
'tcx
>
(
this
:
&
Resolver
<
'a
,
'tcx
>
,
span
:
syntax
::
codemap
::
Span
,
formatted
:
&
str
)
{
resolve_err!
(
this
,
span
,
E0422
,
"{}"
,
formatted
);
}
fn
resolve_err_423
<
'a
,
'tcx
>
(
this
:
&
Resolver
<
'a
,
'tcx
>
,
span
:
syntax
::
codemap
::
Span
,
formatted
:
&
str
)
{
resolve_err!
(
this
,
span
,
E0423
,
"{}"
,
formatted
);
}
fn
resolve_err_432
<
'a
,
'tcx
>
(
this
:
&
Resolver
<
'a
,
'tcx
>
,
span
:
syntax
::
codemap
::
Span
,
formatted
:
&
str
)
{
resolve_err!
(
this
,
span
,
E0432
,
"{}"
,
formatted
);
}
fn
resolve_err_433
<
'a
,
'tcx
>
(
this
:
&
Resolver
<
'a
,
'tcx
>
,
span
:
syntax
::
codemap
::
Span
,
formatted
:
&
str
)
{
resolve_err!
(
this
,
span
,
E0433
,
"{}"
,
formatted
);
}
#[derive(Copy,
Clone)]
struct
BindingInfo
{
span
:
Span
,
...
...
@@ -1310,7 +1330,7 @@ fn resolve_item_in_lexical_scope(&mut self,
PathSearch
,
true
)
{
Failed
(
Some
((
span
,
msg
)))
=>
{
resolve_err
!
(
self
,
span
,
E0433
,
"failed to resolve. {}"
,
msg
);
resolve_err
_433
(
self
,
span
,
&*
format!
(
"failed to resolve. {}"
,
msg
)
);
},
Failed
(
None
)
=>
(),
// Continue up the search chain.
Indeterminate
=>
{
...
...
@@ -1568,11 +1588,12 @@ fn report_unresolved_imports(&mut self, module_: Rc<Module>) {
.span_to_snippet
((
*
imports
)[
index
]
.span
)
.unwrap
();
if
sn
.contains
(
"::"
)
{
resolve_err!
(
self
,
(
*
imports
)[
index
]
.span
,
E0432
,
"{}"
,
"unresolved import"
);
resolve_err_432
(
self
,
(
*
imports
)[
index
]
.span
,
"unresolved import"
);
}
else
{
resolve_err!
(
self
,
(
*
imports
)[
index
]
.span
,
E0432
,
"unresolved import (maybe you meant `{}::*`?)"
,
sn
);
resolve_err_432
(
self
,
(
*
imports
)[
index
]
.span
,
&*
format!
(
"unresolved import (maybe you meant `{}::*`?)"
,
sn
)
);
}
}
...
...
@@ -2528,7 +2549,7 @@ struct or enum variant",
self
.record_def
(
pattern
.id
,
path_res
);
}
DefStatic
(
..
)
=>
{
resolve_err
!
(
self
,
path
.span
,
E0417
,
"{}"
,
resolve_err
_417
(
self
,
path
.span
,
"static variables cannot be
\
referenced in a pattern,
\
use a `const` instead"
);
...
...
@@ -2609,9 +2630,9 @@ struct or enum variant",
result
=>
{
debug!
(
"(resolving pattern) didn't find struct
\
def: {:?}"
,
result
);
resolve_err
!
(
self
,
path
.span
,
E0422
,
"`{}` does not name a structure"
,
path_names_to_string
(
path
,
0
));
resolve_err
_422
(
self
,
path
.span
,
&*
format!
(
"`{}` does not name a structure"
,
path_names_to_string
(
path
,
0
)
));
}
}
visit
::
walk_path
(
self
,
path
);
...
...
@@ -2657,8 +2678,7 @@ fn resolve_bare_identifier_pattern(&mut self, name: Name, span: Span)
return
FoundConst
(
def
,
LastMod
(
AllPublic
));
}
DefStatic
(
..
)
=>
{
resolve_err!
(
self
,
span
,
E0417
,
"{}"
,
resolve_err_417
(
self
,
span
,
"static variables cannot be
\
referenced in a pattern,
\
use a `const` instead"
);
...
...
@@ -2678,9 +2698,9 @@ fn resolve_bare_identifier_pattern(&mut self, name: Name, span: Span)
Failed
(
err
)
=>
{
match
err
{
Some
((
span
,
msg
))
=>
{
resolve_err
!
(
self
,
span
,
E0433
,
"failed to resolve: {}"
,
msg
);
resolve_err
_433
(
self
,
span
,
&*
format!
(
"failed to resolve: {}"
,
msg
)
);
}
None
=>
()
}
...
...
@@ -2909,9 +2929,9 @@ fn resolve_module_relative_path(&mut self,
}
};
resolve_err
!
(
self
,
span
,
E0433
,
"failed to resolve: {}"
,
msg
);
resolve_err
_433
(
self
,
span
,
&*
format!
(
"failed to resolve: {}"
,
msg
)
);
return
None
;
}
Indeterminate
=>
panic!
(
"indeterminate unexpected"
),
...
...
@@ -2972,9 +2992,9 @@ fn resolve_crate_relative_path(&mut self,
/*self.resolve_error(span, &format!("failed to resolve. {}",
msg));*/
resolve_err
!
(
self
,
span
,
E0433
,
"failed to resolve: {}"
,
msg
);
resolve_err
_433
(
self
,
span
,
&*
format!
(
"failed to resolve: {}"
,
msg
)
);
return
None
;
}
...
...
@@ -3070,9 +3090,9 @@ fn resolve_item_by_name_in_lexical_scope(&mut self,
failed to resolve {}"
,
name
);
if
let
Some
((
span
,
msg
))
=
err
{
resolve_err
!
(
self
,
span
,
E0433
,
"failed to resolve: {}"
,
msg
)
resolve_err
_433
(
self
,
span
,
&*
format!
(
"failed to resolve: {}"
,
msg
)
)
}
return
None
;
...
...
@@ -3274,11 +3294,11 @@ fn resolve_expr(&mut self, expr: &Expr) {
// Check if struct variant
if
let
DefVariant
(
_
,
_
,
true
)
=
path_res
.base_def
{
let
path_name
=
path_names_to_string
(
path
,
0
);
resolve_err
!
(
self
,
expr
.span
,
E0423
,
"`{}` is a struct variant name, but
\
this expression
\
uses it like a function name"
,
path_name
);
resolve_err
_423
(
self
,
expr
.span
,
&*
format!
(
"`{}` is a struct variant name, but
\
this expression
\
uses it like a function name"
,
path_name
)
);
let
msg
=
format!
(
"did you mean to write:
\
`{} {{ /* fields */ }}`?"
,
...
...
@@ -3315,11 +3335,11 @@ fn resolve_expr(&mut self, expr: &Expr) {
match
type_res
.map
(|
r
|
r
.base_def
)
{
Some
(
DefTy
(
struct_id
,
_
))
if
self
.structs
.contains_key
(
&
struct_id
)
=>
{
resolve_err
!
(
self
,
expr
.span
,
E0423
,
"{}` is a structure name, but
\
this expression
\
uses it like a function name"
,
path_name
);
resolve_err
_423
(
self
,
expr
.span
,
&*
format!
(
"{}` is a structure name, but
\
this expression
\
uses it like a function name"
,
path_name
)
);
let
msg
=
format!
(
"did you mean to write:
\
`{} {{ /* fields */ }}`?"
,
...
...
@@ -3394,9 +3414,9 @@ fn resolve_expr(&mut self, expr: &Expr) {
Some
(
definition
)
=>
self
.record_def
(
expr
.id
,
definition
),
None
=>
{
debug!
(
"(resolving expression) didn't find struct def"
,);
resolve_err
!
(
self
,
path
.span
,
E0422
,
"`{}` does not name a structure"
,
path_names_to_string
(
path
,
0
));
resolve_err
_422
(
self
,
path
.span
,
&*
format!
(
"`{}` does not name a structure"
,
path_names_to_string
(
path
,
0
)
));
}
}
...
...
src/librustc_resolve/resolve_imports.rs
浏览文件 @
cbf0b1b3
...
...
@@ -272,12 +272,13 @@ fn resolve_imports_for_module(&mut self, module: Rc<Module>) {
Some
((
span
,
msg
))
=>
(
span
,
format!
(
". {}"
,
msg
)),
None
=>
(
import_directive
.span
,
String
::
new
())
};
resolve_err!
(
self
.resolver
,
span
,
E0432
,
"unresolved import `{}`{}"
,
import_path_to_string
(
&
import_directive
.module_path
,
import_directive
.subclass
),
help
);
::
resolve_err_432
(
self
.resolver
,
span
,
&*
format!
(
"unresolved import `{}`{}"
,
import_path_to_string
(
&
import_directive
.module_path
,
import_directive
.subclass
),
help
)
);
}
ResolveResult
::
Indeterminate
=>
break
,
// Bail out. We'll come around next time.
ResolveResult
::
Success
(())
=>
()
// Good. Continue.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录