Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
b7c0813e
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,发现更多精彩内容 >>
提交
b7c0813e
编写于
2月 18, 2015
作者:
A
Alex Crichton
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Round 4 test fixes and rebase conflicts
上级
63f51ee9
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
180 addition
and
19 deletion
+180
-19
src/libcollections/lib.rs
src/libcollections/lib.rs
+1
-1
src/libcollections/linked_list.rs
src/libcollections/linked_list.rs
+1
-1
src/libcollections/slice.rs
src/libcollections/slice.rs
+2
-2
src/libcore/marker.rs
src/libcore/marker.rs
+3
-3
src/libstd/sys/windows/c.rs
src/libstd/sys/windows/c.rs
+1
-1
src/libstd/sys/windows/process.rs
src/libstd/sys/windows/process.rs
+165
-1
src/test/compile-fail/object-safety-phantom-fn.rs
src/test/compile-fail/object-safety-phantom-fn.rs
+6
-0
src/test/compile-fail/regions-assoc-type-in-supertrait-outlives-container.rs
...il/regions-assoc-type-in-supertrait-outlives-container.rs
+0
-3
src/test/compile-fail/regions-assoc-type-outlives-container-wc.rs
.../compile-fail/regions-assoc-type-outlives-container-wc.rs
+0
-3
src/test/compile-fail/regions-assoc-type-outlives-container.rs
...est/compile-fail/regions-assoc-type-outlives-container.rs
+0
-3
src/test/run-pass/trait-impl.rs
src/test/run-pass/trait-impl.rs
+1
-1
未找到文件。
src/libcollections/lib.rs
浏览文件 @
b7c0813e
...
...
@@ -147,7 +147,6 @@ mod std {
#[cfg(test)]
mod
prelude
{
// from core.
pub
use
core
::
borrow
::
IntoCow
;
pub
use
core
::
clone
::
Clone
;
pub
use
core
::
cmp
::{
PartialEq
,
Eq
,
PartialOrd
,
Ord
};
pub
use
core
::
cmp
::
Ordering
::{
Less
,
Equal
,
Greater
};
...
...
@@ -173,6 +172,7 @@ mod prelude {
pub
use
unicode
::
char
::
CharExt
;
// from collections.
pub
use
borrow
::
IntoCow
;
pub
use
slice
::
SliceConcatExt
;
pub
use
string
::{
String
,
ToString
};
pub
use
vec
::
Vec
;
...
...
src/libcollections/linked_list.rs
浏览文件 @
b7c0813e
...
...
@@ -1041,7 +1041,7 @@ fn generate_test() -> LinkedList<i32> {
}
#[cfg(test)]
fn
list_from
<
T
:
Clone
>
(
v
:
&
[
T
])
->
D
List
<
T
>
{
fn
list_from
<
T
:
Clone
>
(
v
:
&
[
T
])
->
Linked
List
<
T
>
{
v
.iter
()
.cloned
()
.collect
()
}
...
...
src/libcollections/slice.rs
浏览文件 @
b7c0813e
...
...
@@ -1997,9 +1997,9 @@ fn test_lexicographic_permutations() {
#[test]
fn
test_lexicographic_permutations_empty_and_short
()
{
let
empty
:
&
mut
[
i32
]
=
&
mut
[
..
];
let
empty
:
&
mut
[
i32
]
=
&
mut
[];
assert
!
(
empty
.next_permutation
()
==
false
);
let
b
:
&
mut
[
i32
]
=
&
mut
[
..
];
let
b
:
&
mut
[
i32
]
=
&
mut
[];
assert
!
(
empty
==
b
);
assert
!
(
empty
.prev_permutation
()
==
false
);
assert
!
(
empty
==
b
);
...
...
src/libcore/marker.rs
浏览文件 @
b7c0813e
...
...
@@ -301,7 +301,7 @@ impl<T:?Sized> MarkerTrait for T { }
/// As an example, consider a trait with no methods like `Even`, meant
/// to represent types that are "even":
///
/// ```rust
/// ```rust
,ignore
/// trait Even { }
/// ```
///
...
...
@@ -310,7 +310,7 @@ impl<T:?Sized> MarkerTrait for T { }
/// categorize types (and hence instances of those types) as "even" or
/// not, so if we *were* going to have a method, it might look like:
///
/// ```rust
/// ```rust
,ignore
/// trait Even {
/// fn is_even(self) -> bool { true }
/// }
...
...
@@ -319,7 +319,7 @@ impl<T:?Sized> MarkerTrait for T { }
/// Therefore, we can model a method like this as follows:
///
/// ```rust
/// use std::marker::PhantomFn
/// use std::marker::PhantomFn
;
/// trait Even : PhantomFn<Self> { }
/// ```
///
...
...
src/libstd/sys/windows/c.rs
浏览文件 @
b7c0813e
...
...
@@ -283,7 +283,7 @@ fn store_func(ptr: &AtomicUsize, module: &str, symbol: &str,
fallback
:
usize
)
->
usize
{
let
mut
module
:
Vec
<
u16
>
=
module
.utf16_units
()
.collect
();
module
.push
(
0
);
let
symbol
=
CString
::
from_slice
(
symbol
.as_bytes
()
);
let
symbol
=
CString
::
new
(
symbol
)
.unwrap
(
);
let
func
=
unsafe
{
let
handle
=
GetModuleHandleW
(
module
.as_ptr
());
GetProcAddress
(
handle
,
symbol
.as_ptr
())
as
usize
...
...
src/libstd/sys/windows/process.rs
浏览文件 @
b7c0813e
...
...
@@ -10,7 +10,7 @@
use
prelude
::
v1
::
*
;
use
collections
::
hash_map
::
Hasher
;
#[cfg(stage0)]
use
collections
::
hash_map
::
Hasher
;
use
collections
;
use
env
;
use
ffi
::
CString
;
...
...
@@ -106,6 +106,7 @@ pub unsafe fn killpid(pid: pid_t, signal: int) -> IoResult<()> {
}
#[allow(deprecated)]
#[cfg(stage0)]
pub
fn
spawn
<
K
,
V
,
C
,
P
>
(
cfg
:
&
C
,
in_fd
:
Option
<
P
>
,
out_fd
:
Option
<
P
>
,
err_fd
:
Option
<
P
>
)
->
IoResult
<
Process
>
...
...
@@ -267,6 +268,169 @@ pub fn spawn<K, V, C, P>(cfg: &C, in_fd: Option<P>,
})
}
}
#[allow(deprecated)]
#[cfg(not(stage0))]
pub
fn
spawn
<
K
,
V
,
C
,
P
>
(
cfg
:
&
C
,
in_fd
:
Option
<
P
>
,
out_fd
:
Option
<
P
>
,
err_fd
:
Option
<
P
>
)
->
IoResult
<
Process
>
where
C
:
ProcessConfig
<
K
,
V
>
,
P
:
AsInner
<
FileDesc
>
,
K
:
BytesContainer
+
Eq
+
Hash
,
V
:
BytesContainer
{
use
libc
::
types
::
os
::
arch
::
extra
::{
DWORD
,
HANDLE
,
STARTUPINFO
};
use
libc
::
consts
::
os
::
extra
::{
TRUE
,
FALSE
,
STARTF_USESTDHANDLES
,
INVALID_HANDLE_VALUE
,
DUPLICATE_SAME_ACCESS
};
use
libc
::
funcs
::
extra
::
kernel32
::{
GetCurrentProcess
,
DuplicateHandle
,
CloseHandle
,
CreateProcessW
};
use
libc
::
funcs
::
extra
::
msvcrt
::
get_osfhandle
;
use
mem
;
use
iter
::
IteratorExt
;
use
str
::
StrExt
;
if
cfg
.gid
()
.is_some
()
||
cfg
.uid
()
.is_some
()
{
return
Err
(
IoError
{
kind
:
old_io
::
IoUnavailable
,
desc
:
"unsupported gid/uid requested on windows"
,
detail
:
None
,
})
}
// To have the spawning semantics of unix/windows stay the same, we need to
// read the *child's* PATH if one is provided. See #15149 for more details.
let
program
=
cfg
.env
()
.and_then
(|
env
|
{
for
(
key
,
v
)
in
env
{
if
b
"PATH"
!=
key
.container_as_bytes
()
{
continue
}
// Split the value and test each path to see if the
// program exists.
for
path
in
os
::
split_paths
(
v
.container_as_bytes
())
{
let
path
=
path
.join
(
cfg
.program
()
.as_bytes
())
.with_extension
(
env
::
consts
::
EXE_EXTENSION
);
if
path
.exists
()
{
return
Some
(
CString
::
from_slice
(
path
.as_vec
()))
}
}
break
}
None
});
unsafe
{
let
mut
si
=
zeroed_startupinfo
();
si
.cb
=
mem
::
size_of
::
<
STARTUPINFO
>
()
as
DWORD
;
si
.dwFlags
=
STARTF_USESTDHANDLES
;
let
cur_proc
=
GetCurrentProcess
();
// Similarly to unix, we don't actually leave holes for the stdio file
// descriptors, but rather open up /dev/null equivalents. These
// equivalents are drawn from libuv's windows process spawning.
let
set_fd
=
|
fd
:
&
Option
<
P
>
,
slot
:
&
mut
HANDLE
,
is_stdin
:
bool
|
{
match
*
fd
{
None
=>
{
let
access
=
if
is_stdin
{
libc
::
FILE_GENERIC_READ
}
else
{
libc
::
FILE_GENERIC_WRITE
|
libc
::
FILE_READ_ATTRIBUTES
};
let
size
=
mem
::
size_of
::
<
libc
::
SECURITY_ATTRIBUTES
>
();
let
mut
sa
=
libc
::
SECURITY_ATTRIBUTES
{
nLength
:
size
as
libc
::
DWORD
,
lpSecurityDescriptor
:
ptr
::
null_mut
(),
bInheritHandle
:
1
,
};
let
mut
filename
:
Vec
<
u16
>
=
"NUL"
.utf16_units
()
.collect
();
filename
.push
(
0
);
*
slot
=
libc
::
CreateFileW
(
filename
.as_ptr
(),
access
,
libc
::
FILE_SHARE_READ
|
libc
::
FILE_SHARE_WRITE
,
&
mut
sa
,
libc
::
OPEN_EXISTING
,
0
,
ptr
::
null_mut
());
if
*
slot
==
INVALID_HANDLE_VALUE
{
return
Err
(
super
::
last_error
())
}
}
Some
(
ref
fd
)
=>
{
let
orig
=
get_osfhandle
(
fd
.as_inner
()
.fd
())
as
HANDLE
;
if
orig
==
INVALID_HANDLE_VALUE
{
return
Err
(
super
::
last_error
())
}
if
DuplicateHandle
(
cur_proc
,
orig
,
cur_proc
,
slot
,
0
,
TRUE
,
DUPLICATE_SAME_ACCESS
)
==
FALSE
{
return
Err
(
super
::
last_error
())
}
}
}
Ok
(())
};
try!
(
set_fd
(
&
in_fd
,
&
mut
si
.hStdInput
,
true
));
try!
(
set_fd
(
&
out_fd
,
&
mut
si
.hStdOutput
,
false
));
try!
(
set_fd
(
&
err_fd
,
&
mut
si
.hStdError
,
false
));
let
cmd_str
=
make_command_line
(
program
.as_ref
()
.unwrap_or
(
cfg
.program
()),
cfg
.args
());
let
mut
pi
=
zeroed_process_information
();
let
mut
create_err
=
None
;
// stolen from the libuv code.
let
mut
flags
=
libc
::
CREATE_UNICODE_ENVIRONMENT
;
if
cfg
.detach
()
{
flags
|
=
libc
::
DETACHED_PROCESS
|
libc
::
CREATE_NEW_PROCESS_GROUP
;
}
with_envp
(
cfg
.env
(),
|
envp
|
{
with_dirp
(
cfg
.cwd
(),
|
dirp
|
{
let
mut
cmd_str
:
Vec
<
u16
>
=
cmd_str
.utf16_units
()
.collect
();
cmd_str
.push
(
0
);
let
_
lock
=
CREATE_PROCESS_LOCK
.lock
()
.unwrap
();
let
created
=
CreateProcessW
(
ptr
::
null
(),
cmd_str
.as_mut_ptr
(),
ptr
::
null_mut
(),
ptr
::
null_mut
(),
TRUE
,
flags
,
envp
,
dirp
,
&
mut
si
,
&
mut
pi
);
if
created
==
FALSE
{
create_err
=
Some
(
super
::
last_error
());
}
})
});
assert
!
(
CloseHandle
(
si
.hStdInput
)
!=
0
);
assert
!
(
CloseHandle
(
si
.hStdOutput
)
!=
0
);
assert
!
(
CloseHandle
(
si
.hStdError
)
!=
0
);
match
create_err
{
Some
(
err
)
=>
return
Err
(
err
),
None
=>
{}
}
// We close the thread handle because we don't care about keeping the
// thread id valid, and we aren't keeping the thread handle around to be
// able to close it later. We don't close the process handle however
// because std::we want the process id to stay valid at least until the
// calling code closes the process handle.
assert
!
(
CloseHandle
(
pi
.hThread
)
!=
0
);
Ok
(
Process
{
pid
:
pi
.dwProcessId
as
pid_t
,
handle
:
pi
.hProcess
as
*
mut
()
})
}
}
/// Waits for a process to exit and returns the exit code, failing
/// if there is no process with the specified id.
...
...
src/test/compile-fail/object-safety-phantom-fn.rs
浏览文件 @
b7c0813e
...
...
@@ -11,10 +11,16 @@
// Check that `Self` appearing in a phantom fn does not make a trait not object safe.
#![feature(rustc_attrs)]
#![allow(dead_code)]
use
std
::
marker
::
PhantomFn
;
trait
Baz
:
PhantomFn
<
Self
>
{
}
trait
Bar
<
T
>
:
PhantomFn
<
(
Self
,
T
)
>
{
}
fn
make_bar
<
T
:
Bar
<
u32
>>
(
t
:
&
T
)
->
&
Bar
<
u32
>
{
t
}
...
...
src/test/compile-fail/regions-assoc-type-in-supertrait-outlives-container.rs
浏览文件 @
b7c0813e
...
...
@@ -15,9 +15,6 @@
#![allow(dead_code)]
use
std
::
mem
::
transmute
;
use
std
::
ops
::
Deref
;
///////////////////////////////////////////////////////////////////////////
pub
trait
TheTrait
{
...
...
src/test/compile-fail/regions-assoc-type-outlives-container-wc.rs
浏览文件 @
b7c0813e
...
...
@@ -15,9 +15,6 @@
#![allow(dead_code)]
use
std
::
mem
::
transmute
;
use
std
::
ops
::
Deref
;
///////////////////////////////////////////////////////////////////////////
pub
trait
TheTrait
{
...
...
src/test/compile-fail/regions-assoc-type-outlives-container.rs
浏览文件 @
b7c0813e
...
...
@@ -14,9 +14,6 @@
#![allow(dead_code)]
use
std
::
mem
::
transmute
;
use
std
::
ops
::
Deref
;
///////////////////////////////////////////////////////////////////////////
pub
trait
TheTrait
{
...
...
src/test/run-pass/trait-impl.rs
浏览文件 @
b7c0813e
...
...
@@ -17,7 +17,7 @@
static
mut
COUNT
:
uint
=
1
;
trait
T
{
fn
foo
(
&
self
)
{}
fn
t
(
&
self
)
{}
}
impl
<
'a
>
T
+
'a
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录