Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
98dd376f
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,发现更多精彩内容 >>
提交
98dd376f
编写于
4月 01, 2015
作者:
F
Felix S. Klock II
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fallout when bootstrapping `rustc`.
上级
3225b04c
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
19 addition
and
9 deletion
+19
-9
src/librustc/middle/const_eval.rs
src/librustc/middle/const_eval.rs
+11
-1
src/librustc_lint/builtin.rs
src/librustc_lint/builtin.rs
+1
-1
src/librustc_trans/trans/adt.rs
src/librustc_trans/trans/adt.rs
+1
-1
src/librustc_trans/trans/base.rs
src/librustc_trans/trans/base.rs
+2
-2
src/librustc_trans/trans/context.rs
src/librustc_trans/trans/context.rs
+1
-1
src/libsyntax/ast.rs
src/libsyntax/ast.rs
+1
-1
src/libsyntax/codemap.rs
src/libsyntax/codemap.rs
+2
-2
未找到文件。
src/librustc/middle/const_eval.rs
浏览文件 @
98dd376f
...
...
@@ -23,6 +23,7 @@
use
syntax
::
ast
::{
self
,
Expr
};
use
syntax
::
codemap
::
Span
;
use
syntax
::
feature_gate
;
use
syntax
::
parse
::
token
::
InternedString
;
use
syntax
::
ptr
::
P
;
use
syntax
::{
ast_map
,
ast_util
,
codemap
};
...
...
@@ -594,7 +595,16 @@ fn fromb(b: bool) -> const_val { const_int(b as i64) }
match
try!
(
eval_const_expr_partial
(
tcx
,
&**
inner
,
ety
))
{
const_float
(
f
)
=>
const_float
(
-
f
),
const_int
(
n
)
=>
try!
(
const_int_checked_neg
(
n
,
e
,
expr_int_type
)),
const_uint
(
n
)
=>
try!
(
const_uint_checked_neg
(
n
,
e
,
expr_uint_type
)),
const_uint
(
i
)
=>
{
if
!
tcx
.sess.features
.borrow
()
.negate_unsigned
{
feature_gate
::
emit_feature_err
(
&
tcx
.sess.parse_sess.span_diagnostic
,
"negate_unsigned"
,
e
.span
,
"unary negation of unsigned integers may be removed in the future"
);
}
const_uint
(
n
)
=>
try!
(
const_uint_checked_neg
(
n
,
e
,
expr_uint_type
)),
}
const_str
(
_
)
=>
signal!
(
e
,
NegateOnString
),
const_bool
(
_
)
=>
signal!
(
e
,
NegateOnBoolean
),
const_binary
(
_
)
=>
signal!
(
e
,
NegateOnBinary
),
...
...
src/librustc_lint/builtin.rs
浏览文件 @
98dd376f
...
...
@@ -116,7 +116,7 @@ pub struct TypeLimits {
impl
TypeLimits
{
pub
fn
new
()
->
TypeLimits
{
TypeLimits
{
negated_expr_id
:
-
1
,
negated_expr_id
:
!
0
,
}
}
}
...
...
src/librustc_trans/trans/adt.rs
浏览文件 @
98dd376f
...
...
@@ -830,7 +830,7 @@ fn load_discr(bcx: Block, ity: IntType, ptr: ValueRef, min: Disr, max: Disr)
let
bits
=
machine
::
llbitsize_of_real
(
bcx
.ccx
(),
llty
);
assert
!
(
bits
<=
64
);
let
bits
=
bits
as
usize
;
let
mask
=
(
-
1
u64
>>
(
64
-
bits
))
as
Disr
;
let
mask
=
(
!
0
u64
>>
(
64
-
bits
))
as
Disr
;
// For a (max) discr of -1, max will be `-1 as usize`, which overflows.
// However, that is fine here (it would still represent the full range),
if
(
max
.wrapping_add
(
1
))
&
mask
==
min
&
mask
{
...
...
src/librustc_trans/trans/base.rs
浏览文件 @
98dd376f
...
...
@@ -868,7 +868,7 @@ pub fn fail_if_zero_or_overflows<'blk, 'tcx>(
_
=>
unreachable!
(),
};
let
minus_one
=
ICmp
(
bcx
,
llvm
::
IntEQ
,
rhs
,
C_integral
(
llty
,
-
1
,
false
),
debug_loc
);
C_integral
(
llty
,
!
0
,
false
),
debug_loc
);
with_cond
(
bcx
,
minus_one
,
|
bcx
|
{
let
is_min
=
ICmp
(
bcx
,
llvm
::
IntEQ
,
lhs
,
C_integral
(
llty
,
min
,
true
),
debug_loc
);
...
...
@@ -1388,7 +1388,7 @@ pub fn new_fn_ctxt<'a, 'tcx>(ccx: &'a CrateContext<'a, 'tcx>,
common
::
validate_substs
(
param_substs
);
debug!
(
"new_fn_ctxt(path={}, id={}, param_substs={})"
,
if
id
==
-
1
{
if
id
==
!
0
{
""
.to_string
()
}
else
{
ccx
.tcx
()
.map
.path_to_string
(
id
)
.to_string
()
...
...
src/librustc_trans/trans/context.rs
浏览文件 @
98dd376f
...
...
@@ -459,7 +459,7 @@ fn dummy_ccx<'a>(&'a self, shared: &'a SharedCrateContext<'tcx>)
CrateContext
{
shared
:
shared
,
local
:
self
,
index
:
-
1
as
usize
,
index
:
!
0
as
usize
,
}
}
}
...
...
src/libsyntax/ast.rs
浏览文件 @
98dd376f
...
...
@@ -388,7 +388,7 @@ pub fn local_id(&self) -> NodeId {
/// When parsing and doing expansions, we initially give all AST nodes this AST
/// node value. Then later, in the renumber pass, we renumber them to have
/// small, positive ids.
pub
const
DUMMY_NODE_ID
:
NodeId
=
-
1
;
pub
const
DUMMY_NODE_ID
:
NodeId
=
!
0
;
/// The AST represents all type param bounds as types.
/// typeck::collect::compute_bounds matches these against
...
...
src/libsyntax/codemap.rs
浏览文件 @
98dd376f
...
...
@@ -278,9 +278,9 @@ pub struct ExpnInfo {
#[derive(PartialEq,
Eq,
Clone,
Debug,
Hash,
RustcEncodable,
RustcDecodable,
Copy)]
pub
struct
ExpnId
(
u32
);
pub
const
NO_EXPANSION
:
ExpnId
=
ExpnId
(
-
1
);
pub
const
NO_EXPANSION
:
ExpnId
=
ExpnId
(
!
0
);
// For code appearing from the command line
pub
const
COMMAND_LINE_EXPN
:
ExpnId
=
ExpnId
(
-
2
);
pub
const
COMMAND_LINE_EXPN
:
ExpnId
=
ExpnId
(
!
1
);
impl
ExpnId
{
pub
fn
from_llvm_cookie
(
cookie
:
c_uint
)
->
ExpnId
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录