Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
aa67deff
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,发现更多精彩内容 >>
提交
aa67deff
编写于
3月 26, 2013
作者:
N
Niko Matsakis
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove sty_by_ref, though traces still remain due to dtors
上级
28885635
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
18 addition
and
88 deletion
+18
-88
src/librustc/metadata/decoder.rs
src/librustc/metadata/decoder.rs
+0
-1
src/librustc/metadata/encoder.rs
src/librustc/metadata/encoder.rs
+0
-3
src/librustc/middle/borrowck/gather_loans.rs
src/librustc/middle/borrowck/gather_loans.rs
+0
-15
src/librustc/middle/liveness.rs
src/librustc/middle/liveness.rs
+0
-5
src/librustc/middle/moves.rs
src/librustc/middle/moves.rs
+1
-14
src/librustc/middle/resolve.rs
src/librustc/middle/resolve.rs
+1
-2
src/librustc/middle/trans/meth.rs
src/librustc/middle/trans/meth.rs
+1
-16
src/librustc/middle/typeck/check/method.rs
src/librustc/middle/typeck/check/method.rs
+4
-4
src/libsyntax/ast.rs
src/libsyntax/ast.rs
+0
-1
src/libsyntax/ext/deriving/clone.rs
src/libsyntax/ext/deriving/clone.rs
+1
-1
src/libsyntax/ext/deriving/eq.rs
src/libsyntax/ext/deriving/eq.rs
+1
-1
src/libsyntax/ext/deriving/iter_bytes.rs
src/libsyntax/ext/deriving/iter_bytes.rs
+1
-1
src/libsyntax/ext/deriving/mod.rs
src/libsyntax/ext/deriving/mod.rs
+1
-1
src/libsyntax/parse/parser.rs
src/libsyntax/parse/parser.rs
+5
-20
src/libsyntax/print/pprust.rs
src/libsyntax/print/pprust.rs
+2
-3
未找到文件。
src/librustc/metadata/decoder.rs
浏览文件 @
aa67deff
...
...
@@ -630,7 +630,6 @@ fn get_mutability(ch: u8) -> ast::mutability {
let
self_ty_kind
=
string
[
0
];
match
self_ty_kind
as
char
{
's'
=>
{
return
ast
::
sty_static
;
}
'r'
=>
{
return
ast
::
sty_by_ref
;
}
'v'
=>
{
return
ast
::
sty_value
;
}
'@'
=>
{
return
ast
::
sty_box
(
get_mutability
(
string
[
1
]));
}
'~'
=>
{
return
ast
::
sty_uniq
(
get_mutability
(
string
[
1
]));
}
...
...
src/librustc/metadata/encoder.rs
浏览文件 @
aa67deff
...
...
@@ -410,9 +410,6 @@ fn encode_self_type(ebml_w: writer::Encoder, self_type: ast::self_ty_) {
sty_static
=>
{
ebml_w
.writer
.write
(
&
[
's'
as
u8
]);
}
sty_by_ref
=>
{
ebml_w
.writer
.write
(
&
[
'r'
as
u8
]);
}
sty_value
=>
{
ebml_w
.writer
.write
(
&
[
'v'
as
u8
]);
}
...
...
src/librustc/middle/borrowck/gather_loans.rs
浏览文件 @
aa67deff
...
...
@@ -180,21 +180,6 @@ fn req_loans_in_expr(ex: @ast::expr,
}
}
match
self
.bccx.method_map
.find
(
&
ex
.id
)
{
Some
(
ref
method_map_entry
)
=>
{
match
(
*
method_map_entry
)
.explicit_self
{
ast
::
sty_by_ref
=>
{
let
rcvr_cmt
=
self
.bccx
.cat_expr
(
rcvr
);
self
.guarantee_valid
(
rcvr_cmt
,
m_imm
,
scope_r
);
}
_
=>
{}
// Nothing to do.
}
}
None
=>
{
self
.tcx
()
.sess
.span_bug
(
ex
.span
,
~
"no method map entry"
);
}
}
visit
::
visit_expr
(
ex
,
self
,
vt
);
}
...
...
src/librustc/middle/liveness.rs
浏览文件 @
aa67deff
...
...
@@ -467,11 +467,6 @@ fn visit_fn(fk: &visit::fn_kind,
match
*
fk
{
fk_method
(
_
,
_
,
method
)
=>
{
match
method
.self_ty.node
{
sty_by_ref
=>
{
fn_maps
.add_variable
(
Arg
(
method
.self_id
,
special_idents
::
self_
,
by_ref
));
}
sty_value
|
sty_region
(
*
)
|
sty_box
(
_
)
|
sty_uniq
(
_
)
=>
{
fn_maps
.add_variable
(
Arg
(
method
.self_id
,
special_idents
::
self_
,
...
...
src/librustc/middle/moves.rs
浏览文件 @
aa67deff
...
...
@@ -737,20 +737,7 @@ fn use_receiver(&self,
receiver_expr
:
@
expr
,
visitor
:
vt
<
VisitContext
>
)
{
let
callee_mode
=
match
self
.method_map
.find
(
&
expr_id
)
{
Some
(
ref
method_map_entry
)
=>
{
match
method_map_entry
.explicit_self
{
sty_by_ref
=>
by_ref
,
_
=>
by_copy
}
}
None
=>
{
self
.tcx.sess
.span_bug
(
span
,
~
"no method map entry"
);
}
};
self
.use_fn_arg
(
callee_mode
,
receiver_expr
,
visitor
);
self
.use_fn_arg
(
by_copy
,
receiver_expr
,
visitor
);
}
fn
use_fn_args
(
&
self
,
...
...
src/librustc/middle/resolve.rs
浏览文件 @
aa67deff
...
...
@@ -50,7 +50,7 @@
use
syntax
::
ast
::{
path
,
pat_box
,
pat_lit
,
pat_range
,
pat_struct
};
use
syntax
::
ast
::{
pat_tup
,
pat_uniq
,
pat_wild
,
prim_ty
,
private
,
provided
};
use
syntax
::
ast
::{
public
,
required
,
rem
,
self_ty_
,
shl
,
shr
,
stmt_decl
};
use
syntax
::
ast
::{
struct_dtor
,
struct_field
,
struct_variant_kind
,
sty_by_ref
};
use
syntax
::
ast
::{
struct_dtor
,
struct_field
,
struct_variant_kind
};
use
syntax
::
ast
::{
sty_static
,
subtract
,
trait_ref
,
tuple_variant_kind
,
Ty
};
use
syntax
::
ast
::{
ty_bool
,
ty_char
,
ty_f
,
ty_f32
,
ty_f64
,
ty_float
,
ty_i
};
use
syntax
::
ast
::{
ty_i16
,
ty_i32
,
ty_i64
,
ty_i8
,
ty_int
,
TyParam
,
ty_path
};
...
...
@@ -3792,7 +3792,6 @@ fn resolve_method(@mut self,
// we only have self ty if it is a non static method
let
self_binding
=
match
method
.self_ty.node
{
sty_static
=>
{
NoSelfBinding
}
sty_by_ref
=>
{
HasSelfBinding
(
method
.self_id
,
true
)
}
_
=>
{
HasSelfBinding
(
method
.self_id
,
false
)
}
};
...
...
src/librustc/middle/trans/meth.rs
浏览文件 @
aa67deff
...
...
@@ -596,7 +596,7 @@ pub fn trans_trait_callee(bcx: block,
let
llpair
=
match
explicit_self
{
ast
::
sty_region
(
*
)
=>
Load
(
bcx
,
llpair
),
ast
::
sty_static
|
ast
::
sty_
by_ref
|
ast
::
sty_
value
|
ast
::
sty_static
|
ast
::
sty_value
|
ast
::
sty_box
(
_
)
|
ast
::
sty_uniq
(
_
)
=>
llpair
};
...
...
@@ -645,21 +645,6 @@ pub fn trans_trait_callee_from_llval(bcx: block,
ast
::
sty_static
=>
{
bcx
.tcx
()
.sess
.bug
(
~
"shouldn't see static method here"
);
}
ast
::
sty_by_ref
=>
{
// We need to pass a pointer to a pointer to the payload.
match
store
{
ty
::
BoxTraitStore
|
ty
::
BareTraitStore
|
ty
::
UniqTraitStore
=>
{
llself
=
GEPi
(
bcx
,
llbox
,
[
0u
,
abi
::
box_field_body
]);
}
ty
::
RegionTraitStore
(
_
)
=>
{
llself
=
llbox
;
}
}
self_mode
=
ast
::
by_ref
;
}
ast
::
sty_value
=>
{
bcx
.tcx
()
.sess
.bug
(
~
"methods with by-value self should not be
\
called on objects"
);
...
...
src/librustc/middle/typeck/check/method.rs
浏览文件 @
aa67deff
...
...
@@ -99,7 +99,7 @@ trait `ToStr` imported, and I call `to_str()` on a value of type `T`,
use
core
::
result
;
use
core
::
uint
;
use
core
::
vec
;
use
syntax
::
ast
::{
def_id
,
sty_
by_ref
,
sty_
value
,
sty_region
,
sty_box
};
use
syntax
::
ast
::{
def_id
,
sty_value
,
sty_region
,
sty_box
};
use
syntax
::
ast
::{
sty_uniq
,
sty_static
,
node_id
,
by_copy
,
by_ref
};
use
syntax
::
ast
::{
m_const
,
m_mutbl
,
m_imm
};
use
syntax
::
ast
;
...
...
@@ -527,7 +527,7 @@ fn push_inherent_candidates_from_trait(&self,
ast::sty_region(_) => {
return; // inapplicable
}
ast::sty_
by_ref | ast::sty_
region(_) => vstore_slice(r)
ast::sty_region(_) => vstore_slice(r)
ast::sty_box(_) => vstore_box, // XXX NDM mutability
ast::sty_uniq(_) => vstore_uniq
}
...
...
@@ -741,7 +741,7 @@ fn create_rcvr_ty_and_substs_for_method(&self,
// shouldn't really have to be.
let
rcvr_substs
=
{
match
self_decl
{
sty_static
|
sty_value
|
sty_by_ref
|
sty_static
|
sty_value
|
sty_box
(
_
)
|
sty_uniq
(
_
)
=>
{
self_substs
}
...
...
@@ -1327,7 +1327,7 @@ pub fn transform_self_type_for_method(tcx: ty::ctxt,
tcx
.sess
.bug
(
~
"calling transform_self_type_for_method on
\
static method"
);
}
sty_
by_ref
|
sty_
value
=>
{
sty_value
=>
{
impl_ty
}
sty_region
(
_
,
mutability
)
=>
{
...
...
src/libsyntax/ast.rs
浏览文件 @
aa67deff
...
...
@@ -1003,7 +1003,6 @@ fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
#[deriving(Eq)]
pub
enum
self_ty_
{
sty_static
,
// no self
sty_by_ref
,
// ``
sty_value
,
// `self`
sty_region
(
Option
<@
Lifetime
>
,
mutability
),
// `&'lt self`
sty_box
(
mutability
),
// `@self`
...
...
src/libsyntax/ext/deriving/clone.rs
浏览文件 @
aa67deff
...
...
@@ -17,7 +17,7 @@
use
ast
::{
m_imm
,
meta_item
,
method
};
use
ast
::{
named_field
,
or
,
pat
,
pat_ident
,
pat_wild
,
public
,
pure_fn
};
use
ast
::{
stmt
,
struct_def
,
struct_variant_kind
};
use
ast
::{
sty_
by_ref
,
sty_
region
,
tuple_variant_kind
,
ty_nil
,
TyParam
};
use
ast
::{
sty_region
,
tuple_variant_kind
,
ty_nil
,
TyParam
};
use
ast
::{
TyParamBound
,
ty_path
,
ty_rptr
,
unnamed_field
,
variant
};
use
ext
::
base
::
ext_ctxt
;
use
ext
::
build
;
...
...
src/libsyntax/ext/deriving/eq.rs
浏览文件 @
aa67deff
...
...
@@ -17,7 +17,7 @@
use
ast
::{
m_imm
,
meta_item
,
method
};
use
ast
::{
named_field
,
or
,
pat
,
pat_ident
,
pat_wild
,
public
,
pure_fn
};
use
ast
::{
stmt
,
struct_def
,
struct_variant_kind
};
use
ast
::{
sty_
by_ref
,
sty_
region
,
tuple_variant_kind
,
ty_nil
,
TyParam
};
use
ast
::{
sty_region
,
tuple_variant_kind
,
ty_nil
,
TyParam
};
use
ast
::{
TyParamBound
,
ty_path
,
ty_rptr
,
unnamed_field
,
variant
};
use
ext
::
base
::
ext_ctxt
;
use
ext
::
build
;
...
...
src/libsyntax/ext/deriving/iter_bytes.rs
浏览文件 @
aa67deff
...
...
@@ -17,7 +17,7 @@
use
ast
::{
m_imm
,
meta_item
,
method
};
use
ast
::{
named_field
,
or
,
pat
,
pat_ident
,
pat_wild
,
public
,
pure_fn
};
use
ast
::{
stmt
,
struct_def
,
struct_variant_kind
};
use
ast
::{
sty_
by_ref
,
sty_
region
,
tuple_variant_kind
,
ty_nil
,
TyParam
};
use
ast
::{
sty_region
,
tuple_variant_kind
,
ty_nil
,
TyParam
};
use
ast
::{
TyParamBound
,
ty_path
,
ty_rptr
,
unnamed_field
,
variant
};
use
ext
::
base
::
ext_ctxt
;
use
ext
::
build
;
...
...
src/libsyntax/ext/deriving/mod.rs
浏览文件 @
aa67deff
...
...
@@ -20,7 +20,7 @@
use
ast
::{
m_imm
,
meta_item
,
method
};
use
ast
::{
named_field
,
or
,
pat
,
pat_ident
,
pat_wild
,
public
,
pure_fn
};
use
ast
::{
stmt
,
struct_def
,
struct_variant_kind
};
use
ast
::{
sty_
by_ref
,
sty_
region
,
tuple_variant_kind
,
ty_nil
,
TyParam
};
use
ast
::{
sty_region
,
tuple_variant_kind
,
ty_nil
,
TyParam
};
use
ast
::{
TyParamBound
,
ty_path
,
ty_rptr
,
unnamed_field
,
variant
};
use
ext
::
base
::
ext_ctxt
;
use
ext
::
build
;
...
...
src/libsyntax/parse/parser.rs
浏览文件 @
aa67deff
...
...
@@ -46,7 +46,7 @@
use
ast
::{
ret_style
,
return_val
,
self_ty
,
shl
,
shr
,
stmt
,
stmt_decl
};
use
ast
::{
stmt_expr
,
stmt_semi
,
stmt_mac
,
struct_def
,
struct_field
};
use
ast
::{
struct_immutable
,
struct_mutable
,
struct_variant_kind
,
subtract
};
use
ast
::{
sty_box
,
sty_
by_ref
,
sty_
region
,
sty_static
,
sty_uniq
,
sty_value
};
use
ast
::{
sty_box
,
sty_region
,
sty_static
,
sty_uniq
,
sty_value
};
use
ast
::{
token_tree
,
trait_method
,
trait_ref
,
tt_delim
,
tt_seq
,
tt_tok
};
use
ast
::{
tt_nonterminal
,
tuple_variant_kind
,
Ty
,
ty_
,
ty_bot
,
ty_box
};
use
ast
::{
ty_field
,
ty_fixed_length_vec
,
ty_closure
,
ty_bare_fn
};
...
...
@@ -471,8 +471,6 @@ fn parse_trait_methods(&self) -> ~[trait_method] {
)
|
p
|
{
let
attrs
=
p
.parse_outer_attributes
();
let
lo
=
p
.span.lo
;
let
is_static
=
p
.parse_staticness
();
let
static_sty
=
spanned
(
lo
,
p
.span.hi
,
sty_static
);
let
vis
=
p
.parse_visibility
();
let
pur
=
p
.parse_fn_purity
();
...
...
@@ -487,12 +485,6 @@ fn parse_trait_methods(&self) -> ~[trait_method] {
// names to be left off if there is a definition...
either
::
Left
(
p
.parse_arg_general
(
false
))
};
// XXX: Wrong. Shouldn't allow both static and self_ty
let
self_ty
=
if
is_static
||
self_ty
.node
==
sty_by_ref
{
static_sty
}
else
{
self_ty
};
let
hi
=
p
.last_span.hi
;
debug!
(
"parse_trait_methods(): trait method signature ends in
\
...
...
@@ -2877,7 +2869,7 @@ fn maybe_parse_self_ty(
p
.expect_self_ident
();
cnstr
(
mutability
)
}
else
{
sty_
by_ref
sty_
static
}
}
...
...
@@ -2926,7 +2918,7 @@ fn maybe_parse_borrowed_self_ty(
self
.expect_self_ident
();
sty_region
(
Some
(
lifetime
),
mutability
)
}
else
{
sty_
by_ref
sty_
static
}
}
...
...
@@ -2950,13 +2942,13 @@ fn maybe_parse_borrowed_self_ty(
sty_value
}
_
=>
{
sty_
by_ref
sty_
static
}
};
// If we parsed a self type, expect a comma before the argument list.
let
args_or_capture_items
;
if
self_ty
!=
sty_
by_ref
{
if
self_ty
!=
sty_
static
{
match
*
self
.token
{
token
::
COMMA
=>
{
self
.bump
();
...
...
@@ -3058,7 +3050,6 @@ fn parse_method(&self) -> @method {
let
attrs
=
self
.parse_outer_attributes
();
let
lo
=
self
.span.lo
;
let
is_static
=
self
.parse_staticness
();
let
static_sty
=
spanned
(
lo
,
self
.span.hi
,
sty_static
);
let
visa
=
self
.parse_visibility
();
...
...
@@ -3068,12 +3059,6 @@ fn parse_method(&self) -> @method {
let
(
self_ty
,
decl
)
=
do
self
.parse_fn_decl_with_self
()
|
p
|
{
p
.parse_arg
()
};
// XXX: interaction between staticness, self_ty is broken now
let
self_ty
=
if
is_static
||
self_ty
.node
==
sty_by_ref
{
static_sty
}
else
{
self_ty
};
let
(
inner_attrs
,
body
)
=
self
.parse_inner_attrs_and_block
(
true
);
let
hi
=
body
.span.hi
;
...
...
src/libsyntax/print/pprust.rs
浏览文件 @
aa67deff
...
...
@@ -1643,7 +1643,7 @@ fn print_field(s: @ps, f: ast::field_pat, refutable: bool) {
// Returns whether it printed anything
pub
fn
print_self_ty
(
s
:
@
ps
,
self_ty
:
ast
::
self_ty_
)
->
bool
{
match
self_ty
{
ast
::
sty_static
|
ast
::
sty_by_ref
=>
{
return
false
;
}
ast
::
sty_static
=>
{
return
false
;
}
ast
::
sty_value
=>
{
word
(
s
.s
,
~
"self"
);
}
ast
::
sty_region
(
lt
,
m
)
=>
{
word
(
s
.s
,
~
"&"
);
...
...
@@ -1669,7 +1669,7 @@ pub fn print_fn(s: @ps,
opt_self_ty
:
Option
<
ast
::
self_ty_
>
,
vis
:
ast
::
visibility
)
{
head
(
s
,
~
""
);
print_fn_header_info
(
s
,
opt_self_ty
,
purity
,
ast
::
Many
,
None
,
vis
);
print_fn_header_info
(
s
,
purity
,
ast
::
Many
,
None
,
vis
);
nbsp
(
s
);
print_ident
(
s
,
name
);
print_generics
(
s
,
generics
);
...
...
@@ -2175,7 +2175,6 @@ pub fn print_opt_sigil(s: @ps, opt_sigil: Option<ast::Sigil>) {
}
pub
fn
print_fn_header_info
(
s
:
@
ps
,
opt_sty
:
Option
<
ast
::
self_ty_
>
,
purity
:
ast
::
purity
,
onceness
:
ast
::
Onceness
,
opt_sigil
:
Option
<
ast
::
Sigil
>
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录