Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
27d6b9d2
R
Rust
项目概览
int
/
Rust
11 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
27d6b9d2
编写于
1月 05, 2016
作者:
N
Niko Matsakis
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
improve visibility of future-incompatibilities (mildly, at least)
上级
15d32ffb
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
21 addition
and
3 deletion
+21
-3
src/librustc/lint/builtin.rs
src/librustc/lint/builtin.rs
+3
-0
src/librustc/lint/context.rs
src/librustc/lint/context.rs
+17
-3
src/librustc_trans/trans/base.rs
src/librustc_trans/trans/base.rs
+1
-0
未找到文件。
src/librustc/lint/builtin.rs
浏览文件 @
27d6b9d2
...
...
@@ -16,6 +16,9 @@
use
lint
::{
LintPass
,
LateLintPass
,
LintArray
};
// name of the future-incompatible group
pub
const
FUTURE_INCOMPATIBLE
:
&
'static
str
=
"future_incompatible"
;
declare_lint!
{
pub
CONST_ERR
,
Warn
,
...
...
src/librustc/lint/context.rs
浏览文件 @
27d6b9d2
...
...
@@ -364,14 +364,16 @@ pub fn gather_attrs(attrs: &[ast::Attribute])
/// lints elsewhere in the compiler should call
/// `Session::add_lint()` instead.
pub
fn
raw_emit_lint
(
sess
:
&
Session
,
lints
:
&
LintStore
,
lint
:
&
'static
Lint
,
lvlsrc
:
LevelSource
,
span
:
Option
<
Span
>
,
msg
:
&
str
)
{
raw_struct_lint
(
sess
,
lint
,
lvlsrc
,
span
,
msg
)
.emit
();
raw_struct_lint
(
sess
,
lint
s
,
lint
,
lvlsrc
,
span
,
msg
)
.emit
();
}
pub
fn
raw_struct_lint
<
'a
>
(
sess
:
&
'a
Session
,
lints
:
&
LintStore
,
lint
:
&
'static
Lint
,
lvlsrc
:
LevelSource
,
span
:
Option
<
Span
>
,
...
...
@@ -413,6 +415,18 @@ pub fn raw_struct_lint<'a>(sess: &'a Session,
_
=>
sess
.bug
(
"impossible level in raw_emit_lint"
),
};
// Check for future incompatibility lints and issue a stronger warning.
let
future_incompat_lints
=
&
lints
.lint_groups
[
builtin
::
FUTURE_INCOMPATIBLE
];
let
this_id
=
LintId
::
of
(
lint
);
if
future_incompat_lints
.0
.iter
()
.any
(|
&
id
|
id
==
this_id
)
{
let
msg
=
"this lint will become a HARD ERROR in a future release!"
;
if
let
Some
(
sp
)
=
span
{
err
.span_note
(
sp
,
msg
);
}
else
{
err
.note
(
msg
);
}
}
if
let
Some
(
span
)
=
def
{
err
.span_note
(
span
,
"lint level defined here"
);
}
...
...
@@ -450,7 +464,7 @@ fn lookup_and_emit(&self, lint: &'static Lint, span: Option<Span>, msg: &str) {
Some
(
pair
)
=>
pair
,
};
raw_emit_lint
(
&
self
.sess
(),
lint
,
(
level
,
src
),
span
,
msg
);
raw_emit_lint
(
&
self
.sess
(),
self
.lints
(),
lint
,
(
level
,
src
),
span
,
msg
);
}
fn
lookup
(
&
self
,
...
...
@@ -463,7 +477,7 @@ fn lookup(&self,
Some
(
pair
)
=>
pair
,
};
raw_struct_lint
(
&
self
.sess
(),
lint
,
(
level
,
src
),
span
,
msg
)
raw_struct_lint
(
&
self
.sess
(),
self
.lints
(),
lint
,
(
level
,
src
),
span
,
msg
)
}
/// Emit a lint at the appropriate level, for a particular span.
...
...
src/librustc_trans/trans/base.rs
浏览文件 @
27d6b9d2
...
...
@@ -2208,6 +2208,7 @@ fn enum_variant_size_lint(ccx: &CrateContext, enum_def: &hir::EnumDef, sp: Span,
// Use lint::raw_emit_lint rather than sess.add_lint because the lint-printing
// pass for the latter already ran.
lint
::
raw_struct_lint
(
&
ccx
.tcx
()
.sess
,
&
ccx
.tcx
()
.sess.lint_store
.borrow
(),
lint
::
builtin
::
VARIANT_SIZE_DIFFERENCES
,
*
lvlsrc
.unwrap
(),
Some
(
sp
),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录