Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
4b92a5a2
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,发现更多精彩内容 >>
提交
4b92a5a2
编写于
12月 26, 2014
作者:
N
Nick Cameron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rebasing changes
上级
dbde7419
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
30 addition
and
39 deletion
+30
-39
src/libcollections/str.rs
src/libcollections/str.rs
+1
-1
src/librustc/middle/ty.rs
src/librustc/middle/ty.rs
+6
-2
src/librustc_driver/driver.rs
src/librustc_driver/driver.rs
+4
-2
src/librustc_resolve/check_unused.rs
src/librustc_resolve/check_unused.rs
+3
-3
src/librustc_resolve/lib.rs
src/librustc_resolve/lib.rs
+2
-20
src/librustc_resolve/record_exports.rs
src/librustc_resolve/record_exports.rs
+7
-7
src/libstd/c_str.rs
src/libstd/c_str.rs
+1
-2
src/libstd/path/posix.rs
src/libstd/path/posix.rs
+3
-1
src/libstd/path/windows.rs
src/libstd/path/windows.rs
+3
-1
未找到文件。
src/libcollections/str.rs
浏览文件 @
4b92a5a2
...
...
@@ -3330,10 +3330,10 @@ fn test_into_maybe_owned() {
#[cfg(test)]
mod
bench
{
use
super
::
*
;
use
prelude
::
*
;
use
test
::
Bencher
;
use
test
::
black_box
;
use
super
::
*
;
#[bench]
fn
char_iterator
(
b
:
&
mut
Bencher
)
{
...
...
src/librustc/middle/ty.rs
浏览文件 @
4b92a5a2
...
...
@@ -77,7 +77,7 @@
use
std
::
ops
;
use
std
::
rc
::
Rc
;
use
collections
::
enum_set
::{
EnumSet
,
CLike
};
use
std
::
collections
::
hash_map
::
HashMap
;
use
std
::
collections
::
{
HashMap
,
HashSet
}
;
use
std
::
collections
::
hash_map
::
Entry
::{
Occupied
,
Vacant
};
use
syntax
::
abi
;
use
syntax
::
ast
::{
CrateNum
,
DefId
,
DUMMY_NODE_ID
,
Ident
,
ItemTrait
,
LOCAL_CRATE
};
...
...
@@ -105,7 +105,7 @@ pub struct CrateAnalysis<'tcx> {
pub
ty_cx
:
ty
::
ctxt
<
'tcx
>
,
pub
reachable
:
NodeSet
,
pub
name
:
String
,
pub
glob_map
:
Option
<
middle
::
resolve
::
GlobMap
>
,
pub
glob_map
:
Option
<
GlobMap
>
,
}
#[deriving(Copy,
PartialEq,
Eq,
Hash)]
...
...
@@ -6286,6 +6286,10 @@ pub struct Freevar {
// Trait method resolution
pub
type
TraitMap
=
NodeMap
<
Vec
<
DefId
>>
;
// Map from the NodeId of a glob import to a list of items which are actually
// imported.
pub
type
GlobMap
=
HashMap
<
NodeId
,
HashSet
<
Name
>>
;
pub
fn
with_freevars
<
T
,
F
>
(
tcx
:
&
ty
::
ctxt
,
fid
:
ast
::
NodeId
,
f
:
F
)
->
T
where
F
:
FnOnce
(
&
[
Freevar
])
->
T
,
{
...
...
src/librustc_driver/driver.rs
浏览文件 @
4b92a5a2
...
...
@@ -343,10 +343,11 @@ pub fn phase_3_run_analysis_passes<'tcx>(sess: Session,
middle
::
lang_items
::
collect_language_items
(
krate
,
&
sess
));
let
make_glob_map
=
if
save_analysis
(
&
sess
)
{
middle
::
resolve
::
MakeGlobMap
::
Yes
resolve
::
MakeGlobMap
::
Yes
}
else
{
middle
::
resolve
::
MakeGlobMap
::
No
resolve
::
MakeGlobMap
::
No
};
let
resolve
::
CrateMap
{
def_map
,
freevars
,
capture_mode_map
,
...
...
@@ -358,6 +359,7 @@ pub fn phase_3_run_analysis_passes<'tcx>(sess: Session,
}
=
time
(
time_passes
,
"resolution"
,
(),
|
_
|
resolve
::
resolve_crate
(
&
sess
,
&
ast_map
,
&
lang_items
,
krate
,
make_glob_map
));
...
...
src/librustc_resolve/check_unused.rs
浏览文件 @
4b92a5a2
...
...
@@ -33,19 +33,19 @@ struct UnusedImportCheckVisitor<'a, 'b:'a, 'tcx:'b> {
}
// Deref and DerefMut impls allow treating UnusedImportCheckVisitor as Resolver.
impl
<
'a
,
'b
,
'tcx
>
Deref
<
Resolver
<
'b
,
'tcx
>>
for
UnusedImportCheckVisitor
<
'a
,
'b
,
'tcx
:
'b
>
{
impl
<
'a
,
'b
,
'tcx
:
'b
>
Deref
<
Resolver
<
'b
,
'tcx
>>
for
UnusedImportCheckVisitor
<
'a
,
'b
,
'tcx
>
{
fn
deref
<
'c
>
(
&
'c
self
)
->
&
'c
Resolver
<
'b
,
'tcx
>
{
&*
self
.resolver
}
}
impl
<
'a
,
'b
,
'tcx
>
DerefMut
<
Resolver
<
'b
,
'tcx
>>
for
UnusedImportCheckVisitor
<
'a
,
'b
,
'tcx
:
'b
>
{
impl
<
'a
,
'b
,
'tcx
:
'b
>
DerefMut
<
Resolver
<
'b
,
'tcx
>>
for
UnusedImportCheckVisitor
<
'a
,
'b
,
'tcx
>
{
fn
deref_mut
<
'c
>
(
&
'c
mut
self
)
->
&
'c
mut
Resolver
<
'b
,
'tcx
>
{
&
mut
*
self
.resolver
}
}
impl
<
'a
,
'b
>
UnusedImportCheckVisitor
<
'a
,
'b
>
{
impl
<
'a
,
'b
,
'tcx
>
UnusedImportCheckVisitor
<
'a
,
'b
,
'tcx
>
{
// We have information about whether `use` (import) directives are actually used now.
// If an import is not used at all, we signal a lint error. If an import is only used
// for a single namespace, we remove the other namespace from the recorded privacy
...
...
src/librustc_resolve/lib.rs
浏览文件 @
4b92a5a2
...
...
@@ -55,7 +55,7 @@
use
rustc
::
middle
::
pat_util
::
pat_bindings
;
use
rustc
::
middle
::
privacy
::
*
;
use
rustc
::
middle
::
subst
::{
ParamSpace
,
FnSpace
,
TypeSpace
};
use
rustc
::
middle
::
ty
::{
CaptureModeMap
,
Freevar
,
FreevarMap
,
TraitMap
};
use
rustc
::
middle
::
ty
::{
CaptureModeMap
,
Freevar
,
FreevarMap
,
TraitMap
,
GlobMap
};
use
rustc
::
util
::
nodemap
::{
NodeMap
,
NodeSet
,
DefIdSet
,
FnvHashMap
};
use
rustc
::
util
::
lev_distance
::
lev_distance
;
...
...
@@ -66,7 +66,7 @@
use
syntax
::
ast
::{
ForeignItem
,
ForeignItemFn
,
ForeignItemStatic
,
Generics
};
use
syntax
::
ast
::{
Ident
,
ImplItem
,
Item
,
ItemConst
,
ItemEnum
,
ItemFn
};
use
syntax
::
ast
::{
ItemForeignMod
,
ItemImpl
,
ItemMac
,
ItemMod
,
ItemStatic
};
use
syntax
::
ast
::{
ItemStruct
,
ItemTrait
,
ItemTy
,
Local
};
use
syntax
::
ast
::{
ItemStruct
,
ItemTrait
,
ItemTy
,
Local
,
LOCAL_CRATE
};
use
syntax
::
ast
::{
MethodImplItem
,
Mod
,
Name
,
NamedField
,
NodeId
};
use
syntax
::
ast
::{
Pat
,
PatEnum
,
PatIdent
,
PatLit
};
use
syntax
::
ast
::{
PatRange
,
PatStruct
,
Path
,
PathListIdent
,
PathListMod
};
...
...
@@ -110,10 +110,6 @@ struct BindingInfo {
// Map from the name in a pattern to its binding mode.
type
BindingMap
=
HashMap
<
Name
,
BindingInfo
>
;
// Map from the NodeId of a glob import to a list of items which are actually
// imported.
pub
type
GlobMap
=
HashMap
<
NodeId
,
HashSet
<
Name
>>
;
#[deriving(Copy,
PartialEq)]
enum
PatternBindingMode
{
RefutableMode
,
...
...
@@ -970,20 +966,6 @@ fn visit_block(&mut self, block: &Block) {
}
<<<<<<<
HEAD
:
src
/
librustc_resolve
/
lib
.rs
=======
struct
UnusedImportCheckVisitor
<
'a
,
'b
:
'a
,
'tcx
:
'b
>
{
resolver
:
&
'a
mut
Resolver
<
'b
,
'tcx
>
}
impl
<
'a
,
'b
,
'v
,
'tcx
>
Visitor
<
'v
>
for
UnusedImportCheckVisitor
<
'a
,
'b
,
'tcx
>
{
fn
visit_view_item
(
&
mut
self
,
vi
:
&
ViewItem
)
{
self
.resolver
.check_for_item_unused_imports
(
vi
);
visit
::
walk_view_item
(
self
,
vi
);
}
}
>>>>>>>
save
-
analysis
:
emit
names
of
items
that
a
glob
import
actually
imports
.
:
src
/
librustc
/
middle
/
resolve
.rs
#[deriving(PartialEq)]
enum
FallbackChecks
{
Everything
,
...
...
src/librustc_resolve/record_exports.rs
浏览文件 @
4b92a5a2
...
...
@@ -27,24 +27,24 @@
use
std
::
rc
::
Rc
;
struct
ExportRecorder
<
'a
,
'b
:
'a
>
{
resolver
:
&
'a
mut
Resolver
<
'b
>
struct
ExportRecorder
<
'a
,
'b
:
'a
,
'tcx
:
'b
>
{
resolver
:
&
'a
mut
Resolver
<
'b
,
'tcx
>
}
// Deref and DerefMut impls allow treating ExportRecorder as Resolver.
impl
<
'a
,
'b
>
Deref
<
Resolver
<
'b
>>
for
ExportRecorder
<
'a
,
'b
>
{
fn
deref
<
'c
>
(
&
'c
self
)
->
&
'c
Resolver
<
'b
>
{
impl
<
'a
,
'b
,
'tcx
:
'b
>
Deref
<
Resolver
<
'b
,
'tcx
>>
for
ExportRecorder
<
'a
,
'b
,
'tcx
>
{
fn
deref
<
'c
>
(
&
'c
self
)
->
&
'c
Resolver
<
'b
,
'tcx
>
{
&*
self
.resolver
}
}
impl
<
'a
,
'b
>
DerefMut
<
Resolver
<
'b
>>
for
ExportRecorder
<
'a
,
'b
>
{
fn
deref_mut
<
'c
>
(
&
'c
mut
self
)
->
&
'c
mut
Resolver
<
'b
>
{
impl
<
'a
,
'b
,
'tcx
:
'b
>
DerefMut
<
Resolver
<
'b
,
'tcx
>>
for
ExportRecorder
<
'a
,
'b
,
'tcx
>
{
fn
deref_mut
<
'c
>
(
&
'c
mut
self
)
->
&
'c
mut
Resolver
<
'b
,
'tcx
>
{
&
mut
*
self
.resolver
}
}
impl
<
'a
,
'b
>
ExportRecorder
<
'a
,
'b
>
{
impl
<
'a
,
'b
,
'tcx
>
ExportRecorder
<
'a
,
'b
,
'tcx
>
{
fn
record_exports_for_module_subtree
(
&
mut
self
,
module_
:
Rc
<
Module
>
)
{
// If this isn't a local krate, then bail out. We don't need to record
...
...
src/libstd/c_str.rs
浏览文件 @
4b92a5a2
...
...
@@ -534,13 +534,12 @@ pub unsafe fn from_c_multistring<F>(buf: *const libc::c_char,
#[cfg(test)]
mod
tests
{
use
super
::
*
;
use
prelude
::
*
;
use
ptr
;
use
thread
::
Thread
;
use
libc
;
use
super
::
*
;
#[test]
fn
test_str_multistring_parsing
()
{
unsafe
{
...
...
src/libstd/path/posix.rs
浏览文件 @
4b92a5a2
...
...
@@ -448,7 +448,9 @@ fn normalize_helper<'a>(v: &'a [u8], is_abs: bool) -> Option<Vec<&'a [u8]>> {
#[cfg(test)]
mod
tests
{
use
super
::
*
;
use
prelude
::
*
;
use
prelude
::
Option
::{
mod
,
Some
,
None
};
use
prelude
::{
Vec
,
Clone
,
AsSlice
,
SliceExt
,
CloneSliceExt
,
IteratorExt
};
use
prelude
::{
DoubleEndedIteratorExt
,
Str
,
StrExt
,
ToString
,
GenericPath
};
use
str
;
macro_rules!
t
{
...
...
src/libstd/path/windows.rs
浏览文件 @
4b92a5a2
...
...
@@ -1121,8 +1121,10 @@ fn prefix_len(p: Option<PathPrefix>) -> uint {
#[cfg(test)]
mod
tests
{
use
mem
;
use
super
::
*
;
use
prelude
::
Option
::{
mod
,
Some
,
None
};
use
prelude
::{
Vec
,
Clone
,
AsSlice
,
SliceExt
,
CloneSliceExt
,
IteratorExt
};
use
prelude
::{
DoubleEndedIteratorExt
,
Str
,
ToString
,
GenericPath
};
use
super
::
PathPrefix
::
*
;
use
super
::
parse_prefix
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录