Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
6138c828
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,发现更多精彩内容 >>
提交
6138c828
编写于
8月 18, 2018
作者:
D
Donato Sciarra
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix tidy errors
上级
a2ff845f
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
36 addition
and
19 deletion
+36
-19
src/libproc_macro/lib.rs
src/libproc_macro/lib.rs
+1
-1
src/librustc_errors/lib.rs
src/librustc_errors/lib.rs
+8
-1
src/librustc_lint/builtin.rs
src/librustc_lint/builtin.rs
+2
-1
src/librustc_metadata/decoder.rs
src/librustc_metadata/decoder.rs
+4
-2
src/librustc_typeck/check/compare_method.rs
src/librustc_typeck/check/compare_method.rs
+2
-1
src/librustc_typeck/check/method/suggest.rs
src/librustc_typeck/check/method/suggest.rs
+2
-1
src/librustdoc/html/highlight.rs
src/librustdoc/html/highlight.rs
+4
-2
src/libsyntax/parse/lexer/mod.rs
src/libsyntax/parse/lexer/mod.rs
+6
-6
src/libsyntax/parse/mod.rs
src/libsyntax/parse/mod.rs
+3
-2
src/libsyntax/source_map.rs
src/libsyntax/source_map.rs
+4
-2
未找到文件。
src/libproc_macro/lib.rs
浏览文件 @
6138c828
...
...
@@ -432,7 +432,7 @@ impl SourceFile {
///
/// ### Note
/// If the code span associated with this `SourceFile` was generated by an external macro, this
/// may not be an actual path on the filesystem. Use [`is_real`] to check.
/// ma
cro, this ma
y not be an actual path on the filesystem. Use [`is_real`] to check.
///
/// Also note that even if `is_real` returns `true`, if `--remap-path-prefix` was passed on
/// the command line, the path as given may not actually be valid.
...
...
src/librustc_errors/lib.rs
浏览文件 @
6138c828
...
...
@@ -55,7 +55,14 @@
mod
styled_buffer
;
mod
lock
;
use
syntax_pos
::{
BytePos
,
Loc
,
FileLinesResult
,
SourceFile
,
FileName
,
MultiSpan
,
Span
,
NO_EXPANSION
};
use
syntax_pos
::{
BytePos
,
Loc
,
FileLinesResult
,
SourceFile
,
FileName
,
MultiSpan
,
Span
,
NO_EXPANSION
};
#[derive(Copy,
Clone,
Debug,
PartialEq,
Hash,
RustcEncodable,
RustcDecodable)]
pub
enum
Applicability
{
...
...
src/librustc_lint/builtin.rs
浏览文件 @
6138c828
...
...
@@ -195,7 +195,8 @@ fn check_pat(&mut self, cx: &LateContext, pat: &hir::Pat) {
let
mut
err
=
cx
.struct_span_lint
(
NON_SHORTHAND_FIELD_PATTERNS
,
fieldpat
.span
,
&
format!
(
"the `{}:` in this pattern is redundant"
,
ident
));
let
subspan
=
cx
.tcx.sess
.source_map
()
.span_through_char
(
fieldpat
.span
,
':'
);
let
subspan
=
cx
.tcx.sess
.source_map
()
.span_through_char
(
fieldpat
.span
,
':'
);
err
.span_suggestion_short_with_applicability
(
subspan
,
"remove this"
,
...
...
src/librustc_metadata/decoder.rs
浏览文件 @
6138c828
...
...
@@ -349,8 +349,10 @@ fn specialized_decode(&mut self) -> Result<Span, Self::Error> {
debug_assert!
(
hi
>=
source_file
.original_start_pos
&&
hi
<=
source_file
.original_end_pos
);
let
lo
=
(
lo
+
source_file
.translated_source_file.start_pos
)
-
source_file
.original_start_pos
;
let
hi
=
(
hi
+
source_file
.translated_source_file.start_pos
)
-
source_file
.original_start_pos
;
let
lo
=
(
lo
+
source_file
.translated_source_file.start_pos
)
-
source_file
.original_start_pos
;
let
hi
=
(
hi
+
source_file
.translated_source_file.start_pos
)
-
source_file
.original_start_pos
;
Ok
(
Span
::
new
(
lo
,
hi
,
NO_EXPANSION
))
}
...
...
src/librustc_typeck/check/compare_method.rs
浏览文件 @
6138c828
...
...
@@ -319,7 +319,8 @@ fn compare_predicate_entailment<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
trait_m
.ident
);
if
let
TypeError
::
Mutability
=
terr
{
if
let
Some
(
trait_err_span
)
=
trait_err_span
{
if
let
Ok
(
trait_err_str
)
=
tcx
.sess
.source_map
()
.span_to_snippet
(
trait_err_span
)
{
if
let
Ok
(
trait_err_str
)
=
tcx
.sess
.source_map
()
.
span_to_snippet
(
trait_err_span
)
{
diag
.span_suggestion
(
impl_err_span
,
"consider change the type to match the mutability in trait"
,
...
...
src/librustc_typeck/check/method/suggest.rs
浏览文件 @
6138c828
...
...
@@ -132,7 +132,8 @@ pub fn report_method_error(&self,
};
if
let
Some
(
note_span
)
=
note_span
{
// We have a span pointing to the method. Show note with snippet.
err
.span_note
(
self
.tcx.sess
.source_map
()
.def_span
(
note_span
),
&
note_str
);
err
.span_note
(
self
.tcx.sess
.source_map
()
.def_span
(
note_span
),
&
note_str
);
}
else
{
err
.note
(
&
note_str
);
}
...
...
src/librustdoc/html/highlight.rs
浏览文件 @
6138c828
...
...
@@ -33,7 +33,8 @@ pub fn render_with_highlighting(src: &str, class: Option<&str>,
tooltip
:
Option
<
(
&
str
,
&
str
)
>
)
->
String
{
debug!
(
"highlighting: ================
\n
{}
\n
=============="
,
src
);
let
sess
=
parse
::
ParseSess
::
new
(
FilePathMapping
::
empty
());
let
fm
=
sess
.source_map
()
.new_source_file
(
FileName
::
Custom
(
"stdin"
.to_string
()),
src
.to_string
());
let
fm
=
sess
.source_map
()
.new_source_file
(
FileName
::
Custom
(
"stdin"
.to_string
()),
src
.to_string
());
let
mut
out
=
Vec
::
new
();
if
let
Some
((
tooltip
,
class
))
=
tooltip
{
...
...
@@ -43,7 +44,8 @@ pub fn render_with_highlighting(src: &str, class: Option<&str>,
}
write_header
(
class
,
&
mut
out
)
.unwrap
();
let
mut
classifier
=
Classifier
::
new
(
lexer
::
StringReader
::
new
(
&
sess
,
fm
,
None
),
sess
.source_map
());
let
mut
classifier
=
Classifier
::
new
(
lexer
::
StringReader
::
new
(
&
sess
,
fm
,
None
),
sess
.source_map
());
if
classifier
.write_source
(
&
mut
out
)
.is_err
()
{
return
format!
(
"<pre>{}</pre>"
,
src
);
}
...
...
src/libsyntax/parse/lexer/mod.rs
浏览文件 @
6138c828
...
...
@@ -180,9 +180,9 @@ pub fn peek(&self) -> TokenAndSpan {
}
/// For comments.rs, which hackily pokes into next_pos and ch
fn
new_raw
(
sess
:
&
'a
ParseSess
,
source_file
:
Lrc
<
syntax_pos
::
SourceFile
>
,
override_span
:
Option
<
Span
>
)
->
Self
{
fn
new_raw
(
sess
:
&
'a
ParseSess
,
source_file
:
Lrc
<
syntax_pos
::
SourceFile
>
,
override_span
:
Option
<
Span
>
)
->
Self
{
let
mut
sr
=
StringReader
::
new_raw_internal
(
sess
,
source_file
,
override_span
);
sr
.bump
();
...
...
@@ -221,9 +221,9 @@ fn new_raw_internal(sess: &'a ParseSess, source_file: Lrc<syntax_pos::SourceFile
}
}
pub
fn
new
(
sess
:
&
'a
ParseSess
,
source_file
:
Lrc
<
syntax_pos
::
SourceFile
>
,
override_span
:
Option
<
Span
>
)
->
Self
{
pub
fn
new
(
sess
:
&
'a
ParseSess
,
source_file
:
Lrc
<
syntax_pos
::
SourceFile
>
,
override_span
:
Option
<
Span
>
)
->
Self
{
let
mut
sr
=
StringReader
::
new_raw
(
sess
,
source_file
,
override_span
);
if
sr
.advance_token
()
.is_err
()
{
sr
.emit_fatal_errors
();
...
...
src/libsyntax/parse/mod.rs
浏览文件 @
6138c828
...
...
@@ -240,8 +240,9 @@ fn file_to_source_file(sess: &ParseSess, path: &Path, spanopt: Option<Span>)
}
/// Given a source_file, produce a sequence of token-trees
pub
fn
source_file_to_stream
(
sess
:
&
ParseSess
,
source_file
:
Lrc
<
SourceFile
>
,
override_span
:
Option
<
Span
>
)
->
TokenStream
{
pub
fn
source_file_to_stream
(
sess
:
&
ParseSess
,
source_file
:
Lrc
<
SourceFile
>
,
override_span
:
Option
<
Span
>
)
->
TokenStream
{
let
mut
srdr
=
lexer
::
StringReader
::
new
(
sess
,
source_file
,
override_span
);
srdr
.real_token
();
panictry!
(
srdr
.parse_all_token_trees
())
...
...
src/libsyntax/source_map.rs
浏览文件 @
6138c828
...
...
@@ -241,7 +241,8 @@ pub fn new_source_file(&self, filename: FileName, src: String) -> Lrc<SourceFile
let
mut
files
=
self
.files
.borrow_mut
();
files
.file_maps
.push
(
source_file
.clone
());
files
.stable_id_to_source_file
.insert
(
StableFilemapId
::
new
(
&
source_file
),
source_file
.clone
());
files
.stable_id_to_source_file
.insert
(
StableFilemapId
::
new
(
&
source_file
),
source_file
.clone
());
source_file
}
...
...
@@ -297,7 +298,8 @@ pub fn new_imported_source_file(&self,
let
mut
files
=
self
.files
.borrow_mut
();
files
.file_maps
.push
(
source_file
.clone
());
files
.stable_id_to_source_file
.insert
(
StableFilemapId
::
new
(
&
source_file
),
source_file
.clone
());
files
.stable_id_to_source_file
.insert
(
StableFilemapId
::
new
(
&
source_file
),
source_file
.clone
());
source_file
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录