Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
6301c787
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,发现更多精彩内容 >>
提交
6301c787
编写于
1月 07, 2015
作者:
A
Alex Crichton
浏览文件
操作
浏览文件
下载
差异文件
rollup merge of #20680: nick29581/target-word
Closes #20421 [breaking-change] r? @brson
上级
f3b67afc
dd3e89aa
变更
36
隐藏空白更改
内联
并排
Showing
36 changed file
with
91 addition
and
69 deletion
+91
-69
src/libcore/iter.rs
src/libcore/iter.rs
+2
-2
src/libcore/num/int.rs
src/libcore/num/int.rs
+5
-2
src/libcore/num/mod.rs
src/libcore/num/mod.rs
+4
-4
src/librustc/metadata/filesearch.rs
src/librustc/metadata/filesearch.rs
+2
-2
src/librustc/session/config.rs
src/librustc/session/config.rs
+3
-3
src/librustc_back/target/aarch64_unknown_linux_gnu.rs
src/librustc_back/target/aarch64_unknown_linux_gnu.rs
+1
-1
src/librustc_back/target/arm_apple_ios.rs
src/librustc_back/target/arm_apple_ios.rs
+1
-1
src/librustc_back/target/arm_linux_androideabi.rs
src/librustc_back/target/arm_linux_androideabi.rs
+1
-1
src/librustc_back/target/arm_unknown_linux_gnueabi.rs
src/librustc_back/target/arm_unknown_linux_gnueabi.rs
+1
-1
src/librustc_back/target/arm_unknown_linux_gnueabihf.rs
src/librustc_back/target/arm_unknown_linux_gnueabihf.rs
+1
-1
src/librustc_back/target/i386_apple_ios.rs
src/librustc_back/target/i386_apple_ios.rs
+1
-1
src/librustc_back/target/i686_apple_darwin.rs
src/librustc_back/target/i686_apple_darwin.rs
+1
-1
src/librustc_back/target/i686_pc_windows_gnu.rs
src/librustc_back/target/i686_pc_windows_gnu.rs
+1
-1
src/librustc_back/target/i686_unknown_dragonfly.rs
src/librustc_back/target/i686_unknown_dragonfly.rs
+1
-1
src/librustc_back/target/i686_unknown_linux_gnu.rs
src/librustc_back/target/i686_unknown_linux_gnu.rs
+1
-1
src/librustc_back/target/mips_unknown_linux_gnu.rs
src/librustc_back/target/mips_unknown_linux_gnu.rs
+1
-1
src/librustc_back/target/mipsel_unknown_linux_gnu.rs
src/librustc_back/target/mipsel_unknown_linux_gnu.rs
+1
-1
src/librustc_back/target/mod.rs
src/librustc_back/target/mod.rs
+3
-3
src/librustc_back/target/x86_64_apple_darwin.rs
src/librustc_back/target/x86_64_apple_darwin.rs
+1
-1
src/librustc_back/target/x86_64_pc_windows_gnu.rs
src/librustc_back/target/x86_64_pc_windows_gnu.rs
+1
-1
src/librustc_back/target/x86_64_unknown_dragonfly.rs
src/librustc_back/target/x86_64_unknown_dragonfly.rs
+1
-1
src/librustc_back/target/x86_64_unknown_freebsd.rs
src/librustc_back/target/x86_64_unknown_freebsd.rs
+1
-1
src/librustc_back/target/x86_64_unknown_linux_gnu.rs
src/librustc_back/target/x86_64_unknown_linux_gnu.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/librustc_trans/trans/type_.rs
src/librustc_trans/trans/type_.rs
+1
-1
src/libserialize/json.rs
src/libserialize/json.rs
+3
-3
src/libstd/num/mod.rs
src/libstd/num/mod.rs
+28
-14
src/libstd/rand/mod.rs
src/libstd/rand/mod.rs
+2
-2
src/libstd/sys/common/backtrace.rs
src/libstd/sys/common/backtrace.rs
+5
-2
src/libstd/sys/unix/c.rs
src/libstd/sys/unix/c.rs
+2
-2
src/libstd/sys/unix/stack_overflow.rs
src/libstd/sys/unix/stack_overflow.rs
+4
-2
src/test/compile-fail/huge-enum.rs
src/test/compile-fail/huge-enum.rs
+2
-2
src/test/compile-fail/issue-17913.rs
src/test/compile-fail/issue-17913.rs
+2
-2
src/test/run-pass/huge-largest-array.rs
src/test/run-pass/huge-largest-array.rs
+2
-2
src/test/run-pass/vec-fixed-length.rs
src/test/run-pass/vec-fixed-length.rs
+1
-1
未找到文件。
src/libcore/iter.rs
浏览文件 @
6301c787
...
...
@@ -2749,9 +2749,9 @@ fn steps_between(_start: &$t, _end: &$t) -> Option<uint> {
}
step_impl!
(
uint
u8
u16
u32
int
i8
i16
i32
);
#[cfg(
target_word_size
=
"64"
)]
#[cfg(
any(all(stage0,
target_word_size
=
"64"
),
all(not(stage0),
target_pointer_width
=
"64"
))
)]
step_impl!
(
u64
i64
);
#[cfg(
target_word_size
=
"32"
)]
#[cfg(
any(all(stage0,
target_word_size
=
"32"
),
all(not(stage0),
target_pointer_width
=
"32"
))
)]
step_impl_no_between!
(
u64
i64
);
...
...
src/libcore/num/int.rs
浏览文件 @
6301c787
...
...
@@ -13,5 +13,8 @@
#![stable]
#![doc(primitive
=
"int"
)]
#[cfg(target_word_size
=
"32"
)]
int_module!
{
int
,
32
}
#[cfg(target_word_size
=
"64"
)]
int_module!
{
int
,
64
}
#[cfg(stage0)]
#[cfg(target_word_size
=
"32"
)]
int_module!
{
int
,
32
}
#[cfg(stage0)]
#[cfg(target_word_size
=
"64"
)]
int_module!
{
int
,
64
}
#[cfg(not(stage0))]
#[cfg(target_pointer_width
=
"32"
)]
int_module!
{
int
,
32
}
#[cfg(not(stage0))]
#[cfg(target_pointer_width
=
"64"
)]
int_module!
{
int
,
64
}
src/libcore/num/mod.rs
浏览文件 @
6301c787
...
...
@@ -496,7 +496,7 @@ unsafe fn bswap8(x: u8) -> u8 { x }
intrinsics
::
u64_sub_with_overflow
,
intrinsics
::
u64_mul_with_overflow
}
#[cfg(
target_word_size
=
"32"
)]
#[cfg(
any(all(stage0,
target_word_size
=
"32"
),
all(not(stage0),
target_pointer_width
=
"32"
))
)]
uint_impl!
{
uint
=
u32
,
32
,
intrinsics
::
ctpop32
,
intrinsics
::
ctlz32
,
...
...
@@ -506,7 +506,7 @@ unsafe fn bswap8(x: u8) -> u8 { x }
intrinsics
::
u32_sub_with_overflow
,
intrinsics
::
u32_mul_with_overflow
}
#[cfg(
target_word_size
=
"64"
)]
#[cfg(
any(all(stage0,
target_word_size
=
"64"
),
all(not(stage0),
target_pointer_width
=
"64"
))
)]
uint_impl!
{
uint
=
u64
,
64
,
intrinsics
::
ctpop64
,
intrinsics
::
ctlz64
,
...
...
@@ -601,13 +601,13 @@ fn checked_div(self, v: $T) -> Option<$T> {
intrinsics
::
i64_sub_with_overflow
,
intrinsics
::
i64_mul_with_overflow
}
#[cfg(
target_word_size
=
"32"
)]
#[cfg(
any(all(stage0,
target_word_size
=
"32"
),
all(not(stage0),
target_pointer_width
=
"32"
))
)]
int_impl!
{
int
=
i32
,
u32
,
32
,
intrinsics
::
i32_add_with_overflow
,
intrinsics
::
i32_sub_with_overflow
,
intrinsics
::
i32_mul_with_overflow
}
#[cfg(
target_word_size
=
"64"
)]
#[cfg(
any(all(stage0,
target_word_size
=
"64"
),
all(not(stage0),
target_pointer_width
=
"64"
))
)]
int_impl!
{
int
=
i64
,
u64
,
64
,
intrinsics
::
i64_add_with_overflow
,
intrinsics
::
i64_sub_with_overflow
,
...
...
src/librustc/metadata/filesearch.rs
浏览文件 @
6301c787
...
...
@@ -272,12 +272,12 @@ fn find_libdir(sysroot: &Path) -> String {
}
}
#[cfg(
target_word_size
=
"64"
)]
#[cfg(
any(all(stage0,
target_word_size
=
"64"
),
all(not(stage0),
target_pointer_width
=
"64"
))
)]
fn
primary_libdir_name
()
->
String
{
"lib64"
.to_string
()
}
#[cfg(
target_word_size
=
"32"
)]
#[cfg(
any(all(stage0,
target_word_size
=
"32"
),
all(not(stage0),
target_pointer_width
=
"32"
))
)]
fn
primary_libdir_name
()
->
String
{
"lib32"
.to_string
()
}
...
...
src/librustc/session/config.rs
浏览文件 @
6301c787
...
...
@@ -612,7 +612,7 @@ pub fn default_configuration(sess: &Session) -> ast::CrateConfig {
let
end
=
sess
.target.target.target_endian
.index
(
&
FullRange
);
let
arch
=
sess
.target.target.arch
.index
(
&
FullRange
);
let
wordsz
=
sess
.target.target.target_
word_size
.index
(
&
FullRange
);
let
wordsz
=
sess
.target.target.target_
pointer_width
.index
(
&
FullRange
);
let
os
=
sess
.target.target.target_os
.index
(
&
FullRange
);
let
fam
=
match
sess
.target.target.options.is_like_windows
{
...
...
@@ -627,7 +627,7 @@ pub fn default_configuration(sess: &Session) -> ast::CrateConfig {
mk
(
InternedString
::
new
(
"target_family"
),
fam
),
mk
(
InternedString
::
new
(
"target_arch"
),
intern
(
arch
)),
mk
(
InternedString
::
new
(
"target_endian"
),
intern
(
end
)),
mk
(
InternedString
::
new
(
"target_
word_size
"
),
mk
(
InternedString
::
new
(
"target_
pointer_width
"
),
intern
(
wordsz
))
);
}
...
...
@@ -661,7 +661,7 @@ pub fn build_target_config(opts: &Options, sp: &SpanHandler) -> Config {
}
};
let
(
int_type
,
uint_type
)
=
match
target
.target_
word_size
.index
(
&
FullRange
)
{
let
(
int_type
,
uint_type
)
=
match
target
.target_
pointer_width
.index
(
&
FullRange
)
{
"32"
=>
(
ast
::
TyI32
,
ast
::
TyU32
),
"64"
=>
(
ast
::
TyI64
,
ast
::
TyU64
),
w
=>
sp
.handler
()
.fatal
((
format!
(
"target specification was invalid: unrecognized
\
...
...
src/librustc_back/target/aarch64_unknown_linux_gnu.rs
浏览文件 @
6301c787
...
...
@@ -18,7 +18,7 @@ pub fn target() -> Target {
n32:64-S128"
.to_string
(),
llvm_target
:
"aarch64-unknown-linux-gnu"
.to_string
(),
target_endian
:
"little"
.to_string
(),
target_
word_size
:
"64"
.to_string
(),
target_
pointer_width
:
"64"
.to_string
(),
arch
:
"aarch64"
.to_string
(),
target_os
:
"linux"
.to_string
(),
options
:
base
,
...
...
src/librustc_back/target/arm_apple_ios.rs
浏览文件 @
6301c787
...
...
@@ -19,7 +19,7 @@ pub fn target() -> Target {
-a:0:64-n32"
.to_string
(),
llvm_target
:
"arm-apple-ios"
.to_string
(),
target_endian
:
"little"
.to_string
(),
target_
word_size
:
"32"
.to_string
(),
target_
pointer_width
:
"32"
.to_string
(),
arch
:
"arm"
.to_string
(),
target_os
:
"ios"
.to_string
(),
options
:
TargetOptions
{
...
...
src/librustc_back/target/arm_linux_androideabi.rs
浏览文件 @
6301c787
...
...
@@ -27,7 +27,7 @@ pub fn target() -> Target {
-a:0:64-n32"
.to_string
(),
llvm_target
:
"arm-linux-androideabi"
.to_string
(),
target_endian
:
"little"
.to_string
(),
target_
word_size
:
"32"
.to_string
(),
target_
pointer_width
:
"32"
.to_string
(),
arch
:
"arm"
.to_string
(),
target_os
:
"android"
.to_string
(),
options
:
base
,
...
...
src/librustc_back/target/arm_unknown_linux_gnueabi.rs
浏览文件 @
6301c787
...
...
@@ -20,7 +20,7 @@ pub fn target() -> Target {
-a:0:64-n32"
.to_string
(),
llvm_target
:
"arm-unknown-linux-gnueabi"
.to_string
(),
target_endian
:
"little"
.to_string
(),
target_
word_size
:
"32"
.to_string
(),
target_
pointer_width
:
"32"
.to_string
(),
arch
:
"arm"
.to_string
(),
target_os
:
"linux"
.to_string
(),
...
...
src/librustc_back/target/arm_unknown_linux_gnueabihf.rs
浏览文件 @
6301c787
...
...
@@ -20,7 +20,7 @@ pub fn target() -> Target {
-a:0:64-n32"
.to_string
(),
llvm_target
:
"arm-unknown-linux-gnueabihf"
.to_string
(),
target_endian
:
"little"
.to_string
(),
target_
word_size
:
"32"
.to_string
(),
target_
pointer_width
:
"32"
.to_string
(),
arch
:
"arm"
.to_string
(),
target_os
:
"linux"
.to_string
(),
...
...
src/librustc_back/target/i386_apple_ios.rs
浏览文件 @
6301c787
...
...
@@ -19,7 +19,7 @@ pub fn target() -> Target {
-n8:16:32"
.to_string
(),
llvm_target
:
"i386-apple-ios"
.to_string
(),
target_endian
:
"little"
.to_string
(),
target_
word_size
:
"32"
.to_string
(),
target_
pointer_width
:
"32"
.to_string
(),
arch
:
"x86"
.to_string
(),
target_os
:
"ios"
.to_string
(),
...
...
src/librustc_back/target/i686_apple_darwin.rs
浏览文件 @
6301c787
...
...
@@ -22,7 +22,7 @@ pub fn target() -> Target {
-n8:16:32"
.to_string
(),
llvm_target
:
"i686-apple-darwin"
.to_string
(),
target_endian
:
"little"
.to_string
(),
target_
word_size
:
"32"
.to_string
(),
target_
pointer_width
:
"32"
.to_string
(),
arch
:
"x86"
.to_string
(),
target_os
:
"macos"
.to_string
(),
options
:
base
,
...
...
src/librustc_back/target/i686_pc_windows_gnu.rs
浏览文件 @
6301c787
...
...
@@ -26,7 +26,7 @@ pub fn target() -> Target {
data_layout
:
"e-p:32:32-f64:64:64-i64:64:64-f80:32:32-n8:16:32"
.to_string
(),
llvm_target
:
"i686-pc-windows-gnu"
.to_string
(),
target_endian
:
"little"
.to_string
(),
target_
word_size
:
"32"
.to_string
(),
target_
pointer_width
:
"32"
.to_string
(),
arch
:
"x86"
.to_string
(),
target_os
:
"windows"
.to_string
(),
options
:
options
,
...
...
src/librustc_back/target/i686_unknown_dragonfly.rs
浏览文件 @
6301c787
...
...
@@ -18,7 +18,7 @@ pub fn target() -> Target {
data_layout
:
"e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32"
.to_string
(),
llvm_target
:
"i686-unknown-dragonfly"
.to_string
(),
target_endian
:
"little"
.to_string
(),
target_
word_size
:
"32"
.to_string
(),
target_
pointer_width
:
"32"
.to_string
(),
arch
:
"x86"
.to_string
(),
target_os
:
"dragonfly"
.to_string
(),
options
:
base
,
...
...
src/librustc_back/target/i686_unknown_linux_gnu.rs
浏览文件 @
6301c787
...
...
@@ -18,7 +18,7 @@ pub fn target() -> Target {
data_layout
:
"e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32"
.to_string
(),
llvm_target
:
"i686-unknown-linux-gnu"
.to_string
(),
target_endian
:
"little"
.to_string
(),
target_
word_size
:
"32"
.to_string
(),
target_
pointer_width
:
"32"
.to_string
(),
arch
:
"x86"
.to_string
(),
target_os
:
"linux"
.to_string
(),
options
:
base
,
...
...
src/librustc_back/target/mips_unknown_linux_gnu.rs
浏览文件 @
6301c787
...
...
@@ -19,7 +19,7 @@ pub fn target() -> Target {
-a:0:64-n32"
.to_string
(),
llvm_target
:
"mips-unknown-linux-gnu"
.to_string
(),
target_endian
:
"big"
.to_string
(),
target_
word_size
:
"32"
.to_string
(),
target_
pointer_width
:
"32"
.to_string
(),
arch
:
"mips"
.to_string
(),
target_os
:
"linux"
.to_string
(),
options
:
super
::
linux_base
::
opts
()
...
...
src/librustc_back/target/mipsel_unknown_linux_gnu.rs
浏览文件 @
6301c787
...
...
@@ -19,7 +19,7 @@ pub fn target() -> Target {
-a:0:64-n32"
.to_string
(),
llvm_target
:
"mipsel-unknown-linux-gnu"
.to_string
(),
target_endian
:
"little"
.to_string
(),
target_
word_size
:
"32"
.to_string
(),
target_
pointer_width
:
"32"
.to_string
(),
arch
:
"mips"
.to_string
(),
target_os
:
"linux"
.to_string
(),
...
...
src/librustc_back/target/mod.rs
浏览文件 @
6301c787
...
...
@@ -85,8 +85,8 @@ pub struct Target {
pub
llvm_target
:
String
,
/// String to use as the `target_endian` `cfg` variable.
pub
target_endian
:
String
,
/// String to use as the `target_
word_size
` `cfg` variable.
pub
target_
word_size
:
String
,
/// String to use as the `target_
pointer_width
` `cfg` variable.
pub
target_
pointer_width
:
String
,
/// OS name to use for conditional compilation.
pub
target_os
:
String
,
/// Architecture to use for ABI considerations. Valid options: "x86", "x86_64", "arm",
...
...
@@ -233,7 +233,7 @@ pub fn from_json(obj: Json) -> Target {
data_layout
:
get_req_field
(
"data-layout"
),
llvm_target
:
get_req_field
(
"llvm-target"
),
target_endian
:
get_req_field
(
"target-endian"
),
target_
word_size
:
get_req_field
(
"target-word-size"
),
target_
pointer_width
:
get_req_field
(
"target-word-size"
),
arch
:
get_req_field
(
"arch"
),
target_os
:
get_req_field
(
"os"
),
options
:
Default
::
default
(),
...
...
src/librustc_back/target/x86_64_apple_darwin.rs
浏览文件 @
6301c787
...
...
@@ -21,7 +21,7 @@ pub fn target() -> Target {
s0:64:64-f80:128:128-n8:16:32:64"
.to_string
(),
llvm_target
:
"x86_64-apple-darwin"
.to_string
(),
target_endian
:
"little"
.to_string
(),
target_
word_size
:
"64"
.to_string
(),
target_
pointer_width
:
"64"
.to_string
(),
arch
:
"x86_64"
.to_string
(),
target_os
:
"macos"
.to_string
(),
options
:
base
,
...
...
src/librustc_back/target/x86_64_pc_windows_gnu.rs
浏览文件 @
6301c787
...
...
@@ -23,7 +23,7 @@ pub fn target() -> Target {
s0:64:64-f80:128:128-n8:16:32:64-S128"
.to_string
(),
llvm_target
:
"x86_64-pc-windows-gnu"
.to_string
(),
target_endian
:
"little"
.to_string
(),
target_
word_size
:
"64"
.to_string
(),
target_
pointer_width
:
"64"
.to_string
(),
arch
:
"x86_64"
.to_string
(),
target_os
:
"windows"
.to_string
(),
options
:
base
,
...
...
src/librustc_back/target/x86_64_unknown_dragonfly.rs
浏览文件 @
6301c787
...
...
@@ -20,7 +20,7 @@ pub fn target() -> Target {
s0:64:64-f80:128:128-n8:16:32:64-S128"
.to_string
(),
llvm_target
:
"x86_64-unknown-dragonfly"
.to_string
(),
target_endian
:
"little"
.to_string
(),
target_
word_size
:
"64"
.to_string
(),
target_
pointer_width
:
"64"
.to_string
(),
arch
:
"x86_64"
.to_string
(),
target_os
:
"dragonfly"
.to_string
(),
options
:
base
,
...
...
src/librustc_back/target/x86_64_unknown_freebsd.rs
浏览文件 @
6301c787
...
...
@@ -20,7 +20,7 @@ pub fn target() -> Target {
s0:64:64-f80:128:128-n8:16:32:64-S128"
.to_string
(),
llvm_target
:
"x86_64-unknown-freebsd"
.to_string
(),
target_endian
:
"little"
.to_string
(),
target_
word_size
:
"64"
.to_string
(),
target_
pointer_width
:
"64"
.to_string
(),
arch
:
"x86_64"
.to_string
(),
target_os
:
"freebsd"
.to_string
(),
options
:
base
,
...
...
src/librustc_back/target/x86_64_unknown_linux_gnu.rs
浏览文件 @
6301c787
...
...
@@ -20,7 +20,7 @@ pub fn target() -> Target {
s0:64:64-f80:128:128-n8:16:32:64-S128"
.to_string
(),
llvm_target
:
"x86_64-unknown-linux-gnu"
.to_string
(),
target_endian
:
"little"
.to_string
(),
target_
word_size
:
"64"
.to_string
(),
target_
pointer_width
:
"64"
.to_string
(),
arch
:
"x86_64"
.to_string
(),
target_os
:
"linux"
.to_string
(),
options
:
base
,
...
...
src/librustc_trans/trans/base.rs
浏览文件 @
6301c787
...
...
@@ -1128,7 +1128,7 @@ pub fn call_lifetime_end(cx: Block, ptr: ValueRef) {
pub
fn
call_memcpy
(
cx
:
Block
,
dst
:
ValueRef
,
src
:
ValueRef
,
n_bytes
:
ValueRef
,
align
:
u32
)
{
let
_
icx
=
push_ctxt
(
"call_memcpy"
);
let
ccx
=
cx
.ccx
();
let
key
=
match
ccx
.sess
()
.target.target.target_
word_size
.index
(
&
FullRange
)
{
let
key
=
match
ccx
.sess
()
.target.target.target_
pointer_width
.index
(
&
FullRange
)
{
"32"
=>
"llvm.memcpy.p0i8.p0i8.i32"
,
"64"
=>
"llvm.memcpy.p0i8.p0i8.i64"
,
tws
=>
panic!
(
"Unsupported target word size for memcpy: {}"
,
tws
),
...
...
@@ -1175,7 +1175,7 @@ fn memzero<'a, 'tcx>(b: &Builder<'a, 'tcx>, llptr: ValueRef, ty: Ty<'tcx>) {
let
llty
=
type_of
::
type_of
(
ccx
,
ty
);
let
intrinsic_key
=
match
ccx
.sess
()
.target.target.target_
word_size
.index
(
&
FullRange
)
{
let
intrinsic_key
=
match
ccx
.sess
()
.target.target.target_
pointer_width
.index
(
&
FullRange
)
{
"32"
=>
"llvm.memset.p0i8.i32"
,
"64"
=>
"llvm.memset.p0i8.i64"
,
tws
=>
panic!
(
"Unsupported target word size for memset: {}"
,
tws
),
...
...
src/librustc_trans/trans/context.rs
浏览文件 @
6301c787
...
...
@@ -721,7 +721,7 @@ pub fn trait_cache(&self) -> &RefCell<FnvHashMap<ty::PolyTraitRef<'tcx>,
/// currently conservatively bounded to 1 << 47 as that is enough to cover the current usable
/// address space on 64-bit ARMv8 and x86_64.
pub
fn
obj_size_bound
(
&
self
)
->
u64
{
match
self
.sess
()
.target.target.target_
word_size
.index
(
&
FullRange
)
{
match
self
.sess
()
.target.target.target_
pointer_width
.index
(
&
FullRange
)
{
"32"
=>
1
<<
31
,
"64"
=>
1
<<
47
,
_
=>
unreachable!
()
// error handled by config::build_target_config
...
...
src/librustc_trans/trans/type_.rs
浏览文件 @
6301c787
...
...
@@ -103,7 +103,7 @@ pub fn i8p(ccx: &CrateContext) -> Type {
}
pub
fn
int
(
ccx
:
&
CrateContext
)
->
Type
{
match
ccx
.tcx
()
.sess.target.target.target_
word_size
.index
(
&
FullRange
)
{
match
ccx
.tcx
()
.sess.target.target.target_
pointer_width
.index
(
&
FullRange
)
{
"32"
=>
Type
::
i32
(
ccx
),
"64"
=>
Type
::
i64
(
ccx
),
tws
=>
panic!
(
"Unsupported target word size for int: {}"
,
tws
),
...
...
src/libserialize/json.rs
浏览文件 @
6301c787
...
...
@@ -3481,7 +3481,7 @@ fn assert_stream_equal(src: &str,
}
}
#[test]
#[cfg_attr(target_
word_size
=
"32"
,
ignore)]
// FIXME(#14064)
#[cfg_attr(target_
pointer_width
=
"32"
,
ignore)]
// FIXME(#14064)
fn
test_streaming_parser
()
{
assert_stream_equal
(
r#"{ "foo":"bar", "array" : [0, 1, 2, 3, 4, 5], "idents":[null,true,false]}"#
,
...
...
@@ -3520,7 +3520,7 @@ fn last_event(src: &str) -> JsonEvent {
}
#[test]
#[cfg_attr(target_
word_size
=
"32"
,
ignore)]
// FIXME(#14064)
#[cfg_attr(target_
pointer_width
=
"32"
,
ignore)]
// FIXME(#14064)
fn
test_read_object_streaming
()
{
assert_eq!
(
last_event
(
"{ "
),
Error
(
SyntaxError
(
EOFWhileParsingObject
,
1
,
3
)));
assert_eq!
(
last_event
(
"{1"
),
Error
(
SyntaxError
(
KeyMustBeAString
,
1
,
2
)));
...
...
@@ -3604,7 +3604,7 @@ fn test_read_object_streaming() {
);
}
#[test]
#[cfg_attr(target_
word_size
=
"32"
,
ignore)]
// FIXME(#14064)
#[cfg_attr(target_
pointer_width
=
"32"
,
ignore)]
// FIXME(#14064)
fn
test_read_array_streaming
()
{
assert_stream_equal
(
"[]"
,
...
...
src/libstd/num/mod.rs
浏览文件 @
6301c787
...
...
@@ -424,12 +424,14 @@ fn test_cast_range_int_min() {
assert_eq!
(
int
::
MIN
.to_u32
(),
None
);
assert_eq!
(
int
::
MIN
.to_u64
(),
None
);
#[cfg(target_word_size
=
"32"
)]
#[cfg(any(all(stage0,
target_word_size
=
"32"
),
all(not(stage0),
target_pointer_width
=
"32"
)))]
fn
check_word_size
()
{
assert_eq!
(
int
::
MIN
.to_i32
(),
Some
(
int
::
MIN
as
i32
));
}
#[cfg(target_word_size
=
"64"
)]
#[cfg(any(all(stage0,
target_word_size
=
"64"
),
all(not(stage0),
target_pointer_width
=
"64"
)))]
fn
check_word_size
()
{
assert_eq!
(
int
::
MIN
.to_i32
(),
None
);
}
...
...
@@ -492,12 +494,14 @@ fn test_cast_range_i64_min() {
assert_eq!
(
i64
::
MIN
.to_u32
(),
None
);
assert_eq!
(
i64
::
MIN
.to_u64
(),
None
);
#[cfg(target_word_size
=
"32"
)]
#[cfg(any(all(stage0,
target_word_size
=
"32"
),
all(not(stage0),
target_pointer_width
=
"32"
)))]
fn
check_word_size
()
{
assert_eq!
(
i64
::
MIN
.to_int
(),
None
);
}
#[cfg(target_word_size
=
"64"
)]
#[cfg(any(all(stage0,
target_word_size
=
"64"
),
all(not(stage0),
target_pointer_width
=
"64"
)))]
fn
check_word_size
()
{
assert_eq!
(
i64
::
MIN
.to_int
(),
Some
(
i64
::
MIN
as
int
));
}
...
...
@@ -517,13 +521,15 @@ fn test_cast_range_int_max() {
// int::MAX.to_u32() is word-size specific
assert_eq!
(
int
::
MAX
.to_u64
(),
Some
(
int
::
MAX
as
u64
));
#[cfg(target_word_size
=
"32"
)]
#[cfg(any(all(stage0,
target_word_size
=
"32"
),
all(not(stage0),
target_pointer_width
=
"32"
)))]
fn
check_word_size
()
{
assert_eq!
(
int
::
MAX
.to_i32
(),
Some
(
int
::
MAX
as
i32
));
assert_eq!
(
int
::
MAX
.to_u32
(),
Some
(
int
::
MAX
as
u32
));
}
#[cfg(target_word_size
=
"64"
)]
#[cfg(any(all(stage0,
target_word_size
=
"64"
),
all(not(stage0),
target_pointer_width
=
"64"
)))]
fn
check_word_size
()
{
assert_eq!
(
int
::
MAX
.to_i32
(),
None
);
assert_eq!
(
int
::
MAX
.to_u32
(),
None
);
...
...
@@ -587,13 +593,15 @@ fn test_cast_range_i64_max() {
assert_eq!
(
i64
::
MAX
.to_u32
(),
None
);
assert_eq!
(
i64
::
MAX
.to_u64
(),
Some
(
i64
::
MAX
as
u64
));
#[cfg(target_word_size
=
"32"
)]
#[cfg(any(all(stage0,
target_word_size
=
"32"
),
all(not(stage0),
target_pointer_width
=
"32"
)))]
fn
check_word_size
()
{
assert_eq!
(
i64
::
MAX
.to_int
(),
None
);
assert_eq!
(
i64
::
MAX
.to_uint
(),
None
);
}
#[cfg(target_word_size
=
"64"
)]
#[cfg(any(all(stage0,
target_word_size
=
"64"
),
all(not(stage0),
target_pointer_width
=
"64"
)))]
fn
check_word_size
()
{
assert_eq!
(
i64
::
MAX
.to_int
(),
Some
(
i64
::
MAX
as
int
));
assert_eq!
(
i64
::
MAX
.to_uint
(),
Some
(
i64
::
MAX
as
uint
));
...
...
@@ -684,13 +692,15 @@ fn test_cast_range_uint_max() {
// uint::MAX.to_u32() is word-size specific
assert_eq!
(
uint
::
MAX
.to_u64
(),
Some
(
uint
::
MAX
as
u64
));
#[cfg(target_word_size
=
"32"
)]
#[cfg(any(all(stage0,
target_word_size
=
"32"
),
all(not(stage0),
target_pointer_width
=
"32"
)))]
fn
check_word_size
()
{
assert_eq!
(
uint
::
MAX
.to_u32
(),
Some
(
uint
::
MAX
as
u32
));
assert_eq!
(
uint
::
MAX
.to_i64
(),
Some
(
uint
::
MAX
as
i64
));
}
#[cfg(target_word_size
=
"64"
)]
#[cfg(any(all(stage0,
target_word_size
=
"64"
),
all(not(stage0),
target_pointer_width
=
"64"
)))]
fn
check_word_size
()
{
assert_eq!
(
uint
::
MAX
.to_u32
(),
None
);
assert_eq!
(
uint
::
MAX
.to_i64
(),
None
);
...
...
@@ -740,12 +750,14 @@ fn test_cast_range_u32_max() {
assert_eq!
(
u32
::
MAX
.to_u32
(),
Some
(
u32
::
MAX
as
u32
));
assert_eq!
(
u32
::
MAX
.to_u64
(),
Some
(
u32
::
MAX
as
u64
));
#[cfg(target_word_size
=
"32"
)]
#[cfg(any(all(stage0,
target_word_size
=
"32"
),
all(not(stage0),
target_pointer_width
=
"32"
)))]
fn
check_word_size
()
{
assert_eq!
(
u32
::
MAX
.to_int
(),
None
);
}
#[cfg(target_word_size
=
"64"
)]
#[cfg(any(all(stage0,
target_word_size
=
"64"
),
all(not(stage0),
target_pointer_width
=
"64"
)))]
fn
check_word_size
()
{
assert_eq!
(
u32
::
MAX
.to_int
(),
Some
(
u32
::
MAX
as
int
));
}
...
...
@@ -766,12 +778,14 @@ fn test_cast_range_u64_max() {
assert_eq!
(
u64
::
MAX
.to_u32
(),
None
);
assert_eq!
(
u64
::
MAX
.to_u64
(),
Some
(
u64
::
MAX
as
u64
));
#[cfg(target_word_size
=
"32"
)]
#[cfg(any(all(stage0,
target_word_size
=
"32"
),
all(not(stage0),
target_pointer_width
=
"32"
)))]
fn
check_word_size
()
{
assert_eq!
(
u64
::
MAX
.to_uint
(),
None
);
}
#[cfg(target_word_size
=
"64"
)]
#[cfg(any(all(stage0,
target_word_size
=
"64"
),
all(not(stage0),
target_pointer_width
=
"64"
)))]
fn
check_word_size
()
{
assert_eq!
(
u64
::
MAX
.to_uint
(),
Some
(
u64
::
MAX
as
uint
));
}
...
...
src/libstd/rand/mod.rs
浏览文件 @
6301c787
...
...
@@ -230,9 +230,9 @@
use
result
::
Result
::{
Ok
,
Err
};
use
vec
::
Vec
;
#[cfg(
not(target_word_size=
"64"
))]
#[cfg(
any(all(stage0,
target_word_size
=
"32"
),
all(not(stage0),
target_pointer_width
=
"32"
)
))]
use
core_rand
::
IsaacRng
as
IsaacWordRng
;
#[cfg(
target_word_size=
"64"
)]
#[cfg(
any(all(stage0,
target_word_size
=
"64"
),
all(not(stage0),
target_pointer_width
=
"64"
))
)]
use
core_rand
::
Isaac64Rng
as
IsaacWordRng
;
pub
use
core_rand
::{
Rand
,
Rng
,
SeedableRng
,
Open01
,
Closed01
};
...
...
src/libstd/sys/common/backtrace.rs
浏览文件 @
6301c787
...
...
@@ -12,8 +12,11 @@
use
io
::
IoResult
;
#[cfg(target_word_size
=
"64"
)]
pub
const
HEX_WIDTH
:
uint
=
18
;
#[cfg(target_word_size
=
"32"
)]
pub
const
HEX_WIDTH
:
uint
=
10
;
#[cfg(any(all(stage0,
target_word_size
=
"64"
),
all(not(stage0),
target_pointer_width
=
"64"
)))]
pub
const
HEX_WIDTH
:
uint
=
18
;
#[cfg(any(all(stage0,
target_word_size
=
"32"
),
all(not(stage0),
target_pointer_width
=
"32"
)))]
pub
const
HEX_WIDTH
:
uint
=
10
;
// All rust symbols are in theory lists of "::"-separated identifiers. Some
// assemblers, however, can't handle these characters in symbol names. To get
...
...
src/libstd/sys/unix/c.rs
浏览文件 @
6301c787
...
...
@@ -169,13 +169,13 @@ unsafe impl ::marker::Send for sigaction { }
unsafe
impl
::
marker
::
Sync
for
sigaction
{
}
#[repr(C)]
#[cfg(
target_word_size
=
"32"
)]
#[cfg(
any(all(stage0,
target_word_size
=
"32"
),
all(not(stage0),
target_pointer_width
=
"32"
))
)]
pub
struct
sigset_t
{
__
val
:
[
libc
::
c_ulong
;
32
],
}
#[repr(C)]
#[cfg(
target_word_size
=
"64"
)]
#[cfg(
any(all(stage0,
target_word_size
=
"64"
),
all(not(stage0),
target_pointer_width
=
"64"
))
)]
pub
struct
sigset_t
{
__
val
:
[
libc
::
c_ulong
;
16
],
}
...
...
src/libstd/sys/unix/stack_overflow.rs
浏览文件 @
6301c787
...
...
@@ -182,12 +182,14 @@ pub struct sigaction {
sa_restorer
:
*
mut
libc
::
c_void
,
}
#[cfg(target_word_size
=
"32"
)]
#[cfg(any(all(stage0,
target_word_size
=
"32"
),
all(not(stage0),
target_pointer_width
=
"32"
)))]
#[repr(C)]
pub
struct
sigset_t
{
__
val
:
[
libc
::
c_ulong
;
32
],
}
#[cfg(target_word_size
=
"64"
)]
#[cfg(any(all(stage0,
target_word_size
=
"64"
),
all(not(stage0),
target_pointer_width
=
"64"
)))]
#[repr(C)]
pub
struct
sigset_t
{
__
val
:
[
libc
::
c_ulong
;
16
],
...
...
src/test/compile-fail/huge-enum.rs
浏览文件 @
6301c787
...
...
@@ -12,12 +12,12 @@
// FIXME: work properly with higher limits
#[cfg(
target_word_size
=
"32"
)]
#[cfg(
any(all(stage0,
target_word_size
=
"32"
),
all(not(stage0),
target_pointer_width
=
"32"
))
)]
fn
main
()
{
let
big
:
Option
<
[
u32
;
(
1
<<
29
)
-
1
]
>
=
None
;
}
#[cfg(
target_word_size
=
"64"
)]
#[cfg(
any(all(stage0,
target_word_size
=
"64"
),
all(not(stage0),
target_pointer_width
=
"64"
))
)]
fn
main
()
{
let
big
:
Option
<
[
u32
;
(
1
<<
45
)
-
1
]
>
=
None
;
}
src/test/compile-fail/issue-17913.rs
浏览文件 @
6301c787
...
...
@@ -10,14 +10,14 @@
// error-pattern: too big for the current architecture
#[cfg(
target_word_size
=
"64"
)]
#[cfg(
any(all(stage0,
target_word_size
=
"64"
),
all(not(stage0),
target_pointer_width
=
"64"
))
)]
fn
main
()
{
let
n
=
0u
;
let
a
=
box
[
&
n
;
0xF000000000000000u
];
println!
(
"{}"
,
a
[
0xFFFFFFu
]);
}
#[cfg(
target_word_size
=
"32"
)]
#[cfg(
any(all(stage0,
target_word_size
=
"32"
),
all(not(stage0),
target_pointer_width
=
"32"
))
)]
fn
main
()
{
let
n
=
0u
;
let
a
=
box
[
&
n
;
0xFFFFFFFFu
];
...
...
src/test/run-pass/huge-largest-array.rs
浏览文件 @
6301c787
...
...
@@ -10,12 +10,12 @@
use
std
::
mem
::
size_of
;
#[cfg(
target_word_size
=
"32"
)]
#[cfg(
any(all(stage0,
target_word_size
=
"32"
),
all(not(stage0),
target_pointer_width
=
"32"
))
)]
pub
fn
main
()
{
assert_eq!
(
size_of
::
<
[
u8
;
(
1
<<
31
)
-
1
]
>
(),
(
1
<<
31
)
-
1
);
}
#[cfg(
target_word_size
=
"64"
)]
#[cfg(
any(all(stage0,
target_word_size
=
"64"
),
all(not(stage0),
target_pointer_width
=
"64"
))
)]
pub
fn
main
()
{
assert_eq!
(
size_of
::
<
[
u8
;
(
1
<<
47
)
-
1
]
>
(),
(
1
<<
47
)
-
1
);
}
src/test/run-pass/vec-fixed-length.rs
浏览文件 @
6301c787
...
...
@@ -21,7 +21,7 @@ pub fn main() {
// FIXME #10183
// FIXME #18069
//if cfg!(target_
word_size
= "64") {
//if cfg!(target_
pointer_width
= "64") {
// assert_eq!(size_of::<[u8; (1 << 32)]>(), (1u << 32));
//}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录