Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
7496539a
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,发现更多精彩内容 >>
提交
7496539a
编写于
2月 24, 2015
作者:
I
Ivan Radanov Ivanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Change span_help calls to fileline_help where appropriate
上级
24a840d4
变更
23
隐藏空白更改
内联
并排
Showing
23 changed file
with
76 addition
and
50 deletion
+76
-50
src/librustc/metadata/loader.rs
src/librustc/metadata/loader.rs
+1
-1
src/librustc/metadata/macro_import.rs
src/librustc/metadata/macro_import.rs
+1
-1
src/librustc/middle/check_match.rs
src/librustc/middle/check_match.rs
+1
-1
src/librustc/middle/infer/error_reporting.rs
src/librustc/middle/infer/error_reporting.rs
+3
-3
src/librustc_borrowck/borrowck/gather_loans/move_error.rs
src/librustc_borrowck/borrowck/gather_loans/move_error.rs
+1
-1
src/librustc_borrowck/borrowck/mod.rs
src/librustc_borrowck/borrowck/mod.rs
+7
-3
src/librustc_lint/builtin.rs
src/librustc_lint/builtin.rs
+2
-1
src/librustc_resolve/lib.rs
src/librustc_resolve/lib.rs
+18
-11
src/librustc_trans/trans/foreign.rs
src/librustc_trans/trans/foreign.rs
+1
-1
src/librustc_typeck/astconv.rs
src/librustc_typeck/astconv.rs
+9
-9
src/librustc_typeck/check/callee.rs
src/librustc_typeck/check/callee.rs
+1
-1
src/librustc_typeck/check/mod.rs
src/librustc_typeck/check/mod.rs
+2
-2
src/librustc_typeck/check/wf.rs
src/librustc_typeck/check/wf.rs
+1
-1
src/librustc_typeck/coherence/mod.rs
src/librustc_typeck/coherence/mod.rs
+1
-1
src/librustc_typeck/collect.rs
src/librustc_typeck/collect.rs
+1
-1
src/libsyntax/diagnostics/macros.rs
src/libsyntax/diagnostics/macros.rs
+7
-0
src/libsyntax/ext/base.rs
src/libsyntax/ext/base.rs
+4
-0
src/libsyntax/ext/expand.rs
src/libsyntax/ext/expand.rs
+1
-1
src/libsyntax/feature_gate.rs
src/libsyntax/feature_gate.rs
+2
-2
src/libsyntax/parse/attr.rs
src/libsyntax/parse/attr.rs
+1
-1
src/libsyntax/parse/lexer/mod.rs
src/libsyntax/parse/lexer/mod.rs
+1
-1
src/libsyntax/parse/mod.rs
src/libsyntax/parse/mod.rs
+1
-1
src/libsyntax/parse/parser.rs
src/libsyntax/parse/parser.rs
+9
-6
未找到文件。
src/librustc/metadata/loader.rs
浏览文件 @
7496539a
...
...
@@ -353,7 +353,7 @@ pub fn report_load_errs(&mut self) {
}
}
if
self
.rejected_via_kind
.len
()
>
0
{
self
.sess
.
span
_help
(
self
.span
,
"please recompile this crate using
\
self
.sess
.
fileline
_help
(
self
.span
,
"please recompile this crate using
\
--crate-type lib"
);
let
mismatches
=
self
.rejected_via_kind
.iter
();
for
(
i
,
&
CrateMismatch
{
ref
path
,
..
})
in
mismatches
.enumerate
()
{
...
...
src/librustc/metadata/macro_import.rs
浏览文件 @
7496539a
...
...
@@ -84,7 +84,7 @@ fn visit_item(&mut self, item: &ast::Item) {
}
"plugin"
=>
{
self
.sess
.span_err
(
attr
.span
,
"#[plugin] on `extern crate` is deprecated"
);
self
.sess
.
span
_help
(
attr
.span
,
&
format!
(
"use a crate attribute instead,
\
self
.sess
.
fileline
_help
(
attr
.span
,
&
format!
(
"use a crate attribute instead,
\
i.e. #![plugin({})]"
,
item
.ident
.as_str
()));
}
...
...
src/librustc/middle/check_match.rs
浏览文件 @
7496539a
...
...
@@ -252,7 +252,7 @@ fn check_for_bindings_named_the_same_as_variants(cx: &MatchCheckCtxt, pat: &Pat)
"pattern binding `{}` is named the same as one
\
of the variants of the type `{}`"
,
&
token
::
get_ident
(
ident
.node
),
ty_to_string
(
cx
.tcx
,
pat_ty
));
span
_help!
(
cx
.tcx.sess
,
p
.span
,
fileline
_help!
(
cx
.tcx.sess
,
p
.span
,
"if you meant to match on a variant,
\
consider making the path in the pattern qualified: `{}::{}`"
,
ty_to_string
(
cx
.tcx
,
pat_ty
),
&
token
::
get_ident
(
ident
.node
));
...
...
src/librustc/middle/infer/error_reporting.rs
浏览文件 @
7496539a
...
...
@@ -444,7 +444,7 @@ fn report_generic_bound_failure(&self,
// Does the required lifetime have a nice name we can print?
span_err!
(
self
.tcx.sess
,
origin
.span
(),
E0309
,
"{} may not live long enough"
,
labeled_user_string
);
self
.tcx.sess
.
span
_help
(
self
.tcx.sess
.
fileline
_help
(
origin
.span
(),
&
format!
(
"consider adding an explicit lifetime bound `{}: {}`..."
,
...
...
@@ -456,7 +456,7 @@ fn report_generic_bound_failure(&self,
// Does the required lifetime have a nice name we can print?
span_err!
(
self
.tcx.sess
,
origin
.span
(),
E0310
,
"{} may not live long enough"
,
labeled_user_string
);
self
.tcx.sess
.
span
_help
(
self
.tcx.sess
.
fileline
_help
(
origin
.span
(),
&
format!
(
"consider adding an explicit lifetime bound `{}: 'static`..."
,
...
...
@@ -468,7 +468,7 @@ fn report_generic_bound_failure(&self,
span_err!
(
self
.tcx.sess
,
origin
.span
(),
E0311
,
"{} may not live long enough"
,
labeled_user_string
);
self
.tcx.sess
.
span
_help
(
self
.tcx.sess
.
fileline
_help
(
origin
.span
(),
&
format!
(
"consider adding an explicit lifetime bound for `{}`"
,
...
...
src/librustc_borrowck/borrowck/gather_loans/move_error.rs
浏览文件 @
7496539a
...
...
@@ -165,7 +165,7 @@ fn note_move_destination(bccx: &BorrowckCtxt,
bccx
.span_note
(
move_to_span
,
"attempting to move value to here"
);
bccx
.
span
_help
(
bccx
.
fileline
_help
(
move_to_span
,
&
format!
(
"to prevent the move,
\
use `ref {0}` or `ref mut {0}` to capture value by
\
...
...
src/librustc_borrowck/borrowck/mod.rs
浏览文件 @
7496539a
...
...
@@ -643,7 +643,7 @@ pub fn report_use_of_moved_value<'b>(&self,
ol
,
moved_lp_msg
,
pat_ty
.user_string
(
self
.tcx
)));
self
.tcx.sess
.
span
_help
(
span
,
self
.tcx.sess
.
fileline
_help
(
span
,
"use `ref` to override"
);
}
...
...
@@ -675,7 +675,7 @@ pub fn report_use_of_moved_value<'b>(&self,
moved_lp_msg
,
expr_ty
.user_string
(
self
.tcx
),
suggestion
));
self
.tcx.sess
.
span
_help
(
expr_span
,
help
);
self
.tcx.sess
.
fileline
_help
(
expr_span
,
help
);
}
}
...
...
@@ -741,6 +741,10 @@ pub fn span_help(&self, s: Span, m: &str) {
self
.tcx.sess
.span_help
(
s
,
m
);
}
pub
fn
fileline_help
(
&
self
,
s
:
Span
,
m
:
&
str
)
{
self
.tcx.sess
.fileline_help
(
s
,
m
);
}
pub
fn
bckerr_to_string
(
&
self
,
err
:
&
BckError
<
'tcx
>
)
->
String
{
match
err
.code
{
err_mutbl
=>
{
...
...
@@ -870,7 +874,7 @@ pub fn report_aliasability_violation(&self,
}
if
is_closure
{
self
.tcx.sess
.
span
_help
(
self
.tcx.sess
.
fileline
_help
(
span
,
"closures behind references must be called via `&mut`"
);
}
...
...
src/librustc_lint/builtin.rs
浏览文件 @
7496539a
...
...
@@ -1921,7 +1921,8 @@ fn check_fn(&mut self, cx: &Context, fn_kind: visit::FnKind, _: &ast::FnDecl,
for
call
in
&
self_call_spans
{
sess
.span_note
(
*
call
,
"recursive call site"
)
}
sess
.span_help
(
sp
,
"a `loop` may express intention better if this is on purpose"
)
sess
.fileline_help
(
sp
,
"a `loop` may express intention
\
better if this is on purpose"
)
}
}
...
...
src/librustc_resolve/lib.rs
浏览文件 @
7496539a
...
...
@@ -4115,10 +4115,14 @@ fn resolve_expr(&mut self, expr: &Expr) {
uses it like a function name"
,
path_name
));
self
.session
.span_help
(
expr
.span
,
&
format!
(
"Did you mean to write:
\
`{} {{ /* fields */ }}`?"
,
path_name
));
let
msg
=
format!
(
"Did you mean to write:
\
`{} {{ /* fields */ }}`?"
,
path_name
);
if
self
.emit_errors
{
self
.session
.fileline_help
(
expr
.span
,
&
msg
);
}
else
{
self
.session
.span_help
(
expr
.span
,
&
msg
);
}
}
else
{
// Write the result into the def map.
debug!
(
"(resolving expr) resolved `{}`"
,
...
...
@@ -4146,18 +4150,21 @@ 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
)
=>
{
self
.resolve_error
(
expr
.span
,
self
.resolve_error
(
expr
.span
,
&
format!
(
"`{}` is a structure name, but
\
this expression
\
uses it like a function name"
,
path_name
));
self
.session
.span_help
(
expr
.span
,
&
format!
(
"Did you mean to write:
\
`{} {{ /* fields */ }}`?"
,
path_name
));
}
let
msg
=
format!
(
"Did you mean to write:
\
`{} {{ /* fields */ }}`?"
,
path_name
);
if
self
.emit_errors
{
self
.session
.fileline_help
(
expr
.span
,
&
msg
);
}
else
{
self
.session
.span_help
(
expr
.span
,
&
msg
);
}
}
_
=>
{
// Keep reporting some errors even if they're ignored above.
self
.resolve_path
(
expr
.id
,
path
,
0
,
ValueNS
,
true
);
...
...
src/librustc_trans/trans/foreign.rs
浏览文件 @
7496539a
...
...
@@ -440,7 +440,7 @@ fn gate_simd_ffi(tcx: &ty::ctxt, decl: &ast::FnDecl, ty: &ty::BareFnTy) {
&
format!
(
"use of SIMD type `{}` in FFI is highly experimental and
\
may result in invalid code"
,
pprust
::
ty_to_string
(
ast_ty
)));
tcx
.sess
.
span
_help
(
ast_ty
.span
,
tcx
.sess
.
fileline
_help
(
ast_ty
.span
,
"add #![feature(simd_ffi)] to the crate attributes to enable"
);
}
};
...
...
src/librustc_typeck/astconv.rs
浏览文件 @
7496539a
...
...
@@ -212,18 +212,18 @@ pub fn opt_ast_region_to_region<'tcx>(
}
}
if
len
==
1
{
span
_help!
(
this
.tcx
()
.sess
,
default_span
,
fileline
_help!
(
this
.tcx
()
.sess
,
default_span
,
"this function's return type contains a borrowed value, but
\
the signature does not say which {} it is borrowed from"
,
m
);
}
else
if
len
==
0
{
span
_help!
(
this
.tcx
()
.sess
,
default_span
,
fileline
_help!
(
this
.tcx
()
.sess
,
default_span
,
"this function's return type contains a borrowed value, but
\
there is no value for it to be borrowed from"
);
span
_help!
(
this
.tcx
()
.sess
,
default_span
,
fileline
_help!
(
this
.tcx
()
.sess
,
default_span
,
"consider giving it a 'static lifetime"
);
}
else
{
span
_help!
(
this
.tcx
()
.sess
,
default_span
,
fileline
_help!
(
this
.tcx
()
.sess
,
default_span
,
"this function's return type contains a borrowed value, but
\
the signature does not say whether it is borrowed from {}"
,
m
);
...
...
@@ -705,7 +705,7 @@ fn ast_path_to_trait_ref<'a,'tcx>(
span_err!
(
this
.tcx
()
.sess
,
span
,
E0215
,
"angle-bracket notation is not stable when
\
used with the `Fn` family of traits, use parentheses"
);
span
_help!
(
this
.tcx
()
.sess
,
span
,
fileline
_help!
(
this
.tcx
()
.sess
,
span
,
"add `#![feature(unboxed_closures)]` to
\
the crate attributes to enable"
);
}
...
...
@@ -719,7 +719,7 @@ fn ast_path_to_trait_ref<'a,'tcx>(
span_err!
(
this
.tcx
()
.sess
,
span
,
E0216
,
"parenthetical notation is only stable when
\
used with the `Fn` family of traits"
);
span
_help!
(
this
.tcx
()
.sess
,
span
,
fileline
_help!
(
this
.tcx
()
.sess
,
span
,
"add `#![feature(unboxed_closures)]` to
\
the crate attributes to enable"
);
}
...
...
@@ -944,14 +944,14 @@ fn ast_ty_to_trait_ref<'tcx>(this: &AstConv<'tcx>,
pprust
::
ty_to_string
(
ty
));
match
ty
.node
{
ast
::
TyRptr
(
None
,
ref
mut_ty
)
=>
{
span
_help!
(
this
.tcx
()
.sess
,
ty
.span
,
fileline
_help!
(
this
.tcx
()
.sess
,
ty
.span
,
"perhaps you meant `&{}({} +{})`? (per RFC 438)"
,
ppaux
::
mutability_to_string
(
mut_ty
.mutbl
),
pprust
::
ty_to_string
(
&*
mut_ty
.ty
),
pprust
::
bounds_to_string
(
bounds
));
}
ast
::
TyRptr
(
Some
(
ref
lt
),
ref
mut_ty
)
=>
{
span
_help!
(
this
.tcx
()
.sess
,
ty
.span
,
fileline
_help!
(
this
.tcx
()
.sess
,
ty
.span
,
"perhaps you meant `&{} {}({} +{})`? (per RFC 438)"
,
pprust
::
lifetime_to_string
(
lt
),
ppaux
::
mutability_to_string
(
mut_ty
.mutbl
),
...
...
@@ -960,7 +960,7 @@ fn ast_ty_to_trait_ref<'tcx>(this: &AstConv<'tcx>,
}
_
=>
{
span
_help!
(
this
.tcx
()
.sess
,
ty
.span
,
fileline
_help!
(
this
.tcx
()
.sess
,
ty
.span
,
"perhaps you forgot parentheses? (per RFC 438)"
);
}
}
...
...
src/librustc_typeck/check/callee.rs
浏览文件 @
7496539a
...
...
@@ -63,7 +63,7 @@ pub fn check_legal_trait_for_method_call(ccx: &CrateCtxt, span: Span, trait_id:
span_err!
(
tcx
.sess
,
span
,
E0174
,
"explicit use of unboxed closure method `{}` is experimental"
,
method
);
span
_help!
(
tcx
.sess
,
span
,
fileline
_help!
(
tcx
.sess
,
span
,
"add `#![feature(unboxed_closures)]` to the crate attributes to enable"
);
}
}
...
...
src/librustc_typeck/check/mod.rs
浏览文件 @
7496539a
...
...
@@ -3098,7 +3098,7 @@ fn check_field<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
},
expr_t
,
None
);
tcx
.sess
.
span
_help
(
field
.span
,
tcx
.sess
.
fileline
_help
(
field
.span
,
"maybe a `()` to call it is missing?
\
If not, try an anonymous function"
);
}
else
{
...
...
@@ -4480,7 +4480,7 @@ pub fn check_instantiable(tcx: &ty::ctxt,
span_err!
(
tcx
.sess
,
sp
,
E0073
,
"this type cannot be instantiated without an
\
instance of itself"
);
span
_help!
(
tcx
.sess
,
sp
,
"consider using `Option<{}>`"
,
fileline
_help!
(
tcx
.sess
,
sp
,
"consider using `Option<{}>`"
,
ppaux
::
ty_to_string
(
tcx
,
item_ty
));
false
}
else
{
...
...
src/librustc_typeck/check/wf.rs
浏览文件 @
7496539a
...
...
@@ -400,7 +400,7 @@ fn report_bivariance(&self,
match
suggested_marker_id
{
Some
(
def_id
)
=>
{
self
.tcx
()
.sess
.
span
_help
(
self
.tcx
()
.sess
.
fileline
_help
(
span
,
format!
(
"consider removing `{}` or using a marker such as `{}`"
,
param_name
.user_string
(
self
.tcx
()),
...
...
src/librustc_typeck/coherence/mod.rs
浏览文件 @
7496539a
...
...
@@ -524,7 +524,7 @@ fn enforce_trait_manually_implementable(tcx: &ty::ctxt, sp: Span, trait_def_id:
return
// everything OK
};
span_err!
(
tcx
.sess
,
sp
,
E0183
,
"manual implementations of `{}` are experimental"
,
trait_name
);
span
_help!
(
tcx
.sess
,
sp
,
fileline
_help!
(
tcx
.sess
,
sp
,
"add `#![feature(unboxed_closures)]` to the crate attributes to enable"
);
}
...
...
src/librustc_typeck/collect.rs
浏览文件 @
7496539a
...
...
@@ -1217,7 +1217,7 @@ fn trait_def_of_item<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
it
.span
,
"the `#[rustc_paren_sugar]` attribute is a temporary means of controlling
\
which traits can use parenthetical notation"
);
span
_help!
(
ccx
.tcx.sess
,
it
.span
,
fileline
_help!
(
ccx
.tcx.sess
,
it
.span
,
"add `#![feature(unboxed_closures)]` to
\
the crate attributes to use it"
);
}
...
...
src/libsyntax/diagnostics/macros.rs
浏览文件 @
7496539a
...
...
@@ -52,6 +52,13 @@
})
}
#[macro_export]
macro_rules!
fileline_help
{
(
$session:expr
,
$span:expr
,
$
(
$message:tt
)
*
)
=>
({
(
$session
)
.fileline_help
(
$span
,
&
format!
(
$
(
$message
)
*
))
})
}
#[macro_export]
macro_rules!
register_diagnostics
{
(
$
(
$code:tt
),
*
)
=>
(
...
...
src/libsyntax/ext/base.rs
浏览文件 @
7496539a
...
...
@@ -747,6 +747,10 @@ pub fn span_help(&self, sp: Span, msg: &str) {
self
.print_backtrace
();
self
.parse_sess.span_diagnostic
.span_help
(
sp
,
msg
);
}
pub
fn
fileline_help
(
&
self
,
sp
:
Span
,
msg
:
&
str
)
{
self
.print_backtrace
();
self
.parse_sess.span_diagnostic
.fileline_help
(
sp
,
msg
);
}
pub
fn
bug
(
&
self
,
msg
:
&
str
)
->
!
{
self
.print_backtrace
();
self
.parse_sess.span_diagnostic
.handler
()
.bug
(
msg
);
...
...
src/libsyntax/ext/expand.rs
浏览文件 @
7496539a
...
...
@@ -571,7 +571,7 @@ fn contains_macro_use(fld: &mut MacroExpander, attrs: &[ast::Attribute]) -> bool
fld
.cx
.span_warn
(
attr
.span
,
"macro_escape is a deprecated synonym for macro_use"
);
is_use
=
true
;
if
let
ast
::
AttrInner
=
attr
.node.style
{
fld
.cx
.
span
_help
(
attr
.span
,
"consider an outer attribute,
\
fld
.cx
.
fileline
_help
(
attr
.span
,
"consider an outer attribute,
\
#[macro_use] mod ..."
);
}
};
...
...
src/libsyntax/feature_gate.rs
浏览文件 @
7496539a
...
...
@@ -358,7 +358,7 @@ fn has_feature(&self, feature: &str) -> bool {
pub
fn
emit_feature_err
(
diag
:
&
SpanHandler
,
feature
:
&
str
,
span
:
Span
,
explain
:
&
str
)
{
diag
.span_err
(
span
,
explain
);
diag
.
span
_help
(
span
,
&
format!
(
"add #![feature({})] to the
\
diag
.
fileline
_help
(
span
,
&
format!
(
"add #![feature({})] to the
\
crate attributes to enable"
,
feature
));
}
...
...
@@ -366,7 +366,7 @@ pub fn emit_feature_err(diag: &SpanHandler, feature: &str, span: Span, explain:
pub
fn
emit_feature_warn
(
diag
:
&
SpanHandler
,
feature
:
&
str
,
span
:
Span
,
explain
:
&
str
)
{
diag
.span_warn
(
span
,
explain
);
if
diag
.handler.can_emit_warnings
{
diag
.
span
_help
(
span
,
&
format!
(
"add #![feature({})] to the
\
diag
.
fileline
_help
(
span
,
&
format!
(
"add #![feature({})] to the
\
crate attributes to silence this warning"
,
feature
));
}
...
...
src/libsyntax/parse/attr.rs
浏览文件 @
7496539a
...
...
@@ -77,7 +77,7 @@ fn parse_attribute(&mut self, permit_inner: bool) -> ast::Attribute {
self
.span_err
(
span
,
"an inner attribute is not permitted in
\
this context"
);
self
.
span
_help
(
span
,
self
.
fileline
_help
(
span
,
"place inner attribute at the top of the module or block"
);
}
ast
::
AttrInner
...
...
src/libsyntax/parse/lexer/mod.rs
浏览文件 @
7496539a
...
...
@@ -772,7 +772,7 @@ fn old_escape_warning(&mut self, sp: Span) {
self
.span_diagnostic
.span_warn
(
sp
,
"
\\
U00ABCD12 and
\\
uABCD escapes are deprecated"
);
self
.span_diagnostic
.
span
_help
(
sp
,
"use
\\
u{ABCD12} escapes instead"
);
.
fileline
_help
(
sp
,
"use
\\
u{ABCD12} escapes instead"
);
}
/// Scan for a single (possibly escaped) byte or char
...
...
src/libsyntax/parse/mod.rs
浏览文件 @
7496539a
...
...
@@ -722,7 +722,7 @@ pub fn integer_lit(s: &str, suffix: Option<&str>, sd: &SpanHandler, sp: Span) ->
&
suf
[
1
..
]));
}
else
{
sd
.span_err
(
sp
,
&*
format!
(
"illegal suffix `{}` for numeric literal"
,
suf
));
sd
.
span
_help
(
sp
,
"the suffix must be one of the integral types
\
sd
.
fileline
_help
(
sp
,
"the suffix must be one of the integral types
\
(`u32`, `isize`, etc)"
);
}
...
...
src/libsyntax/parse/parser.rs
浏览文件 @
7496539a
...
...
@@ -973,7 +973,7 @@ pub fn span_fatal(&self, sp: Span, m: &str) -> ! {
}
pub
fn
span_fatal_help
(
&
self
,
sp
:
Span
,
m
:
&
str
,
help
:
&
str
)
->
!
{
self
.span_err
(
sp
,
m
);
self
.
span
_help
(
sp
,
help
);
self
.
fileline
_help
(
sp
,
help
);
panic!
(
diagnostic
::
FatalError
);
}
pub
fn
span_note
(
&
self
,
sp
:
Span
,
m
:
&
str
)
{
...
...
@@ -982,6 +982,9 @@ pub fn span_note(&self, sp: Span, m: &str) {
pub
fn
span_help
(
&
self
,
sp
:
Span
,
m
:
&
str
)
{
self
.sess.span_diagnostic
.span_help
(
sp
,
m
)
}
pub
fn
fileline_help
(
&
self
,
sp
:
Span
,
m
:
&
str
)
{
self
.sess.span_diagnostic
.fileline_help
(
sp
,
m
)
}
pub
fn
bug
(
&
self
,
m
:
&
str
)
->
!
{
self
.sess.span_diagnostic
.span_bug
(
self
.span
,
m
)
}
...
...
@@ -2531,7 +2534,7 @@ pub fn parse_dot_or_call_expr_with(&mut self, e0: P<Expr>) -> P<Expr> {
Some
(
f
)
=>
f
,
None
=>
continue
,
};
self
.
span
_help
(
last_span
,
self
.
fileline
_help
(
last_span
,
&
format!
(
"try parenthesizing the first index; e.g., `(foo.{}){}`"
,
float
.trunc
()
as
usize
,
&
float
.fract
()
.to_string
()[
1
..
]));
...
...
@@ -2942,7 +2945,7 @@ fn check_no_chained_comparison(&mut self, lhs: &Expr, outer_op: ast::BinOp_) {
self
.span_err
(
op_span
,
"chained comparison operators require parentheses"
);
if
op
.node
==
BiLt
&&
outer_op
==
BiGt
{
self
.
span
_help
(
op_span
,
self
.
fileline
_help
(
op_span
,
"use `::<...>` instead of `<...>` if you meant to specify type arguments"
);
}
}
...
...
@@ -4698,7 +4701,7 @@ fn complain_if_pub_macro(&mut self, visa: Visibility, span: Span) {
match
visa
{
Public
=>
{
self
.span_err
(
span
,
"can't qualify macro invocation with `pub`"
);
self
.
span
_help
(
span
,
"try adjusting the macro to put `pub` inside
\
self
.
fileline
_help
(
span
,
"try adjusting the macro to put `pub` inside
\
the invocation"
);
}
Inherited
=>
(),
...
...
@@ -5435,7 +5438,7 @@ fn parse_item_extern_crate(&mut self,
if
self
.token
.is_ident
()
{
self
.bump
();
}
self
.span_err
(
span
,
"expected `;`, found `as`"
);
self
.
span
_help
(
span
,
self
.
fileline
_help
(
span
,
&
format!
(
"perhaps you meant to enclose the crate name `{}` in
\
a string?"
,
the_ident
.as_str
()));
...
...
@@ -5746,7 +5749,7 @@ fn parse_item_(&mut self, attrs: Vec<Attribute>,
if
self
.eat_keyword
(
keywords
::
Mut
)
{
let
last_span
=
self
.last_span
;
self
.span_err
(
last_span
,
"const globals cannot be mutable"
);
self
.
span
_help
(
last_span
,
"did you mean to declare a static?"
);
self
.
fileline
_help
(
last_span
,
"did you mean to declare a static?"
);
}
let
(
ident
,
item_
,
extra_attrs
)
=
self
.parse_item_const
(
None
);
let
last_span
=
self
.last_span
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录