Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
d6f70359
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,发现更多精彩内容 >>
提交
d6f70359
编写于
11月 23, 2017
作者:
I
Irina-Gabriela Popa
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rustc_back: remove slice module in favor of std::slice::from_ref.
上级
fdfbcf85
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
28 addition
and
54 deletion
+28
-54
src/Cargo.lock
src/Cargo.lock
+0
-3
src/librustc/lib.rs
src/librustc/lib.rs
+1
-0
src/librustc/lint/context.rs
src/librustc/lint/context.rs
+2
-2
src/librustc/middle/resolve_lifetime.rs
src/librustc/middle/resolve_lifetime.rs
+2
-2
src/librustc/mir/mod.rs
src/librustc/mir/mod.rs
+7
-7
src/librustc_back/lib.rs
src/librustc_back/lib.rs
+0
-1
src/librustc_back/slice.rs
src/librustc_back/slice.rs
+0
-19
src/librustc_borrowck/Cargo.toml
src/librustc_borrowck/Cargo.toml
+0
-1
src/librustc_borrowck/borrowck/unused.rs
src/librustc_borrowck/borrowck/unused.rs
+3
-3
src/librustc_borrowck/lib.rs
src/librustc_borrowck/lib.rs
+1
-1
src/librustc_const_eval/Cargo.toml
src/librustc_const_eval/Cargo.toml
+0
-1
src/librustc_const_eval/check_match.rs
src/librustc_const_eval/check_match.rs
+3
-3
src/librustc_const_eval/lib.rs
src/librustc_const_eval/lib.rs
+1
-1
src/librustc_typeck/Cargo.toml
src/librustc_typeck/Cargo.toml
+0
-1
src/librustc_typeck/astconv.rs
src/librustc_typeck/astconv.rs
+3
-3
src/librustc_typeck/check/mod.rs
src/librustc_typeck/check/mod.rs
+4
-5
src/librustc_typeck/lib.rs
src/librustc_typeck/lib.rs
+1
-1
未找到文件。
src/Cargo.lock
浏览文件 @
d6f70359
...
...
@@ -1687,7 +1687,6 @@ dependencies = [
"graphviz 0.0.0",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc 0.0.0",
"rustc_back 0.0.0",
"rustc_errors 0.0.0",
"rustc_mir 0.0.0",
"syntax 0.0.0",
...
...
@@ -1701,7 +1700,6 @@ dependencies = [
"arena 0.0.0",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc 0.0.0",
"rustc_back 0.0.0",
"rustc_const_math 0.0.0",
"rustc_data_structures 0.0.0",
"rustc_errors 0.0.0",
...
...
@@ -1999,7 +1997,6 @@ dependencies = [
"fmt_macros 0.0.0",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc 0.0.0",
"rustc_back 0.0.0",
"rustc_const_math 0.0.0",
"rustc_data_structures 0.0.0",
"rustc_errors 0.0.0",
...
...
src/librustc/lib.rs
浏览文件 @
d6f70359
...
...
@@ -46,6 +46,7 @@
#![feature(const_fn)]
#![feature(core_intrinsics)]
#![feature(drain_filter)]
#![feature(from_ref)]
#![feature(i128)]
#![feature(i128_type)]
#![feature(inclusive_range)]
...
...
src/librustc/lint/context.rs
浏览文件 @
d6f70359
...
...
@@ -26,7 +26,7 @@
use
self
::
TargetLint
::
*
;
use
rustc_back
::
slice
;
use
std
::
slice
;
use
lint
::{
EarlyLintPassObject
,
LateLintPassObject
};
use
lint
::{
Level
,
Lint
,
LintId
,
LintPass
,
LintBuffer
};
use
lint
::
levels
::{
LintLevelSets
,
LintLevelsBuilder
};
...
...
@@ -308,7 +308,7 @@ pub fn check_lint_name(&self, lint_name: &str) -> CheckLintNameResult {
Some
(
ids
)
=>
CheckLintNameResult
::
Ok
(
&
ids
.0
),
}
}
Some
(
&
Id
(
ref
id
))
=>
CheckLintNameResult
::
Ok
(
slice
::
ref_slice
(
id
)),
Some
(
&
Id
(
ref
id
))
=>
CheckLintNameResult
::
Ok
(
slice
::
from_ref
(
id
)),
}
}
}
...
...
src/librustc/middle/resolve_lifetime.rs
浏览文件 @
d6f70359
...
...
@@ -31,7 +31,7 @@
use
errors
::
DiagnosticBuilder
;
use
util
::
common
::
ErrorReported
;
use
util
::
nodemap
::{
NodeMap
,
NodeSet
,
FxHashSet
,
FxHashMap
,
DefIdMap
};
use
rustc_back
::
slice
;
use
std
::
slice
;
use
hir
;
use
hir
::
intravisit
::{
self
,
Visitor
,
NestedVisitorMap
};
...
...
@@ -530,7 +530,7 @@ fn visit_impl_item(&mut self, impl_item: &'tcx hir::ImplItem) {
fn
visit_lifetime
(
&
mut
self
,
lifetime_ref
:
&
'tcx
hir
::
Lifetime
)
{
if
lifetime_ref
.is_elided
()
{
self
.resolve_elided_lifetimes
(
slice
::
ref_slice
(
lifetime_ref
));
self
.resolve_elided_lifetimes
(
slice
::
from_ref
(
lifetime_ref
));
return
;
}
if
lifetime_ref
.is_static
()
{
...
...
src/librustc/mir/mod.rs
浏览文件 @
d6f70359
...
...
@@ -25,7 +25,7 @@
use
ty
::{
self
,
AdtDef
,
ClosureSubsts
,
Region
,
Ty
,
TyCtxt
,
GeneratorInterior
};
use
ty
::
fold
::{
TypeFoldable
,
TypeFolder
,
TypeVisitor
};
use
util
::
ppaux
;
use
rustc_back
::
slice
;
use
std
::
slice
;
use
hir
::{
self
,
InlineAsm
};
use
std
::
ascii
;
use
std
::
borrow
::{
Cow
};
...
...
@@ -754,28 +754,28 @@ pub fn if_<'a, 'gcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, cond: Operand<'tcx>,
pub
fn
successors
(
&
self
)
->
Cow
<
[
BasicBlock
]
>
{
use
self
::
TerminatorKind
::
*
;
match
*
self
{
Goto
{
target
:
ref
b
}
=>
slice
::
ref_slice
(
b
)
.into_cow
(),
Goto
{
target
:
ref
b
}
=>
slice
::
from_ref
(
b
)
.into_cow
(),
SwitchInt
{
targets
:
ref
b
,
..
}
=>
b
[
..
]
.into_cow
(),
Resume
|
GeneratorDrop
=>
(
&
[])
.into_cow
(),
Return
=>
(
&
[])
.into_cow
(),
Unreachable
=>
(
&
[])
.into_cow
(),
Call
{
destination
:
Some
((
_
,
t
)),
cleanup
:
Some
(
c
),
..
}
=>
vec!
[
t
,
c
]
.into_cow
(),
Call
{
destination
:
Some
((
_
,
ref
t
)),
cleanup
:
None
,
..
}
=>
slice
::
ref_slice
(
t
)
.into_cow
(),
Call
{
destination
:
None
,
cleanup
:
Some
(
ref
c
),
..
}
=>
slice
::
ref_slice
(
c
)
.into_cow
(),
slice
::
from_ref
(
t
)
.into_cow
(),
Call
{
destination
:
None
,
cleanup
:
Some
(
ref
c
),
..
}
=>
slice
::
from_ref
(
c
)
.into_cow
(),
Call
{
destination
:
None
,
cleanup
:
None
,
..
}
=>
(
&
[])
.into_cow
(),
Yield
{
resume
:
t
,
drop
:
Some
(
c
),
..
}
=>
vec!
[
t
,
c
]
.into_cow
(),
Yield
{
resume
:
ref
t
,
drop
:
None
,
..
}
=>
slice
::
ref_slice
(
t
)
.into_cow
(),
Yield
{
resume
:
ref
t
,
drop
:
None
,
..
}
=>
slice
::
from_ref
(
t
)
.into_cow
(),
DropAndReplace
{
target
,
unwind
:
Some
(
unwind
),
..
}
|
Drop
{
target
,
unwind
:
Some
(
unwind
),
..
}
=>
{
vec!
[
target
,
unwind
]
.into_cow
()
}
DropAndReplace
{
ref
target
,
unwind
:
None
,
..
}
|
Drop
{
ref
target
,
unwind
:
None
,
..
}
=>
{
slice
::
ref_slice
(
target
)
.into_cow
()
slice
::
from_ref
(
target
)
.into_cow
()
}
Assert
{
target
,
cleanup
:
Some
(
unwind
),
..
}
=>
vec!
[
target
,
unwind
]
.into_cow
(),
Assert
{
ref
target
,
..
}
=>
slice
::
ref_slice
(
target
)
.into_cow
(),
Assert
{
ref
target
,
..
}
=>
slice
::
from_ref
(
target
)
.into_cow
(),
FalseEdges
{
ref
real_target
,
ref
imaginary_targets
}
=>
{
let
mut
s
=
vec!
[
*
real_target
];
s
.extend_from_slice
(
imaginary_targets
);
...
...
src/librustc_back/lib.rs
浏览文件 @
d6f70359
...
...
@@ -40,7 +40,6 @@
pub
mod
tempdir
;
pub
mod
target
;
pub
mod
slice
;
pub
mod
dynamic_lib
;
use
std
::
str
::
FromStr
;
...
...
src/librustc_back/slice.rs
已删除
100644 → 0
浏览文件 @
fdfbcf85
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use
std
::
mem
;
pub
fn
ref_slice
<
T
>
(
ptr
:
&
T
)
->
&
[
T
;
1
]
{
unsafe
{
mem
::
transmute
(
ptr
)
}
}
pub
fn
mut_ref_slice
<
T
>
(
ptr
:
&
mut
T
)
->
&
mut
[
T
;
1
]
{
unsafe
{
mem
::
transmute
(
ptr
)
}
}
src/librustc_borrowck/Cargo.toml
浏览文件 @
d6f70359
...
...
@@ -15,6 +15,5 @@ syntax = { path = "../libsyntax" }
syntax_pos
=
{
path
=
"../libsyntax_pos"
}
graphviz
=
{
path
=
"../libgraphviz"
}
rustc
=
{
path
=
"../librustc"
}
rustc_back
=
{
path
=
"../librustc_back"
}
rustc_mir
=
{
path
=
"../librustc_mir"
}
rustc_errors
=
{
path
=
"../librustc_errors"
}
src/librustc_borrowck/borrowck/unused.rs
浏览文件 @
d6f70359
...
...
@@ -13,7 +13,7 @@
use
rustc
::
lint
::
builtin
::
UNUSED_MUT
;
use
rustc
::
ty
;
use
rustc
::
util
::
nodemap
::{
FxHashMap
,
FxHashSet
};
use
rustc_back
::
slice
;
use
std
::
slice
;
use
syntax
::
ptr
::
P
;
use
borrowck
::
BorrowckCtxt
;
...
...
@@ -26,7 +26,7 @@ pub fn check<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, body: &'tcx hir::Body) {
}
.visit_expr
(
&
body
.value
);
let
mut
cx
=
UnusedMutCx
{
bccx
,
used_mut
};
for
arg
in
body
.arguments
.iter
()
{
cx
.check_unused_mut_pat
(
slice
::
ref_slice
(
&
arg
.pat
));
cx
.check_unused_mut_pat
(
slice
::
from_ref
(
&
arg
.pat
));
}
cx
.visit_expr
(
&
body
.value
);
}
...
...
@@ -101,7 +101,7 @@ fn visit_arm(&mut self, arm: &hir::Arm) {
}
fn
visit_local
(
&
mut
self
,
local
:
&
hir
::
Local
)
{
self
.check_unused_mut_pat
(
slice
::
ref_slice
(
&
local
.pat
));
self
.check_unused_mut_pat
(
slice
::
from_ref
(
&
local
.pat
));
}
}
...
...
src/librustc_borrowck/lib.rs
浏览文件 @
d6f70359
...
...
@@ -15,6 +15,7 @@
#![allow(non_camel_case_types)]
#![feature(from_ref)]
#![feature(match_default_bindings)]
#![feature(quote)]
...
...
@@ -22,7 +23,6 @@
extern
crate
syntax
;
extern
crate
syntax_pos
;
extern
crate
rustc_errors
as
errors
;
extern
crate
rustc_back
;
// for "clarity", rename the graphviz crate to dot; graphviz within `borrowck`
// refers to the borrowck-specific graphviz adapter traits.
...
...
src/librustc_const_eval/Cargo.toml
浏览文件 @
d6f70359
...
...
@@ -12,7 +12,6 @@ crate-type = ["dylib"]
arena
=
{
path
=
"../libarena"
}
log
=
"0.3"
rustc
=
{
path
=
"../librustc"
}
rustc_back
=
{
path
=
"../librustc_back"
}
rustc_const_math
=
{
path
=
"../librustc_const_math"
}
rustc_data_structures
=
{
path
=
"../librustc_data_structures"
}
rustc_errors
=
{
path
=
"../librustc_errors"
}
...
...
src/librustc_const_eval/check_match.rs
浏览文件 @
d6f70359
...
...
@@ -31,7 +31,7 @@
use
rustc
::
hir
::
intravisit
::{
self
,
Visitor
,
NestedVisitorMap
};
use
rustc
::
hir
::{
self
,
Pat
,
PatKind
};
use
rustc_back
::
slice
;
use
std
::
slice
;
use
syntax
::
ast
;
use
syntax
::
ptr
::
P
;
...
...
@@ -114,7 +114,7 @@ fn visit_local(&mut self, loc: &'tcx hir::Local) {
});
// Check legality of move bindings and `@` patterns.
self
.check_patterns
(
false
,
slice
::
ref_slice
(
&
loc
.pat
));
self
.check_patterns
(
false
,
slice
::
from_ref
(
&
loc
.pat
));
}
fn
visit_body
(
&
mut
self
,
body
:
&
'tcx
hir
::
Body
)
{
...
...
@@ -122,7 +122,7 @@ fn visit_body(&mut self, body: &'tcx hir::Body) {
for
arg
in
&
body
.arguments
{
self
.check_irrefutable
(
&
arg
.pat
,
"function argument"
);
self
.check_patterns
(
false
,
slice
::
ref_slice
(
&
arg
.pat
));
self
.check_patterns
(
false
,
slice
::
from_ref
(
&
arg
.pat
));
}
}
}
...
...
src/librustc_const_eval/lib.rs
浏览文件 @
d6f70359
...
...
@@ -24,12 +24,12 @@
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(i128_type)]
#![feature(from_ref)]
extern
crate
arena
;
#[macro_use]
extern
crate
syntax
;
#[macro_use]
extern
crate
log
;
#[macro_use]
extern
crate
rustc
;
extern
crate
rustc_back
;
extern
crate
rustc_const_math
;
extern
crate
rustc_data_structures
;
extern
crate
rustc_errors
;
...
...
src/librustc_typeck/Cargo.toml
浏览文件 @
d6f70359
...
...
@@ -15,7 +15,6 @@ syntax = { path = "../libsyntax" }
arena
=
{
path
=
"../libarena"
}
fmt_macros
=
{
path
=
"../libfmt_macros"
}
rustc
=
{
path
=
"../librustc"
}
rustc_back
=
{
path
=
"../librustc_back"
}
rustc_const_math
=
{
path
=
"../librustc_const_math"
}
rustc_data_structures
=
{
path
=
"../librustc_data_structures"
}
rustc_platform_intrinsics
=
{
path
=
"../librustc_platform_intrinsics"
}
...
...
src/librustc_typeck/astconv.rs
浏览文件 @
d6f70359
...
...
@@ -23,7 +23,7 @@
use
rustc
::
traits
;
use
rustc
::
ty
::{
self
,
RegionKind
,
Ty
,
TyCtxt
,
ToPredicate
,
TypeFoldable
};
use
rustc
::
ty
::
wf
::
object_region_bounds
;
use
rustc_back
::
slice
;
use
std
::
slice
;
use
require_c_abi_if_variadic
;
use
util
::
common
::
ErrorReported
;
use
util
::
nodemap
::
FxHashSet
;
...
...
@@ -782,7 +782,7 @@ pub fn associated_path_def_to_ty(&self,
debug!
(
"associated_path_def_to_ty: {:?}::{}"
,
ty
,
assoc_name
);
self
.prohibit_type_params
(
slice
::
ref_slice
(
item_segment
));
self
.prohibit_type_params
(
slice
::
from_ref
(
item_segment
));
// Find the type of the associated item, and the trait where the associated
// item is declared.
...
...
@@ -859,7 +859,7 @@ fn qpath_to_ty(&self,
let
tcx
=
self
.tcx
();
let
trait_def_id
=
tcx
.parent_def_id
(
item_def_id
)
.unwrap
();
self
.prohibit_type_params
(
slice
::
ref_slice
(
item_segment
));
self
.prohibit_type_params
(
slice
::
from_ref
(
item_segment
));
let
self_ty
=
if
let
Some
(
ty
)
=
opt_self_ty
{
ty
...
...
src/librustc_typeck/check/mod.rs
浏览文件 @
d6f70359
...
...
@@ -87,7 +87,7 @@
use
astconv
::
AstConv
;
use
hir
::
def
::{
Def
,
CtorKind
};
use
hir
::
def_id
::{
CrateNum
,
DefId
,
LOCAL_CRATE
};
use
rustc_back
::
slice
::
ref_
slice
;
use
std
::
slice
;
use
namespace
::
Namespace
;
use
rustc
::
infer
::{
self
,
InferCtxt
,
InferOk
,
RegionVariableOrigin
};
use
rustc
::
infer
::
type_variable
::{
TypeVariableOrigin
};
...
...
@@ -130,7 +130,6 @@
use
rustc
::
hir
::
map
::
Node
;
use
rustc
::
hir
::{
self
,
PatKind
};
use
rustc
::
middle
::
lang_items
;
use
rustc_back
::
slice
;
use
rustc_const_math
::
ConstInt
;
mod
autoderef
;
...
...
@@ -4168,7 +4167,7 @@ pub fn resolve_ty_and_def_ufcs<'b>(&self,
if
let
Some
(
cached_def
)
=
self
.tables
.borrow
()
.type_dependent_defs
()
.get
(
hir_id
)
{
// Return directly on cache hit. This is useful to avoid doubly reporting
// errors with default match binding modes. See #44614.
return
(
*
cached_def
,
Some
(
ty
),
slice
::
ref_slice
(
&**
item_segment
))
return
(
*
cached_def
,
Some
(
ty
),
slice
::
from_ref
(
&**
item_segment
))
}
let
item_name
=
item_segment
.name
;
let
def
=
match
self
.resolve_ufcs
(
span
,
item_name
,
ty
,
node_id
)
{
...
...
@@ -4187,7 +4186,7 @@ pub fn resolve_ty_and_def_ufcs<'b>(&self,
// Write back the new resolution.
self
.tables
.borrow_mut
()
.type_dependent_defs_mut
()
.insert
(
hir_id
,
def
);
(
def
,
Some
(
ty
),
slice
::
ref_slice
(
&**
item_segment
))
(
def
,
Some
(
ty
),
slice
::
from_ref
(
&**
item_segment
))
}
pub
fn
check_decl_initializer
(
&
self
,
...
...
@@ -4325,7 +4324,7 @@ fn check_block_with_expected(&self,
CoerceMany
::
new
(
coerce_to_ty
)
}
else
{
let
tail_expr
:
&
[
P
<
hir
::
Expr
>
]
=
match
tail_expr
{
Some
(
e
)
=>
ref_slice
(
e
),
Some
(
e
)
=>
slice
::
from_ref
(
e
),
None
=>
&
[],
};
CoerceMany
::
with_coercion_sites
(
coerce_to_ty
,
tail_expr
)
...
...
src/librustc_typeck/lib.rs
浏览文件 @
d6f70359
...
...
@@ -77,6 +77,7 @@
#![feature(box_syntax)]
#![feature(crate_visibility_modifier)]
#![feature(conservative_impl_trait)]
#![feature(from_ref)]
#![feature(match_default_bindings)]
#![feature(never_type)]
#![feature(quote)]
...
...
@@ -90,7 +91,6 @@
extern
crate
arena
;
#[macro_use]
extern
crate
rustc
;
extern
crate
rustc_platform_intrinsics
as
intrinsics
;
extern
crate
rustc_back
;
extern
crate
rustc_const_math
;
extern
crate
rustc_data_structures
;
extern
crate
rustc_errors
as
errors
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录