Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
9998052e
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,发现更多精彩内容 >>
提交
9998052e
编写于
10月 02, 2014
作者:
A
Alex Crichton
浏览文件
操作
浏览文件
下载
差异文件
rollup merge of #17722 : jakub-/issue-17169
上级
fba72d38
f2973f63
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
13 addition
and
14 deletion
+13
-14
src/librustc/middle/check_const.rs
src/librustc/middle/check_const.rs
+1
-1
src/librustc/middle/check_match.rs
src/librustc/middle/check_match.rs
+1
-1
src/librustc/middle/mem_categorization.rs
src/librustc/middle/mem_categorization.rs
+0
-1
src/librustc/middle/privacy.rs
src/librustc/middle/privacy.rs
+0
-9
src/librustc/middle/resolve.rs
src/librustc/middle/resolve.rs
+5
-0
src/librustc/middle/trans/_match.rs
src/librustc/middle/trans/_match.rs
+0
-2
src/test/auxiliary/xcrate_unit_struct.rs
src/test/auxiliary/xcrate_unit_struct.rs
+2
-0
src/test/run-pass/xcrate-unit-struct.rs
src/test/run-pass/xcrate-unit-struct.rs
+4
-0
未找到文件。
src/librustc/middle/check_const.rs
浏览文件 @
9998052e
...
...
@@ -149,7 +149,7 @@ fn check_expr(v: &mut CheckCrateVisitor, e: &Expr) {
}
ExprCall
(
ref
callee
,
_
)
=>
{
match
v
.tcx.def_map
.borrow
()
.find
(
&
callee
.id
)
{
Some
(
&
DefStruct
(
..
))
=>
{}
// OK.
Some
(
&
DefStruct
(
..
))
|
Some
(
&
DefVariant
(
..
))
=>
{}
// OK.
_
=>
{
span_err!
(
v
.tcx.sess
,
e
.span
,
E0015
,
...
...
src/librustc/middle/check_match.rs
浏览文件 @
9998052e
...
...
@@ -757,7 +757,7 @@ pub fn specialize<'a>(cx: &MatchCheckCtxt, r: &[&'a Pat],
DefStatic
(
..
)
=>
cx
.tcx.sess
.span_bug
(
pat_span
,
"static pattern should've been rewritten"
),
DefVariant
(
_
,
id
,
_
)
if
*
constructor
!=
Variant
(
id
)
=>
None
,
DefVariant
(
..
)
|
Def
Fn
(
..
)
|
Def
Struct
(
..
)
=>
{
DefVariant
(
..
)
|
DefStruct
(
..
)
=>
{
Some
(
match
args
{
&
Some
(
ref
args
)
=>
args
.iter
()
.map
(|
p
|
&**
p
)
.collect
(),
&
None
=>
Vec
::
from_elem
(
arity
,
&
DUMMY_WILD_PAT
)
...
...
src/librustc/middle/mem_categorization.rs
浏览文件 @
9998052e
...
...
@@ -1083,7 +1083,6 @@ pub fn cat_pattern(&self,
if_ok!
(
self
.cat_pattern
(
subcmt
,
&**
subpat
,
|
x
,
y
,
z
|
op
(
x
,
y
,
z
)));
}
}
Some
(
&
def
::
DefFn
(
..
))
|
Some
(
&
def
::
DefStruct
(
..
))
=>
{
for
(
i
,
subpat
)
in
subpats
.iter
()
.enumerate
()
{
let
subpat_ty
=
if_ok!
(
self
.pat_ty
(
&**
subpat
));
// see (*2)
...
...
src/librustc/middle/privacy.rs
浏览文件 @
9998052e
...
...
@@ -931,15 +931,6 @@ struct type?!"),
maybe_did
.unwrap_or
(
did
)
})
}
// Tuple struct constructors across crates are identified as
// DefFn types, so we explicitly handle that case here.
Some
(
&
def
::
DefFn
(
did
,
_
,
_
))
if
!
is_local
(
did
)
=>
{
match
csearch
::
get_tuple_struct_definition_if_ctor
(
&
self
.tcx.sess.cstore
,
did
)
{
Some
(
did
)
=>
guard
(
did
),
None
=>
{}
}
}
_
=>
{}
}
}
...
...
src/librustc/middle/resolve.rs
浏览文件 @
9998052e
...
...
@@ -1824,6 +1824,11 @@ fn handle_external_def(&mut self,
child_name_bindings
.define_value
(
def
,
DUMMY_SP
,
is_exported
);
}
}
DefFn
(
ctor_id
,
_
,
true
)
=>
{
child_name_bindings
.define_value
(
csearch
::
get_tuple_struct_definition_if_ctor
(
&
self
.session.cstore
,
ctor_id
)
.map_or
(
def
,
|
_
|
DefStruct
(
ctor_id
)),
DUMMY_SP
,
is_public
);
}
DefFn
(
..
)
|
DefStaticMethod
(
..
)
|
DefStatic
(
..
)
=>
{
debug!
(
"(building reduced graph for external
\
crate) building value (fn/static) {}"
,
final_ident
);
...
...
src/librustc/middle/trans/_match.rs
浏览文件 @
9998052e
...
...
@@ -698,7 +698,6 @@ fn any_irrefutable_adt_pat(tcx: &ty::ctxt, m: &[Match], col: uint) -> bool {
}
ast
::
PatEnum
(
..
)
|
ast
::
PatIdent
(
_
,
_
,
None
)
=>
{
match
tcx
.def_map
.borrow
()
.find
(
&
pat
.id
)
{
Some
(
&
def
::
DefFn
(
..
))
|
Some
(
&
def
::
DefStruct
(
..
))
=>
true
,
_
=>
false
}
...
...
@@ -1646,7 +1645,6 @@ fn bind_irrefutable_pat<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
}
}
}
Some
(
def
::
DefFn
(
..
))
|
Some
(
def
::
DefStruct
(
..
))
=>
{
match
*
sub_pats
{
None
=>
{
...
...
src/test/auxiliary/xcrate_unit_struct.rs
浏览文件 @
9998052e
...
...
@@ -19,6 +19,8 @@ pub enum Unit {
Argument
(
Struct
)
}
pub
struct
TupleStruct
(
pub
uint
,
pub
&
'static
str
);
// used by the cfail test
pub
struct
StructWithFields
{
...
...
src/test/run-pass/xcrate-unit-struct.rs
浏览文件 @
9998052e
...
...
@@ -16,17 +16,21 @@
static
s3
:
xcrate_unit_struct
::
Unit
=
xcrate_unit_struct
::
Argument
(
xcrate_unit_struct
::
Struct
);
static
s4
:
xcrate_unit_struct
::
Unit
=
xcrate_unit_struct
::
Argument
(
s1
);
static
s5
:
xcrate_unit_struct
::
TupleStruct
=
xcrate_unit_struct
::
TupleStruct
(
20
,
"foo"
);
fn
f1
(
_
:
xcrate_unit_struct
::
Struct
)
{}
fn
f2
(
_
:
xcrate_unit_struct
::
Unit
)
{}
fn
f3
(
_
:
xcrate_unit_struct
::
TupleStruct
)
{}
pub
fn
main
()
{
f1
(
xcrate_unit_struct
::
Struct
);
f2
(
xcrate_unit_struct
::
UnitVariant
);
f2
(
xcrate_unit_struct
::
Argument
(
xcrate_unit_struct
::
Struct
));
f3
(
xcrate_unit_struct
::
TupleStruct
(
10
,
"bar"
));
f1
(
s1
);
f2
(
s2
);
f2
(
s3
);
f2
(
s4
);
f3
(
s5
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录