Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
5aee959e
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,发现更多精彩内容 >>
提交
5aee959e
编写于
7月 25, 2018
作者:
N
Niko Matsakis
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
make field always private, add `From` impls
上级
c46f185f
变更
30
隐藏空白更改
内联
并排
Showing
30 changed file
with
64 addition
and
126 deletion
+64
-126
src/librustc/hir/def_id.rs
src/librustc/hir/def_id.rs
+1
-1
src/librustc/ich/impls_mir.rs
src/librustc/ich/impls_mir.rs
+0
-5
src/librustc/ich/impls_ty.rs
src/librustc/ich/impls_ty.rs
+0
-3
src/librustc/infer/error_reporting/mod.rs
src/librustc/infer/error_reporting/mod.rs
+0
-2
src/librustc/infer/region_constraints/mod.rs
src/librustc/infer/region_constraints/mod.rs
+1
-1
src/librustc/infer/unify_key.rs
src/librustc/infer/unify_key.rs
+2
-2
src/librustc/middle/region.rs
src/librustc/middle/region.rs
+2
-1
src/librustc/ty/sty.rs
src/librustc/ty/sty.rs
+0
-13
src/librustc/util/ppaux.rs
src/librustc/util/ppaux.rs
+0
-1
src/librustc_codegen_llvm/mir/mod.rs
src/librustc_codegen_llvm/mir/mod.rs
+1
-1
src/librustc_codegen_llvm/mir/operand.rs
src/librustc_codegen_llvm/mir/operand.rs
+0
-1
src/librustc_codegen_llvm/mir/place.rs
src/librustc_codegen_llvm/mir/place.rs
+0
-1
src/librustc_data_structures/indexed_vec.rs
src/librustc_data_structures/indexed_vec.rs
+52
-64
src/librustc_mir/borrow_check/error_reporting.rs
src/librustc_mir/borrow_check/error_reporting.rs
+0
-1
src/librustc_mir/borrow_check/move_errors.rs
src/librustc_mir/borrow_check/move_errors.rs
+0
-1
src/librustc_mir/borrow_check/nll/facts.rs
src/librustc_mir/borrow_check/nll/facts.rs
+0
-12
src/librustc_mir/borrow_check/nll/region_infer/graphviz.rs
src/librustc_mir/borrow_check/nll/region_infer/graphviz.rs
+0
-1
src/librustc_mir/borrow_check/nll/type_check/mod.rs
src/librustc_mir/borrow_check/nll/type_check/mod.rs
+0
-1
src/librustc_mir/borrow_check/nll/type_check/relate_tys.rs
src/librustc_mir/borrow_check/nll/type_check/relate_tys.rs
+1
-1
src/librustc_mir/build/scope.rs
src/librustc_mir/build/scope.rs
+0
-1
src/librustc_mir/const_eval.rs
src/librustc_mir/const_eval.rs
+1
-1
src/librustc_mir/dataflow/at_location.rs
src/librustc_mir/dataflow/at_location.rs
+0
-1
src/librustc_mir/dataflow/graphviz.rs
src/librustc_mir/dataflow/graphviz.rs
+0
-1
src/librustc_mir/interpret/operand.rs
src/librustc_mir/interpret/operand.rs
+1
-1
src/librustc_mir/interpret/place.rs
src/librustc_mir/interpret/place.rs
+0
-1
src/librustc_mir/transform/const_prop.rs
src/librustc_mir/transform/const_prop.rs
+1
-2
src/librustc_mir/transform/elaborate_drops.rs
src/librustc_mir/transform/elaborate_drops.rs
+0
-1
src/librustc_mir/transform/qualify_consts.rs
src/librustc_mir/transform/qualify_consts.rs
+1
-1
src/librustc_mir/transform/rustc_peek.rs
src/librustc_mir/transform/rustc_peek.rs
+0
-1
src/librustc_mir/util/graphviz.rs
src/librustc_mir/util/graphviz.rs
+0
-2
未找到文件。
src/librustc/hir/def_id.rs
浏览文件 @
5aee959e
...
...
@@ -53,7 +53,7 @@ pub fn as_usize(&self) -> usize {
}
pub
fn
as_u32
(
&
self
)
->
u32
{
self
.0
u32
::
from
(
*
self
)
}
pub
fn
as_def_id
(
&
self
)
->
DefId
{
DefId
{
krate
:
*
self
,
index
:
CRATE_DEF_INDEX
}
}
...
...
src/librustc/ich/impls_mir.rs
浏览文件 @
5aee959e
...
...
@@ -102,7 +102,6 @@ impl<'a> HashStable<StableHashingContext<'a>> for mir::Local {
fn
hash_stable
<
W
:
StableHasherResult
>
(
&
self
,
hcx
:
&
mut
StableHashingContext
<
'a
>
,
hasher
:
&
mut
StableHasher
<
W
>
)
{
use
rustc_data_structures
::
indexed_vec
::
Idx
;
self
.index
()
.hash_stable
(
hcx
,
hasher
);
}
}
...
...
@@ -112,7 +111,6 @@ impl<'a> HashStable<StableHashingContext<'a>> for mir::BasicBlock {
fn
hash_stable
<
W
:
StableHasherResult
>
(
&
self
,
hcx
:
&
mut
StableHashingContext
<
'a
>
,
hasher
:
&
mut
StableHasher
<
W
>
)
{
use
rustc_data_structures
::
indexed_vec
::
Idx
;
self
.index
()
.hash_stable
(
hcx
,
hasher
);
}
}
...
...
@@ -122,7 +120,6 @@ impl<'a> HashStable<StableHashingContext<'a>> for mir::Field {
fn
hash_stable
<
W
:
StableHasherResult
>
(
&
self
,
hcx
:
&
mut
StableHashingContext
<
'a
>
,
hasher
:
&
mut
StableHasher
<
W
>
)
{
use
rustc_data_structures
::
indexed_vec
::
Idx
;
self
.index
()
.hash_stable
(
hcx
,
hasher
);
}
}
...
...
@@ -133,7 +130,6 @@ impl<'a> HashStable<StableHashingContext<'a>>
fn
hash_stable
<
W
:
StableHasherResult
>
(
&
self
,
hcx
:
&
mut
StableHashingContext
<
'a
>
,
hasher
:
&
mut
StableHasher
<
W
>
)
{
use
rustc_data_structures
::
indexed_vec
::
Idx
;
self
.index
()
.hash_stable
(
hcx
,
hasher
);
}
}
...
...
@@ -143,7 +139,6 @@ impl<'a> HashStable<StableHashingContext<'a>> for mir::Promoted {
fn
hash_stable
<
W
:
StableHasherResult
>
(
&
self
,
hcx
:
&
mut
StableHashingContext
<
'a
>
,
hasher
:
&
mut
StableHasher
<
W
>
)
{
use
rustc_data_structures
::
indexed_vec
::
Idx
;
self
.index
()
.hash_stable
(
hcx
,
hasher
);
}
}
...
...
src/librustc/ich/impls_ty.rs
浏览文件 @
5aee959e
...
...
@@ -143,7 +143,6 @@ impl<'a> HashStable<StableHashingContext<'a>> for ty::RegionVid {
fn
hash_stable
<
W
:
StableHasherResult
>
(
&
self
,
hcx
:
&
mut
StableHashingContext
<
'a
>
,
hasher
:
&
mut
StableHasher
<
W
>
)
{
use
rustc_data_structures
::
indexed_vec
::
Idx
;
self
.index
()
.hash_stable
(
hcx
,
hasher
);
}
}
...
...
@@ -153,7 +152,6 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for ty::CanonicalVar {
fn
hash_stable
<
W
:
StableHasherResult
>
(
&
self
,
hcx
:
&
mut
StableHashingContext
<
'gcx
>
,
hasher
:
&
mut
StableHasher
<
W
>
)
{
use
rustc_data_structures
::
indexed_vec
::
Idx
;
self
.index
()
.hash_stable
(
hcx
,
hasher
);
}
}
...
...
@@ -774,7 +772,6 @@ fn hash_stable<W: StableHasherResult>(&self,
FnPtrAddrCast
});
impl_stable_hash_for!
(
tuple_struct
::
middle
::
region
::
FirstStatementIndex
{
idx
});
impl_stable_hash_for!
(
struct
::
middle
::
region
::
Scope
{
id
,
code
});
impl
<
'a
>
ToStableHashKey
<
StableHashingContext
<
'a
>>
for
region
::
Scope
{
...
...
src/librustc/infer/error_reporting/mod.rs
浏览文件 @
5aee959e
...
...
@@ -73,8 +73,6 @@
use
syntax_pos
::{
Pos
,
Span
};
use
errors
::{
Applicability
,
DiagnosticBuilder
,
DiagnosticStyledString
};
use
rustc_data_structures
::
indexed_vec
::
Idx
;
mod
note
;
mod
need_type_info
;
...
...
src/librustc/infer/region_constraints/mod.rs
浏览文件 @
5aee959e
...
...
@@ -16,7 +16,7 @@
use
super
::{
MiscVariable
,
RegionVariableOrigin
,
SubregionOrigin
};
use
super
::
unify_key
;
use
rustc_data_structures
::
indexed_vec
::
{
IndexVec
,
Idx
}
;
use
rustc_data_structures
::
indexed_vec
::
IndexVec
;
use
rustc_data_structures
::
fx
::{
FxHashMap
,
FxHashSet
};
use
rustc_data_structures
::
unify
as
ut
;
use
ty
::{
self
,
Ty
,
TyCtxt
};
...
...
src/librustc/infer/unify_key.rs
浏览文件 @
5aee959e
...
...
@@ -49,8 +49,8 @@ fn unify_values(value1: &Self, value2: &Self) -> Result<Self, NoError> {
impl
UnifyKey
for
ty
::
RegionVid
{
type
Value
=
RegionVidKey
;
fn
index
(
&
self
)
->
u32
{
self
.0
}
fn
from_index
(
i
:
u32
)
->
ty
::
RegionVid
{
ty
::
RegionVid
(
i
)
}
fn
index
(
&
self
)
->
u32
{
u32
::
from
(
*
self
)
}
fn
from_index
(
i
:
u32
)
->
ty
::
RegionVid
{
ty
::
RegionVid
::
from
(
i
)
}
fn
tag
()
->
&
'static
str
{
"RegionVid"
}
}
...
...
src/librustc/middle/region.rs
浏览文件 @
5aee959e
...
...
@@ -161,11 +161,12 @@ pub struct BlockRemainder {
newtype_index!
{
pub
struct
FirstStatementIndex
{
pub
idx
MAX
=
SCOPE_DATA_REMAINDER_MAX
}
}
impl_stable_hash_for!
(
tuple_struct
::
middle
::
region
::
FirstStatementIndex
{
idx
});
impl
From
<
ScopeData
>
for
Scope
{
#[inline]
fn
from
(
scope_data
:
ScopeData
)
->
Self
{
...
...
src/librustc/ty/sty.rs
浏览文件 @
5aee959e
...
...
@@ -1179,7 +1179,6 @@ pub struct FloatVid {
newtype_index!
{
pub
struct
RegionVid
{
pub
idx
DEBUG_FORMAT
=
custom
,
}
}
...
...
@@ -1190,18 +1189,6 @@ fn index(self) -> usize {
}
}
impl
From
<
usize
>
for
RegionVid
{
fn
from
(
i
:
usize
)
->
RegionVid
{
RegionVid
::
new
(
i
)
}
}
impl
From
<
RegionVid
>
for
usize
{
fn
from
(
vid
:
RegionVid
)
->
usize
{
Idx
::
index
(
vid
)
}
}
#[derive(Clone,
Copy,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
RustcEncodable,
RustcDecodable)]
pub
enum
InferTy
{
TyVar
(
TyVid
),
...
...
src/librustc/util/ppaux.rs
浏览文件 @
5aee959e
...
...
@@ -26,7 +26,6 @@
use
std
::
fmt
;
use
std
::
usize
;
use
rustc_data_structures
::
indexed_vec
::
Idx
;
use
rustc_target
::
spec
::
abi
::
Abi
;
use
syntax
::
ast
::
CRATE_NODE_ID
;
use
syntax
::
symbol
::{
Symbol
,
InternedString
};
...
...
src/librustc_codegen_llvm/mir/mod.rs
浏览文件 @
5aee959e
...
...
@@ -32,7 +32,7 @@
use
std
::
iter
;
use
rustc_data_structures
::
bitvec
::
BitArray
;
use
rustc_data_structures
::
indexed_vec
::
{
IndexVec
,
Idx
}
;
use
rustc_data_structures
::
indexed_vec
::
IndexVec
;
pub
use
self
::
constant
::
codegen_static_initializer
;
...
...
src/librustc_codegen_llvm/mir/operand.rs
浏览文件 @
5aee959e
...
...
@@ -13,7 +13,6 @@
use
rustc
::
mir
::
interpret
::{
ConstValue
,
ScalarMaybeUndef
};
use
rustc
::
ty
;
use
rustc
::
ty
::
layout
::{
self
,
Align
,
LayoutOf
,
TyLayout
};
use
rustc_data_structures
::
indexed_vec
::
Idx
;
use
rustc_data_structures
::
sync
::
Lrc
;
use
base
;
...
...
src/librustc_codegen_llvm/mir/place.rs
浏览文件 @
5aee959e
...
...
@@ -13,7 +13,6 @@
use
rustc
::
ty
::
layout
::{
self
,
Align
,
TyLayout
,
LayoutOf
,
Size
};
use
rustc
::
mir
;
use
rustc
::
mir
::
tcx
::
PlaceTy
;
use
rustc_data_structures
::
indexed_vec
::
Idx
;
use
base
;
use
builder
::
Builder
;
use
common
::{
CodegenCx
,
C_undef
,
C_usize
,
C_u8
,
C_u32
,
C_uint
,
C_null
,
C_uint_big
};
...
...
src/librustc_data_structures/indexed_vec.rs
浏览文件 @
5aee959e
...
...
@@ -49,12 +49,20 @@ fn index(self) -> usize { self as usize }
}
/// Creates a struct type `S` that can be used as an index with
/// `IndexVec` and so on. This struct can be constructed via `S::new`
/// (given a `usize`) and converted to a usize with the `index()`
/// method (from the `Idx` trait). Internally, the index uses a u32,
/// so the index must not exceed `u32::MAX`. You can also customize
/// things like the `Debug` impl, what traits are derived, and so
/// forth.
/// `IndexVec` and so on.
///
/// There are two ways of interacting with these indices:
///
/// - The `From` impls are the preferred way. So you can do
/// `S::from(v)` with a `usize` or `u32`. And you can convert back
/// to an integer with `u32::from(s)`.
///
/// - Alternatively, you can use the methods `S::new(v)` and `s.index()`
/// to create/return a value.
///
/// Internally, the index uses a u32, so the index must not exceed
/// `u32::MAX`. You can also customize things like the `Debug` impl,
/// what traits are derived, and so forth via the macro.
#[macro_export]
macro_rules!
newtype_index
{
// ---- public rules ----
...
...
@@ -84,13 +92,20 @@ fn index(self) -> usize { self as usize }
// Base case, user-defined constants (if any) have already been defined
(
@
derives
[
$
(
$derives:ident
,)
*
]
@
pub
[
$
(
$pub:tt
)
*
]
@
type
[
$type:ident
]
@
max
[
$max:expr
]
@
vis
[
$v:vis
]
@
debug_format
[
$debug_format:tt
])
=>
(
#[derive(Copy,
Clone,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
$
(
$
derives),
*
)]
$v
struct
$type
(
$
(
$pub
)
*
u32
);
$v
struct
$type
(
u32
);
impl
$type
{
/// Extract value of this index as an integer.
#[inline]
$v
fn
index
(
self
)
->
usize
{
<
Self
as
Idx
>
::
index
(
self
)
}
}
impl
Idx
for
$type
{
#[inline]
...
...
@@ -134,6 +149,30 @@ fn add_usize(&self, u: usize) -> Option<Self> {
}
}
impl
From
<
$type
>
for
u32
{
fn
from
(
v
:
$type
)
->
u32
{
v
.0
}
}
impl
From
<
$type
>
for
usize
{
fn
from
(
v
:
$type
)
->
usize
{
v
.0
as
usize
}
}
impl
From
<
usize
>
for
$type
{
fn
from
(
v
:
usize
)
->
Self
{
Self
::
new
(
v
)
}
}
impl
From
<
u32
>
for
$type
{
fn
from
(
v
:
u32
)
->
Self
{
Self
::
new
(
v
as
usize
)
}
}
newtype_index!
(
@
handle_debug
@
derives
[
$
(
$derives
,)
*
]
...
...
@@ -177,47 +216,14 @@ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
@
debug_format
[
$debug_format
]);
);
// Handle the case where someone wants to make the internal field public
(
@
type
[
$type:ident
]
@
max
[
$max:expr
]
@
vis
[
$v:vis
]
@
debug_format
[
$debug_format:tt
]
pub
idx
$
(
$tokens:tt
)
*
)
=>
(
newtype_index!
(
@
pub
[
pub
]
@
type
[
$type
]
@
max
[
$max
]
@
vis
[
$v
]
@
debug_format
[
$debug_format
]
$
(
$tokens
)
*
);
);
// The default case is that the internal field is private
(
@
type
[
$type:ident
]
@
max
[
$max:expr
]
@
vis
[
$v:vis
]
@
debug_format
[
$debug_format:tt
]
$
(
$tokens:tt
)
*
)
=>
(
newtype_index!
(
@
pub
[]
@
type
[
$type
]
@
max
[
$max
]
@
vis
[
$v
]
@
debug_format
[
$debug_format
]
$
(
$tokens
)
*
);
);
// Append comma to end of derives list if it's missing
(
@
pub
[
$
(
$pub:tt
)
*
]
@
type
[
$type:ident
]
(
@
type
[
$type:ident
]
@
max
[
$max:expr
]
@
vis
[
$v:vis
]
@
debug_format
[
$debug_format:tt
]
derive
[
$
(
$derives:ident
),
*
]
$
(
$tokens:tt
)
*
)
=>
(
newtype_index!
(
@
pub
[
$
(
$pub
)
*
]
@
type
[
$type
]
@
max
[
$max
]
@
vis
[
$v
]
...
...
@@ -228,8 +234,7 @@ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
// By not including the @derives marker in this list nor in the default args, we can force it
// to come first if it exists. When encodable is custom, just use the derives list as-is.
(
@
pub
[
$
(
$pub:tt
)
*
]
@
type
[
$type:ident
]
(
@
type
[
$type:ident
]
@
max
[
$max:expr
]
@
vis
[
$v:vis
]
@
debug_format
[
$debug_format:tt
]
...
...
@@ -238,7 +243,6 @@ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
$
(
$tokens:tt
)
*
)
=>
(
newtype_index!
(
@
derives
[
$
(
$derives
,)
+
]
@
pub
[
$
(
$pub
)
*
]
@
type
[
$type
]
@
max
[
$max
]
@
vis
[
$v
]
...
...
@@ -248,8 +252,7 @@ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
// By not including the @derives marker in this list nor in the default args, we can force it
// to come first if it exists. When encodable isn't custom, add serialization traits by default.
(
@
pub
[
$
(
$pub:tt
)
*
]
@
type
[
$type:ident
]
(
@
type
[
$type:ident
]
@
max
[
$max:expr
]
@
vis
[
$v:vis
]
@
debug_format
[
$debug_format:tt
]
...
...
@@ -257,7 +260,6 @@ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
$
(
$tokens:tt
)
*
)
=>
(
newtype_index!
(
@
derives
[
$
(
$derives
,)
+
RustcDecodable
,
RustcEncodable
,]
@
pub
[
$
(
$pub
)
*
]
@
type
[
$type
]
@
max
[
$max
]
@
vis
[
$v
]
...
...
@@ -267,8 +269,7 @@ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
// The case where no derives are added, but encodable is overridden. Don't
// derive serialization traits
(
@
pub
[
$
(
$pub:tt
)
*
]
@
type
[
$type:ident
]
(
@
type
[
$type:ident
]
@
max
[
$max:expr
]
@
vis
[
$v:vis
]
@
debug_format
[
$debug_format:tt
]
...
...
@@ -276,7 +277,6 @@ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
$
(
$tokens:tt
)
*
)
=>
(
newtype_index!
(
@
derives
[]
@
pub
[
$
(
$pub
)
*
]
@
type
[
$type
]
@
max
[
$max
]
@
vis
[
$v
]
...
...
@@ -285,15 +285,13 @@ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
);
// The case where no derives are added, add serialization derives by default
(
@
pub
[
$
(
$pub:tt
)
*
]
@
type
[
$type:ident
]
(
@
type
[
$type:ident
]
@
max
[
$max:expr
]
@
vis
[
$v:vis
]
@
debug_format
[
$debug_format:tt
]
$
(
$tokens:tt
)
*
)
=>
(
newtype_index!
(
@
derives
[
RustcDecodable
,
RustcEncodable
,]
@
pub
[
$
(
$pub
)
*
]
@
type
[
$type
]
@
max
[
$max
]
@
vis
[
$v
]
...
...
@@ -303,7 +301,6 @@ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
// Rewrite final without comma to one that includes comma
(
@
derives
[
$
(
$derives:ident
,)
*
]
@
pub
[
$
(
$pub:tt
)
*
]
@
type
[
$type:ident
]
@
max
[
$max:expr
]
@
vis
[
$v:vis
]
...
...
@@ -311,7 +308,6 @@ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
$name:ident
=
$constant:expr
)
=>
(
newtype_index!
(
@
derives
[
$
(
$derives
,)
*
]
@
pub
[
$
(
$pub
)
*
]
@
type
[
$type
]
@
max
[
$max
]
@
vis
[
$v
]
...
...
@@ -321,7 +317,6 @@ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
// Rewrite final const without comma to one that includes comma
(
@
derives
[
$
(
$derives:ident
,)
*
]
@
pub
[
$
(
$pub:tt
)
*
]
@
type
[
$type:ident
]
@
max
[
$_max:expr
]
@
vis
[
$v:vis
]
...
...
@@ -330,7 +325,6 @@ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
const
$name:ident
=
$constant:expr
)
=>
(
newtype_index!
(
@
derives
[
$
(
$derives
,)
*
]
@
pub
[
$
(
$pub
)
*
]
@
type
[
$type
]
@
max
[
$max
]
@
vis
[
$v
]
...
...
@@ -340,7 +334,6 @@ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
// Replace existing default for max
(
@
derives
[
$
(
$derives:ident
,)
*
]
@
pub
[
$
(
$pub:tt
)
*
]
@
type
[
$type:ident
]
@
max
[
$_max:expr
]
@
vis
[
$v:vis
]
...
...
@@ -349,7 +342,6 @@ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
$
(
$tokens:tt
)
*
)
=>
(
newtype_index!
(
@
derives
[
$
(
$derives
,)
*
]
@
pub
[
$
(
$pub
)
*
]
@
type
[
$type
]
@
max
[
$max
]
@
vis
[
$v
]
...
...
@@ -359,7 +351,6 @@ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
// Replace existing default for debug_format
(
@
derives
[
$
(
$derives:ident
,)
*
]
@
pub
[
$
(
$pub:tt
)
*
]
@
type
[
$type:ident
]
@
max
[
$max:expr
]
@
vis
[
$v:vis
]
...
...
@@ -368,7 +359,6 @@ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
$
(
$tokens:tt
)
*
)
=>
(
newtype_index!
(
@
derives
[
$
(
$derives
,)
*
]
@
pub
[
$
(
$pub
)
*
]
@
type
[
$type
]
@
max
[
$max
]
@
vis
[
$v
]
...
...
@@ -378,7 +368,6 @@ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
// Assign a user-defined constant
(
@
derives
[
$
(
$derives:ident
,)
*
]
@
pub
[
$
(
$pub:tt
)
*
]
@
type
[
$type:ident
]
@
max
[
$max:expr
]
@
vis
[
$v:vis
]
...
...
@@ -390,7 +379,6 @@ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
pub
const
$name
:
$type
=
$type
(
$constant
);
newtype_index!
(
@
derives
[
$
(
$derives
,)
*
]
@
pub
[
$
(
$pub
)
*
]
@
type
[
$type
]
@
max
[
$max
]
@
vis
[
$v
]
...
...
src/librustc_mir/borrow_check/error_reporting.rs
浏览文件 @
5aee959e
...
...
@@ -16,7 +16,6 @@
use
rustc
::
mir
::{
ProjectionElem
,
Rvalue
,
Statement
,
StatementKind
};
use
rustc
::
ty
;
use
rustc_data_structures
::
fx
::
FxHashSet
;
use
rustc_data_structures
::
indexed_vec
::
Idx
;
use
rustc_data_structures
::
sync
::
Lrc
;
use
rustc_errors
::
DiagnosticBuilder
;
use
syntax_pos
::
Span
;
...
...
src/librustc_mir/borrow_check/move_errors.rs
浏览文件 @
5aee959e
...
...
@@ -12,7 +12,6 @@
use
rustc
::
mir
::
*
;
use
rustc
::
ty
;
use
rustc_errors
::
DiagnosticBuilder
;
use
rustc_data_structures
::
indexed_vec
::
Idx
;
use
syntax_pos
::
Span
;
use
borrow_check
::
MirBorrowckCtxt
;
...
...
src/librustc_mir/borrow_check/nll/facts.rs
浏览文件 @
5aee959e
...
...
@@ -100,18 +100,6 @@ fn index(self) -> usize {
}
}
impl
From
<
usize
>
for
LocationIndex
{
fn
from
(
i
:
usize
)
->
LocationIndex
{
LocationIndex
::
new
(
i
)
}
}
impl
From
<
LocationIndex
>
for
usize
{
fn
from
(
vid
:
LocationIndex
)
->
usize
{
Idx
::
index
(
vid
)
}
}
struct
FactWriter
<
'w
>
{
location_table
:
&
'w
LocationTable
,
dir
:
&
'w
Path
,
...
...
src/librustc_mir/borrow_check/nll/region_infer/graphviz.rs
浏览文件 @
5aee959e
...
...
@@ -15,7 +15,6 @@
use
super
::
*
;
use
borrow_check
::
nll
::
constraints
::
OutlivesConstraint
;
use
dot
::{
self
,
IntoCow
};
use
rustc_data_structures
::
indexed_vec
::
Idx
;
use
std
::
borrow
::
Cow
;
use
std
::
io
::{
self
,
Write
};
...
...
src/librustc_mir/borrow_check/nll/type_check/mod.rs
浏览文件 @
5aee959e
...
...
@@ -42,7 +42,6 @@
use
transform
::{
MirPass
,
MirSource
};
use
rustc_data_structures
::
fx
::
FxHashSet
;
use
rustc_data_structures
::
indexed_vec
::
Idx
;
macro_rules!
span_mirbug
{
(
$context:expr
,
$elem:expr
,
$
(
$message:tt
)
*
)
=>
({
...
...
src/librustc_mir/borrow_check/nll/type_check/relate_tys.rs
浏览文件 @
5aee959e
...
...
@@ -20,7 +20,7 @@
use
rustc
::
ty
::
subst
::
Kind
;
use
rustc
::
ty
::{
self
,
CanonicalTy
,
CanonicalVar
,
RegionVid
,
Ty
,
TyCtxt
};
use
rustc_data_structures
::
fx
::
FxHashMap
;
use
rustc_data_structures
::
indexed_vec
::
{
Idx
,
IndexVec
}
;
use
rustc_data_structures
::
indexed_vec
::
IndexVec
;
use
std
::
mem
;
pub
(
super
)
fn
sub_types
<
'tcx
>
(
...
...
src/librustc_mir/build/scope.rs
浏览文件 @
5aee959e
...
...
@@ -95,7 +95,6 @@
use
rustc
::
hir
::
def_id
::
LOCAL_CRATE
;
use
rustc
::
mir
::
*
;
use
syntax_pos
::{
Span
};
use
rustc_data_structures
::
indexed_vec
::
Idx
;
use
rustc_data_structures
::
fx
::
FxHashMap
;
#[derive(Debug)]
...
...
src/librustc_mir/const_eval.rs
浏览文件 @
5aee959e
...
...
@@ -19,7 +19,7 @@
use
rustc
::
ty
::{
self
,
TyCtxt
,
Instance
,
query
::
TyCtxtAt
};
use
rustc
::
ty
::
layout
::{
LayoutOf
,
TyLayout
};
use
rustc
::
ty
::
subst
::
Subst
;
use
rustc_data_structures
::
indexed_vec
::
{
IndexVec
,
Idx
}
;
use
rustc_data_structures
::
indexed_vec
::
IndexVec
;
use
syntax
::
ast
::
Mutability
;
use
syntax
::
source_map
::
Span
;
...
...
src/librustc_mir/dataflow/at_location.rs
浏览文件 @
5aee959e
...
...
@@ -13,7 +13,6 @@
use
rustc
::
mir
::{
BasicBlock
,
Location
};
use
rustc_data_structures
::
indexed_set
::{
HybridIdxSet
,
IdxSet
,
Iter
};
use
rustc_data_structures
::
indexed_vec
::
Idx
;
use
dataflow
::{
BitDenotation
,
BlockSets
,
DataflowResults
};
use
dataflow
::
move_paths
::{
HasMoveData
,
MovePathIndex
};
...
...
src/librustc_mir/dataflow/graphviz.rs
浏览文件 @
5aee959e
...
...
@@ -13,7 +13,6 @@
use
syntax
::
ast
::
NodeId
;
use
rustc
::
mir
::{
BasicBlock
,
Mir
};
use
rustc_data_structures
::
bitslice
::
bits_to_string
;
use
rustc_data_structures
::
indexed_vec
::
Idx
;
use
dot
;
use
dot
::
IntoCow
;
...
...
src/librustc_mir/interpret/operand.rs
浏览文件 @
5aee959e
...
...
@@ -16,7 +16,7 @@
use
rustc
::{
mir
,
ty
};
use
rustc
::
ty
::
layout
::{
self
,
Size
,
LayoutOf
,
TyLayout
,
HasDataLayout
,
IntegerExt
};
use
rustc_data_structures
::
indexed_vec
::
Idx
;
use
rustc
::
mir
::
interpret
::{
GlobalId
,
AllocId
,
ConstValue
,
Pointer
,
Scalar
,
ScalarMaybeUndef
,
...
...
src/librustc_mir/interpret/place.rs
浏览文件 @
5aee959e
...
...
@@ -18,7 +18,6 @@
use
rustc
::
mir
;
use
rustc
::
ty
::{
self
,
Ty
};
use
rustc
::
ty
::
layout
::{
self
,
Size
,
Align
,
LayoutOf
,
TyLayout
,
HasDataLayout
};
use
rustc_data_structures
::
indexed_vec
::
Idx
;
use
rustc_data_structures
::
stable_hasher
::{
HashStable
,
StableHasher
,
StableHasherResult
};
use
rustc
::
mir
::
interpret
::{
...
...
src/librustc_mir/transform/const_prop.rs
浏览文件 @
5aee959e
...
...
@@ -26,7 +26,7 @@
use
transform
::{
MirPass
,
MirSource
};
use
syntax
::
source_map
::{
Span
,
DUMMY_SP
};
use
rustc
::
ty
::
subst
::
Substs
;
use
rustc_data_structures
::
indexed_vec
::
{
IndexVec
,
Idx
}
;
use
rustc_data_structures
::
indexed_vec
::
IndexVec
;
use
rustc
::
ty
::
ParamEnv
;
use
rustc
::
ty
::
layout
::{
LayoutOf
,
TyLayout
,
LayoutError
,
...
...
@@ -133,7 +133,6 @@ fn use_ecx<F, T>(
self
.ecx.tcx.span
=
source_info
.span
;
let
lint_root
=
match
self
.mir.source_scope_local_data
{
ClearCrossCrate
::
Set
(
ref
ivs
)
=>
{
use
rustc_data_structures
::
indexed_vec
::
Idx
;
//FIXME(#51314): remove this check
if
source_info
.scope
.index
()
>=
ivs
.len
()
{
return
None
;
...
...
src/librustc_mir/transform/elaborate_drops.rs
浏览文件 @
5aee959e
...
...
@@ -19,7 +19,6 @@
use
rustc
::
mir
::
*
;
use
rustc
::
util
::
nodemap
::
FxHashMap
;
use
rustc_data_structures
::
indexed_set
::
IdxSet
;
use
rustc_data_structures
::
indexed_vec
::
Idx
;
use
transform
::{
MirPass
,
MirSource
};
use
util
::
patch
::
MirPatch
;
use
util
::
elaborate_drops
::{
DropFlagState
,
Unwind
,
elaborate_drop
};
...
...
src/librustc_mir/transform/qualify_consts.rs
浏览文件 @
5aee959e
...
...
@@ -16,7 +16,7 @@
use
rustc_data_structures
::
bitvec
::
BitArray
;
use
rustc_data_structures
::
indexed_set
::
IdxSet
;
use
rustc_data_structures
::
indexed_vec
::
{
IndexVec
,
Idx
}
;
use
rustc_data_structures
::
indexed_vec
::
IndexVec
;
use
rustc_data_structures
::
fx
::
FxHashSet
;
use
rustc
::
hir
;
use
rustc
::
hir
::
def_id
::
DefId
;
...
...
src/librustc_mir/transform/rustc_peek.rs
浏览文件 @
5aee959e
...
...
@@ -15,7 +15,6 @@
use
rustc
::
ty
::{
self
,
TyCtxt
};
use
rustc
::
mir
::{
self
,
Mir
,
Location
};
use
rustc_data_structures
::
indexed_set
::
IdxSet
;
use
rustc_data_structures
::
indexed_vec
::
Idx
;
use
transform
::{
MirPass
,
MirSource
};
use
dataflow
::{
do_dataflow
,
DebugFormatted
};
...
...
src/librustc_mir/util/graphviz.rs
浏览文件 @
5aee959e
...
...
@@ -15,8 +15,6 @@
use
std
::
fmt
::
Debug
;
use
std
::
io
::{
self
,
Write
};
use
rustc_data_structures
::
indexed_vec
::
Idx
;
use
super
::
pretty
::
dump_mir_def_ids
;
/// Write a graphviz DOT graph of a list of MIRs.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录