Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
317a253b
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,发现更多精彩内容 >>
提交
317a253b
编写于
2月 14, 2014
作者:
N
Nick Cameron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
All uses of `extern fn` should mean `extern "C" fn`. Closes #9309.
上级
cbed3321
变更
19
隐藏空白更改
内联
并排
Showing
19 changed file
with
53 addition
and
30 deletion
+53
-30
src/librustc/middle/typeck/infer/combine.rs
src/librustc/middle/typeck/infer/combine.rs
+1
-0
src/librustdoc/lib.rs
src/librustdoc/lib.rs
+1
-1
src/librustdoc/plugins.rs
src/librustdoc/plugins.rs
+1
-1
src/libsyntax/parse/parser.rs
src/libsyntax/parse/parser.rs
+5
-4
src/libtest/lib.rs
src/libtest/lib.rs
+2
-2
src/test/auxiliary/static-function-pointer-aux.rs
src/test/auxiliary/static-function-pointer-aux.rs
+2
-2
src/test/compile-fail/block-coerce-no-2.rs
src/test/compile-fail/block-coerce-no-2.rs
+2
-2
src/test/compile-fail/borrowck-autoref-3261.rs
src/test/compile-fail/borrowck-autoref-3261.rs
+2
-2
src/test/run-pass/const-vec-of-fns.rs
src/test/run-pass/const-vec-of-fns.rs
+1
-1
src/test/run-pass/fn-abi.rs
src/test/run-pass/fn-abi.rs
+21
-0
src/test/run-pass/fn-bare-assign.rs
src/test/run-pass/fn-bare-assign.rs
+1
-1
src/test/run-pass/fn-bare-spawn.rs
src/test/run-pass/fn-bare-spawn.rs
+1
-1
src/test/run-pass/fn-lval.rs
src/test/run-pass/fn-lval.rs
+1
-1
src/test/run-pass/fun-indirect-call.rs
src/test/run-pass/fun-indirect-call.rs
+1
-1
src/test/run-pass/generic-temporary.rs
src/test/run-pass/generic-temporary.rs
+4
-4
src/test/run-pass/newtype.rs
src/test/run-pass/newtype.rs
+1
-1
src/test/run-pass/static-function-pointer.rs
src/test/run-pass/static-function-pointer.rs
+2
-2
src/test/run-pass/tail-cps.rs
src/test/run-pass/tail-cps.rs
+2
-2
src/test/run-pass/tuple-struct-constructor-pointer.rs
src/test/run-pass/tuple-struct-constructor-pointer.rs
+2
-2
未找到文件。
src/librustc/middle/typeck/infer/combine.rs
浏览文件 @
317a253b
...
...
@@ -500,6 +500,7 @@ pub fn super_tys<C:Combine>(this: &C, a: ty::t, b: ty::t) -> cres<ty::t> {
(
&
ty
::
ty_trait
(
a_id
,
ref
a_substs
,
a_store
,
a_mutbl
,
a_bounds
),
&
ty
::
ty_trait
(
b_id
,
ref
b_substs
,
b_store
,
b_mutbl
,
b_bounds
))
if
a_id
==
b_id
&&
a_mutbl
==
b_mutbl
=>
{
debug!
(
"Trying to match traits {:?} and {:?}"
,
a
,
b
);
let
substs
=
if_ok!
(
this
.substs
(
a_id
,
a_substs
,
b_substs
));
let
s
=
if_ok!
(
this
.trait_stores
(
ty
::
terr_trait
,
a_store
,
b_store
));
let
bounds
=
if_ok!
(
this
.bounds
(
a_bounds
,
b_bounds
));
...
...
src/librustdoc/lib.rs
浏览文件 @
317a253b
...
...
@@ -53,7 +53,7 @@ pub mod html {
pub
static
SCHEMA_VERSION
:
&
'static
str
=
"0.8.1"
;
type
Pass
=
(
&
'static
str
,
// name
extern
fn
(
clean
::
Crate
)
->
plugins
::
PluginResult
,
// fn
fn
(
clean
::
Crate
)
->
plugins
::
PluginResult
,
// fn
&
'static
str
);
// description
static
PASSES
:
&
'static
[
Pass
]
=
&
[
...
...
src/librustdoc/plugins.rs
浏览文件 @
317a253b
...
...
@@ -15,7 +15,7 @@
pub
type
PluginJson
=
Option
<
(
~
str
,
json
::
Json
)
>
;
pub
type
PluginResult
=
(
clean
::
Crate
,
PluginJson
);
pub
type
PluginCallback
=
extern
fn
(
clean
::
Crate
)
->
PluginResult
;
pub
type
PluginCallback
=
fn
(
clean
::
Crate
)
->
PluginResult
;
/// Manages loading and running of plugins
pub
struct
PluginManager
{
...
...
src/libsyntax/parse/parser.rs
浏览文件 @
317a253b
...
...
@@ -862,11 +862,12 @@ pub fn parse_ty_bare_fn(&mut self) -> Ty_ {
*/
let
opt_abis
=
if
self
.eat_keyword
(
keywords
::
Extern
)
{
self
.parse_opt_abis
()
}
else
{
None
};
let
abis
=
if
self
.eat_keyword
(
keywords
::
Extern
)
{
self
.parse_opt_abis
()
.unwrap_or
(
AbiSet
::
C
())
}
else
{
AbiSet
::
Rust
()
};
let
abis
=
opt_abis
.unwrap_or
(
AbiSet
::
Rust
());
let
purity
=
self
.parse_unsafety
();
self
.expect_keyword
(
keywords
::
Fn
);
let
(
decl
,
lifetimes
)
=
self
.parse_ty_fn_decl
(
true
);
...
...
src/libtest/lib.rs
浏览文件 @
317a253b
...
...
@@ -106,8 +106,8 @@ pub trait TDynBenchFn {
// may need to come up with a more clever definition of test in order
// to support isolation of tests into tasks.
pub
enum
TestFn
{
StaticTestFn
(
extern
fn
()),
StaticBenchFn
(
extern
fn
(
&
mut
BenchHarness
)),
StaticTestFn
(
fn
()),
StaticBenchFn
(
fn
(
&
mut
BenchHarness
)),
StaticMetricFn
(
proc
(
&
mut
MetricMap
)),
DynTestFn
(
proc
()),
DynMetricFn
(
proc
(
&
mut
MetricMap
)),
...
...
src/test/auxiliary/static-function-pointer-aux.rs
浏览文件 @
317a253b
...
...
@@ -12,5 +12,5 @@
pub
fn
f
(
x
:
int
)
->
int
{
-
x
}
pub
static
F
:
extern
fn
(
int
)
->
int
=
f
;
pub
static
mut
MutF
:
extern
fn
(
int
)
->
int
=
f
;
pub
static
F
:
fn
(
int
)
->
int
=
f
;
pub
static
mut
MutF
:
fn
(
int
)
->
int
=
f
;
src/test/compile-fail/block-coerce-no-2.rs
浏览文件 @
317a253b
...
...
@@ -12,10 +12,10 @@
// other tycons.
fn
main
()
{
fn
f
(
f
:
extern
fn
(
extern
fn
(
extern
fn
())))
{
fn
f
(
f
:
fn
(
fn
(
fn
())))
{
}
fn
g
(
f
:
extern
fn
(||))
{
fn
g
(
f
:
fn
(||))
{
}
f
(
g
);
...
...
src/test/compile-fail/borrowck-autoref-3261.rs
浏览文件 @
317a253b
...
...
@@ -10,10 +10,10 @@
enum
Either
<
T
,
U
>
{
Left
(
T
),
Right
(
U
)
}
struct
X
(
Either
<
(
uint
,
uint
),
extern
fn
()
>
);
struct
X
(
Either
<
(
uint
,
uint
),
fn
()
>
);
impl
X
{
pub
fn
with
(
&
self
,
blk
:
|
x
:
&
Either
<
(
uint
,
uint
),
extern
fn
()
>
|)
{
pub
fn
with
(
&
self
,
blk
:
|
x
:
&
Either
<
(
uint
,
uint
),
fn
()
>
|)
{
let
X
(
ref
e
)
=
*
self
;
blk
(
e
)
}
...
...
src/test/run-pass/const-vec-of-fns.rs
浏览文件 @
317a253b
...
...
@@ -16,7 +16,7 @@
*/
fn
f
()
{
}
static
bare_fns
:
&
'static
[
extern
fn
()]
=
&
[
f
,
f
];
static
bare_fns
:
&
'static
[
fn
()]
=
&
[
f
,
f
];
struct
S
<
'a
>
(
'a
||);
static
closures
:
&
'static
[
S
<
'static
>
]
=
&
[
S
(
f
),
S
(
f
)];
...
...
src/test/run-pass/fn-abi.rs
0 → 100644
浏览文件 @
317a253b
// Copyright 2014 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.
// Ensure that declarations and types which use `extern fn` both have the same
// ABI (#9309).
extern
{
fn
printf
();
}
pub
fn
main
()
{
// Will only type check if the type of _p and the decl of printf use the same ABI
let
_
p
:
extern
unsafe
fn
()
=
printf
;
}
src/test/run-pass/fn-bare-assign.rs
浏览文件 @
317a253b
...
...
@@ -13,7 +13,7 @@ fn f(i: int, called: &mut bool) {
*
called
=
true
;
}
fn
g
(
f
:
extern
fn
(
int
,
v
:
&
mut
bool
),
called
:
&
mut
bool
)
{
fn
g
(
f
:
fn
(
int
,
v
:
&
mut
bool
),
called
:
&
mut
bool
)
{
f
(
10
,
called
);
}
...
...
src/test/run-pass/fn-bare-spawn.rs
浏览文件 @
317a253b
...
...
@@ -10,7 +10,7 @@
// This is what the signature to spawn should look like with bare functions
fn
spawn
<
T
:
Send
>
(
val
:
T
,
f
:
extern
fn
(
T
))
{
fn
spawn
<
T
:
Send
>
(
val
:
T
,
f
:
fn
(
T
))
{
f
(
val
);
}
...
...
src/test/run-pass/fn-lval.rs
浏览文件 @
317a253b
...
...
@@ -11,7 +11,7 @@
fn
foo
(
_
f
:
extern
fn
(
int
)
->
int
)
{
}
fn
foo
(
_
f
:
fn
(
int
)
->
int
)
{
}
fn
id
(
x
:
int
)
->
int
{
return
x
;
}
...
...
src/test/run-pass/fun-indirect-call.rs
浏览文件 @
317a253b
...
...
@@ -14,7 +14,7 @@
fn
f
()
->
int
{
return
42
;
}
pub
fn
main
()
{
let
g
:
extern
fn
()
->
int
=
f
;
let
g
:
fn
()
->
int
=
f
;
let
i
:
int
=
g
();
assert_eq!
(
i
,
42
);
}
src/test/run-pass/generic-temporary.rs
浏览文件 @
317a253b
...
...
@@ -14,13 +14,13 @@
fn
chk
(
a
:
int
)
{
info!
(
"{}"
,
a
);
assert
!
((
a
==
1
));
}
fn
apply
<
T
>
(
produce
:
extern
fn
()
->
T
,
consume
:
extern
fn
(
T
))
{
fn
apply
<
T
>
(
produce
:
fn
()
->
T
,
consume
:
fn
(
T
))
{
consume
(
produce
());
}
pub
fn
main
()
{
let
produce
:
extern
fn
()
->
int
=
mk
;
let
consume
:
extern
fn
(
v
:
int
)
=
chk
;
let
produce
:
fn
()
->
int
=
mk
;
let
consume
:
fn
(
v
:
int
)
=
chk
;
apply
::
<
int
>
(
produce
,
consume
);
}
src/test/run-pass/newtype.rs
浏览文件 @
317a253b
...
...
@@ -10,7 +10,7 @@
struct
mytype
(
Mytype
);
struct
Mytype
{
compute
:
extern
fn
(
mytype
)
->
int
,
val
:
int
}
struct
Mytype
{
compute
:
fn
(
mytype
)
->
int
,
val
:
int
}
fn
compute
(
i
:
mytype
)
->
int
{
let
mytype
(
m
)
=
i
;
...
...
src/test/run-pass/static-function-pointer.rs
浏览文件 @
317a253b
...
...
@@ -11,8 +11,8 @@
fn
f
(
x
:
int
)
->
int
{
x
}
fn
g
(
x
:
int
)
->
int
{
2
*
x
}
static
F
:
extern
fn
(
int
)
->
int
=
f
;
static
mut
G
:
extern
fn
(
int
)
->
int
=
f
;
static
F
:
fn
(
int
)
->
int
=
f
;
static
mut
G
:
fn
(
int
)
->
int
=
f
;
pub
fn
main
()
{
assert_eq!
(
F
(
42
),
42
);
...
...
src/test/run-pass/tail-cps.rs
浏览文件 @
317a253b
...
...
@@ -15,13 +15,13 @@
pub
fn
main
()
{
let
k
=
checktrue
;
evenk
(
42
,
k
);
oddk
(
45
,
k
);
}
fn
evenk
(
n
:
int
,
k
:
extern
fn
(
bool
)
->
bool
)
->
bool
{
fn
evenk
(
n
:
int
,
k
:
fn
(
bool
)
->
bool
)
->
bool
{
info!
(
"evenk"
);
info!
(
"{:?}"
,
n
);
if
n
==
0
{
return
k
(
true
);
}
else
{
return
oddk
(
n
-
1
,
k
);
}
}
fn
oddk
(
n
:
int
,
k
:
extern
fn
(
bool
)
->
bool
)
->
bool
{
fn
oddk
(
n
:
int
,
k
:
fn
(
bool
)
->
bool
)
->
bool
{
info!
(
"oddk"
);
info!
(
"{:?}"
,
n
);
if
n
==
0
{
return
k
(
false
);
}
else
{
return
evenk
(
n
-
1
,
k
);
}
...
...
src/test/run-pass/tuple-struct-constructor-pointer.rs
浏览文件 @
317a253b
...
...
@@ -14,8 +14,8 @@
struct
Bar
(
int
,
int
);
pub
fn
main
()
{
let
f
:
extern
fn
(
int
)
->
Foo
=
Foo
;
let
g
:
extern
fn
(
int
,
int
)
->
Bar
=
Bar
;
let
f
:
fn
(
int
)
->
Foo
=
Foo
;
let
g
:
fn
(
int
,
int
)
->
Bar
=
Bar
;
assert_eq!
(
f
(
42
),
Foo
(
42
));
assert_eq!
(
g
(
4
,
7
),
Bar
(
4
,
7
));
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录