Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
761fc16c
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,发现更多精彩内容 >>
提交
761fc16c
编写于
6月 18, 2013
作者:
J
James Miller
提交者:
James Miller
6月 22, 2013
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix-up PP Code to reflect new lifetime param syntax
上级
048ed148
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
60 addition
and
53 deletion
+60
-53
src/librustc/middle/mem_categorization.rs
src/librustc/middle/mem_categorization.rs
+2
-2
src/librustc/middle/trans/debuginfo.rs
src/librustc/middle/trans/debuginfo.rs
+1
-1
src/librustc/middle/ty.rs
src/librustc/middle/ty.rs
+3
-3
src/librustc/middle/typeck/check/mod.rs
src/librustc/middle/typeck/check/mod.rs
+2
-2
src/librustc/middle/typeck/check/regionck.rs
src/librustc/middle/typeck/check/regionck.rs
+3
-3
src/librustc/middle/typeck/check/regionmanip.rs
src/librustc/middle/typeck/check/regionmanip.rs
+1
-1
src/librustc/middle/typeck/infer/mod.rs
src/librustc/middle/typeck/infer/mod.rs
+1
-1
src/librustc/middle/typeck/infer/sub.rs
src/librustc/middle/typeck/infer/sub.rs
+1
-1
src/librustc/util/ppaux.rs
src/librustc/util/ppaux.rs
+44
-37
src/test/compile-fail/regions-bounds.rs
src/test/compile-fail/regions-bounds.rs
+2
-2
未找到文件。
src/librustc/middle/mem_categorization.rs
浏览文件 @
761fc16c
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
use
middle
::
ty
;
use
middle
::
ty
;
use
middle
::
typeck
;
use
middle
::
typeck
;
use
util
::
ppaux
::{
ty_to_str
,
region_to_str
,
Repr
};
use
util
::
ppaux
::{
ty_to_str
,
region_
ptr_
to_str
,
Repr
};
use
util
::
common
::
indenter
;
use
util
::
common
::
indenter
;
use
core
::
uint
;
use
core
::
uint
;
...
@@ -1026,7 +1026,7 @@ pub fn cmt_to_str(&self, cmt: cmt) -> ~str {
...
@@ -1026,7 +1026,7 @@ pub fn cmt_to_str(&self, cmt: cmt) -> ~str {
}
}
pub
fn
region_to_str
(
&
self
,
r
:
ty
::
Region
)
->
~
str
{
pub
fn
region_to_str
(
&
self
,
r
:
ty
::
Region
)
->
~
str
{
region_to_str
(
self
.tcx
,
r
)
region_
ptr_
to_str
(
self
.tcx
,
r
)
}
}
}
}
...
...
src/librustc/middle/trans/debuginfo.rs
浏览文件 @
761fc16c
...
@@ -693,7 +693,7 @@ fn set_debug_location(cx: @mut CrateContext, scope: DIScope, line: uint, col: ui
...
@@ -693,7 +693,7 @@ fn set_debug_location(cx: @mut CrateContext, scope: DIScope, line: uint, col: ui
}
}
/// Set current debug location at the beginning of the span
/// Set current debug location at the beginning of the span
pub
fn
update_source_pos
(
bcx
:
@
mut
B
lock
,
span
:
span
)
{
pub
fn
update_source_pos
(
bcx
:
b
lock
,
span
:
span
)
{
if
!
bcx
.sess
()
.opts.debuginfo
||
(
*
span
.lo
==
0
&&
*
span
.hi
==
0
)
{
if
!
bcx
.sess
()
.opts.debuginfo
||
(
*
span
.lo
==
0
&&
*
span
.hi
==
0
)
{
return
;
return
;
}
}
...
...
src/librustc/middle/ty.rs
浏览文件 @
761fc16c
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
use
middle
::
subst
::
Subst
;
use
middle
::
subst
::
Subst
;
use
middle
::
typeck
;
use
middle
::
typeck
;
use
middle
;
use
middle
;
use
util
::
ppaux
::{
note_and_explain_region
,
bound_region_to_str
};
use
util
::
ppaux
::{
note_and_explain_region
,
bound_region_to_str
,
bound_region_ptr_to_str
};
use
util
::
ppaux
::{
trait_store_to_str
,
ty_to_str
,
vstore_to_str
};
use
util
::
ppaux
::{
trait_store_to_str
,
ty_to_str
,
vstore_to_str
};
use
util
::
ppaux
::{
Repr
,
UserString
};
use
util
::
ppaux
::{
Repr
,
UserString
};
use
util
::
common
::{
indenter
};
use
util
::
common
::{
indenter
};
...
@@ -3531,12 +3531,12 @@ fn terr_vstore_kind_to_str(k: terr_vstore_kind) -> ~str {
...
@@ -3531,12 +3531,12 @@ fn terr_vstore_kind_to_str(k: terr_vstore_kind) -> ~str {
terr_regions_insufficiently_polymorphic
(
br
,
_
)
=>
{
terr_regions_insufficiently_polymorphic
(
br
,
_
)
=>
{
fmt!
(
"expected bound lifetime parameter %s,
\
fmt!
(
"expected bound lifetime parameter %s,
\
but found concrete lifetime"
,
but found concrete lifetime"
,
bound_region_to_str
(
cx
,
br
))
bound_region_
ptr_
to_str
(
cx
,
br
))
}
}
terr_regions_overly_polymorphic
(
br
,
_
)
=>
{
terr_regions_overly_polymorphic
(
br
,
_
)
=>
{
fmt!
(
"expected concrete lifetime,
\
fmt!
(
"expected concrete lifetime,
\
but found bound lifetime parameter %s"
,
but found bound lifetime parameter %s"
,
bound_region_to_str
(
cx
,
br
))
bound_region_
ptr_
to_str
(
cx
,
br
))
}
}
terr_vstores_differ
(
k
,
ref
values
)
=>
{
terr_vstores_differ
(
k
,
ref
values
)
=>
{
fmt!
(
"%s storage differs: expected %s but found %s"
,
fmt!
(
"%s storage differs: expected %s but found %s"
,
...
...
src/librustc/middle/typeck/check/mod.rs
浏览文件 @
761fc16c
...
@@ -107,7 +107,7 @@
...
@@ -107,7 +107,7 @@
use
middle
::
typeck
::
no_params
;
use
middle
::
typeck
::
no_params
;
use
middle
::
typeck
::{
require_same_types
,
method_map
,
vtable_map
};
use
middle
::
typeck
::{
require_same_types
,
method_map
,
vtable_map
};
use
util
::
common
::{
block_query
,
indenter
,
loop_query
};
use
util
::
common
::{
block_query
,
indenter
,
loop_query
};
use
util
::
ppaux
::{
bound_region_to_str
};
use
util
::
ppaux
::{
bound_region_to_str
,
bound_region_ptr_to_str
};
use
util
::
ppaux
;
use
util
::
ppaux
;
...
@@ -680,7 +680,7 @@ pub fn search_in_scope_regions(&self,
...
@@ -680,7 +680,7 @@ pub fn search_in_scope_regions(&self,
}
else
{
}
else
{
result
::
Err
(
RegionError
{
result
::
Err
(
RegionError
{
msg
:
fmt!
(
"named region `%s` not in scope here"
,
msg
:
fmt!
(
"named region `%s` not in scope here"
,
bound_region_to_str
(
self
.tcx
(),
br
)),
bound_region_
ptr_
to_str
(
self
.tcx
(),
br
)),
replacement
:
self
.infcx
()
.next_region_var_nb
(
span
)
replacement
:
self
.infcx
()
.next_region_var_nb
(
span
)
})
})
}
}
...
...
src/librustc/middle/typeck/check/regionck.rs
浏览文件 @
761fc16c
...
@@ -690,13 +690,13 @@ fn constrain_regions_in_type(
...
@@ -690,13 +690,13 @@ fn constrain_regions_in_type(
let
tcx
=
rcx
.fcx.ccx.tcx
;
let
tcx
=
rcx
.fcx.ccx.tcx
;
debug!
(
"constrain_regions_in_type(minimum_lifetime=%s, ty=%s)"
,
debug!
(
"constrain_regions_in_type(minimum_lifetime=%s, ty=%s)"
,
region_to_str
(
tcx
,
minimum_lifetime
),
region_to_str
(
tcx
,
""
,
false
,
minimum_lifetime
),
ty_to_str
(
tcx
,
ty
));
ty_to_str
(
tcx
,
ty
));
do
relate_nested_regions
(
tcx
,
Some
(
minimum_lifetime
),
ty
)
|
r_sub
,
r_sup
|
{
do
relate_nested_regions
(
tcx
,
Some
(
minimum_lifetime
),
ty
)
|
r_sub
,
r_sup
|
{
debug!
(
"relate(r_sub=%s, r_sup=%s)"
,
debug!
(
"relate(r_sub=%s, r_sup=%s)"
,
region_to_str
(
tcx
,
r_sub
),
region_to_str
(
tcx
,
""
,
false
,
r_sub
),
region_to_str
(
tcx
,
r_sup
));
region_to_str
(
tcx
,
""
,
false
,
r_sup
));
if
r_sup
.is_bound
()
||
r_sub
.is_bound
()
{
if
r_sup
.is_bound
()
||
r_sub
.is_bound
()
{
// a bound region is one which appears inside an fn type.
// a bound region is one which appears inside an fn type.
...
...
src/librustc/middle/typeck/check/regionmanip.rs
浏览文件 @
761fc16c
...
@@ -149,7 +149,7 @@ fn replace_bound_regions(
...
@@ -149,7 +149,7 @@ fn replace_bound_regions(
tcx
.sess
.bug
(
tcx
.sess
.bug
(
fmt!
(
"Bound region not found in
\
fmt!
(
"Bound region not found in
\
in_scope_regions list: %s"
,
in_scope_regions list: %s"
,
region_to_str
(
tcx
,
r
)));
region_to_str
(
tcx
,
""
,
false
,
r
)));
}
}
}
}
}
}
...
...
src/librustc/middle/typeck/infer/mod.rs
浏览文件 @
761fc16c
...
@@ -821,7 +821,7 @@ pub fn replace_bound_regions_with_fresh_regions(&mut self,
...
@@ -821,7 +821,7 @@ pub fn replace_bound_regions_with_fresh_regions(&mut self,
// debug message.
// debug message.
let
rvar
=
self
.next_region_var_nb
(
span
);
let
rvar
=
self
.next_region_var_nb
(
span
);
debug!
(
"Bound region %s maps to %?"
,
debug!
(
"Bound region %s maps to %?"
,
bound_region_to_str
(
self
.tcx
,
br
),
bound_region_to_str
(
self
.tcx
,
""
,
false
,
br
),
rvar
);
rvar
);
rvar
rvar
});
});
...
...
src/librustc/middle/typeck/infer/sub.rs
浏览文件 @
761fc16c
...
@@ -179,7 +179,7 @@ fn fn_sigs(&self, a: &ty::FnSig, b: &ty::FnSig) -> cres<ty::FnSig> {
...
@@ -179,7 +179,7 @@ fn fn_sigs(&self, a: &ty::FnSig, b: &ty::FnSig) -> cres<ty::FnSig> {
None
,
b
)
|
br
|
{
None
,
b
)
|
br
|
{
let
skol
=
self
.infcx.region_vars
.new_skolemized
(
br
);
let
skol
=
self
.infcx.region_vars
.new_skolemized
(
br
);
debug!
(
"Bound region %s skolemized to %?"
,
debug!
(
"Bound region %s skolemized to %?"
,
bound_region_to_str
(
self
.infcx.tcx
,
br
),
bound_region_to_str
(
self
.infcx.tcx
,
""
,
false
,
br
),
skol
);
skol
);
skol
skol
}
}
...
...
src/librustc/util/ppaux.rs
浏览文件 @
761fc16c
...
@@ -112,7 +112,7 @@ pub fn explain_region_and_span(cx: ctxt, region: ty::Region)
...
@@ -112,7 +112,7 @@ pub fn explain_region_and_span(cx: ctxt, region: ty::Region)
idx
+
1
),
idx
+
1
),
br_fresh
(
_
)
=>
fmt!
(
"an anonymous lifetime defined on"
),
br_fresh
(
_
)
=>
fmt!
(
"an anonymous lifetime defined on"
),
_
=>
fmt!
(
"the lifetime %s as defined on"
,
_
=>
fmt!
(
"the lifetime %s as defined on"
,
bound_region_to_str
(
cx
,
fr
.bound_region
))
bound_region_
ptr_
to_str
(
cx
,
fr
.bound_region
))
};
};
match
cx
.items
.find
(
&
fr
.scope_id
)
{
match
cx
.items
.find
(
&
fr
.scope_id
)
{
...
@@ -147,22 +147,23 @@ fn explain_span(cx: ctxt, heading: &str, span: span)
...
@@ -147,22 +147,23 @@ fn explain_span(cx: ctxt, heading: &str, span: span)
}
}
}
}
pub
fn
bound_region_to_str
(
cx
:
ctxt
,
br
:
bound_region
)
->
~
str
{
pub
fn
bound_region_
ptr_
to_str
(
cx
:
ctxt
,
br
:
bound_region
)
->
~
str
{
bound_region_to_str
_space
(
cx
,
"&"
,
br
)
bound_region_to_str
(
cx
,
"&"
,
true
,
br
)
}
}
pub
fn
bound_region_to_str_space
(
cx
:
ctxt
,
pub
fn
bound_region_to_str
(
cx
:
ctxt
,
prefix
:
&
str
,
prefix
:
&
str
,
space
:
bool
,
br
:
bound_region
)
br
:
bound_region
)
->
~
str
{
->
~
str
{
let
space_str
=
if
space
{
" "
}
else
{
""
};
if
cx
.sess
.verbose
()
{
return
fmt!
(
"%s%? "
,
prefix
,
br
);
}
if
cx
.sess
.verbose
()
{
return
fmt!
(
"%s%?%s"
,
prefix
,
br
,
space_str
);
}
match
br
{
match
br
{
br_named
(
id
)
=>
fmt!
(
"%s'%s
"
,
prefix
,
cx
.sess
.str_of
(
id
)
),
br_named
(
id
)
=>
fmt!
(
"%s'%s
%s"
,
prefix
,
cx
.sess
.str_of
(
id
),
space_str
),
br_self
=>
fmt!
(
"%s'self
"
,
prefix
),
br_self
=>
fmt!
(
"%s'self
%s"
,
prefix
,
space_str
),
br_anon
(
_
)
=>
prefix
.to_str
(),
br_anon
(
_
)
=>
prefix
.to_str
(),
br_fresh
(
_
)
=>
prefix
.to_str
(),
br_fresh
(
_
)
=>
prefix
.to_str
(),
br_cap_avoid
(
_
,
br
)
=>
bound_region_to_str
_space
(
cx
,
prefix
,
*
br
)
br_cap_avoid
(
_
,
br
)
=>
bound_region_to_str
(
cx
,
prefix
,
space
,
*
br
)
}
}
}
}
...
@@ -208,13 +209,15 @@ pub fn re_scope_id_to_str(cx: ctxt, node_id: ast::node_id) -> ~str {
...
@@ -208,13 +209,15 @@ pub fn re_scope_id_to_str(cx: ctxt, node_id: ast::node_id) -> ~str {
// In general, if you are giving a region error message,
// In general, if you are giving a region error message,
// you should use `explain_region()` or, better yet,
// you should use `explain_region()` or, better yet,
// `note_and_explain_region()`
// `note_and_explain_region()`
pub
fn
region_to_str
(
cx
:
ctxt
,
region
:
Region
)
->
~
str
{
pub
fn
region_
ptr_
to_str
(
cx
:
ctxt
,
region
:
Region
)
->
~
str
{
region_to_str
_space
(
cx
,
"&"
,
region
)
region_to_str
(
cx
,
"&"
,
true
,
region
)
}
}
pub
fn
region_to_str_space
(
cx
:
ctxt
,
prefix
:
&
str
,
region
:
Region
)
->
~
str
{
pub
fn
region_to_str
(
cx
:
ctxt
,
prefix
:
&
str
,
space
:
bool
,
region
:
Region
)
->
~
str
{
let
space_str
=
if
space
{
" "
}
else
{
""
};
if
cx
.sess
.verbose
()
{
if
cx
.sess
.verbose
()
{
return
fmt!
(
"%s%?
"
,
prefix
,
region
);
return
fmt!
(
"%s%?
%s"
,
prefix
,
region
,
space_str
);
}
}
// These printouts are concise. They do not contain all the information
// These printouts are concise. They do not contain all the information
...
@@ -223,14 +226,14 @@ pub fn region_to_str_space(cx: ctxt, prefix: &str, region: Region) -> ~str {
...
@@ -223,14 +226,14 @@ pub fn region_to_str_space(cx: ctxt, prefix: &str, region: Region) -> ~str {
// `explain_region()` or `note_and_explain_region()`.
// `explain_region()` or `note_and_explain_region()`.
match
region
{
match
region
{
re_scope
(
_
)
=>
prefix
.to_str
(),
re_scope
(
_
)
=>
prefix
.to_str
(),
re_bound
(
br
)
=>
bound_region_to_str
_space
(
cx
,
prefix
,
br
),
re_bound
(
br
)
=>
bound_region_to_str
(
cx
,
prefix
,
space
,
br
),
re_free
(
ref
fr
)
=>
bound_region_to_str
_space
(
cx
,
prefix
,
fr
.bound_region
),
re_free
(
ref
fr
)
=>
bound_region_to_str
(
cx
,
prefix
,
space
,
fr
.bound_region
),
re_infer
(
ReSkolemized
(
_
,
br
))
=>
{
re_infer
(
ReSkolemized
(
_
,
br
))
=>
{
bound_region_to_str
_space
(
cx
,
prefix
,
br
)
bound_region_to_str
(
cx
,
prefix
,
space
,
br
)
}
}
re_infer
(
ReVar
(
_
))
=>
prefix
.to_str
(),
re_infer
(
ReVar
(
_
))
=>
prefix
.to_str
(),
re_static
=>
fmt!
(
"%s'static
"
,
prefix
),
re_static
=>
fmt!
(
"%s'static
%s"
,
prefix
,
space_str
),
re_empty
=>
fmt!
(
"%s'<empty>
"
,
prefix
)
re_empty
=>
fmt!
(
"%s'<empty>
%s"
,
prefix
,
space_str
)
}
}
}
}
...
@@ -256,7 +259,7 @@ pub fn vstore_to_str(cx: ctxt, vs: ty::vstore) -> ~str {
...
@@ -256,7 +259,7 @@ pub fn vstore_to_str(cx: ctxt, vs: ty::vstore) -> ~str {
ty
::
vstore_fixed
(
n
)
=>
fmt!
(
"%u"
,
n
),
ty
::
vstore_fixed
(
n
)
=>
fmt!
(
"%u"
,
n
),
ty
::
vstore_uniq
=>
~
"~"
,
ty
::
vstore_uniq
=>
~
"~"
,
ty
::
vstore_box
=>
~
"@"
,
ty
::
vstore_box
=>
~
"@"
,
ty
::
vstore_slice
(
r
)
=>
region_
to_str_space
(
cx
,
"&"
,
r
)
ty
::
vstore_slice
(
r
)
=>
region_
ptr_to_str
(
cx
,
r
)
}
}
}
}
...
@@ -264,7 +267,7 @@ pub fn trait_store_to_str(cx: ctxt, s: ty::TraitStore) -> ~str {
...
@@ -264,7 +267,7 @@ pub fn trait_store_to_str(cx: ctxt, s: ty::TraitStore) -> ~str {
match
s
{
match
s
{
ty
::
UniqTraitStore
=>
~
"~"
,
ty
::
UniqTraitStore
=>
~
"~"
,
ty
::
BoxTraitStore
=>
~
"@"
,
ty
::
BoxTraitStore
=>
~
"@"
,
ty
::
RegionTraitStore
(
r
)
=>
region_
to_str_space
(
cx
,
"&"
,
r
)
ty
::
RegionTraitStore
(
r
)
=>
region_
ptr_to_str
(
cx
,
r
)
}
}
}
}
...
@@ -340,7 +343,7 @@ fn closure_to_str(cx: ctxt, cty: &ty::ClosureTy) -> ~str
...
@@ -340,7 +343,7 @@ fn closure_to_str(cx: ctxt, cty: &ty::ClosureTy) -> ~str
(
ast
::
OwnedSigil
,
ty
::
re_static
)
=>
{}
(
ast
::
OwnedSigil
,
ty
::
re_static
)
=>
{}
(
_
,
region
)
=>
{
(
_
,
region
)
=>
{
s
.push_str
(
region_to_str
_space
(
cx
,
""
,
region
));
s
.push_str
(
region_to_str
(
cx
,
""
,
true
,
region
));
}
}
}
}
...
@@ -414,7 +417,7 @@ fn field_to_str(cx: ctxt, f: field) -> ~str {
...
@@ -414,7 +417,7 @@ fn field_to_str(cx: ctxt, f: field) -> ~str {
ty_uniq
(
ref
tm
)
=>
~
"~"
+
mt_to_str
(
cx
,
tm
),
ty_uniq
(
ref
tm
)
=>
~
"~"
+
mt_to_str
(
cx
,
tm
),
ty_ptr
(
ref
tm
)
=>
~
"*"
+
mt_to_str
(
cx
,
tm
),
ty_ptr
(
ref
tm
)
=>
~
"*"
+
mt_to_str
(
cx
,
tm
),
ty_rptr
(
r
,
ref
tm
)
=>
{
ty_rptr
(
r
,
ref
tm
)
=>
{
region_
to_str_space
(
cx
,
"&"
,
r
)
+
mt_to_str
(
cx
,
tm
)
region_
ptr_to_str
(
cx
,
r
)
+
mt_to_str
(
cx
,
tm
)
}
}
ty_unboxed_vec
(
ref
tm
)
=>
{
fmt!
(
"unboxed_vec<%s>"
,
mt_to_str
(
cx
,
tm
))
}
ty_unboxed_vec
(
ref
tm
)
=>
{
fmt!
(
"unboxed_vec<%s>"
,
mt_to_str
(
cx
,
tm
))
}
ty_type
=>
~
"type"
,
ty_type
=>
~
"type"
,
...
@@ -431,13 +434,15 @@ fn field_to_str(cx: ctxt, f: field) -> ~str {
...
@@ -431,13 +434,15 @@ fn field_to_str(cx: ctxt, f: field) -> ~str {
ty_infer
(
infer_ty
)
=>
infer_ty
.to_str
(),
ty_infer
(
infer_ty
)
=>
infer_ty
.to_str
(),
ty_err
=>
~
"[type error]"
,
ty_err
=>
~
"[type error]"
,
ty_param
(
param_ty
{
idx
:
id
,
def_id
:
did
})
=>
{
ty_param
(
param_ty
{
idx
:
id
,
def_id
:
did
})
=>
{
let
mut
parm
=
((
'T'
as
uint
)
+
id
)
as
char
;
if
(
parm
as
uint
)
>
(
'Z'
as
uint
)
{
parm
=
(
parm
as
uint
-
26
)
as
char
;
}
if
cx
.sess
.verbose
()
{
if
cx
.sess
.verbose
()
{
fmt!
(
"'%s:%?"
,
fmt!
(
"%c:%?"
,
parm
,
did
)
str
::
from_bytes
([(
'a'
as
u8
)
+
(
id
as
u8
)]),
did
)
}
else
{
}
else
{
fmt!
(
"'%s"
,
fmt!
(
"%c"
,
parm
)
str
::
from_bytes
([(
'a'
as
u8
)
+
(
id
as
u8
)]))
}
}
}
}
ty_self
(
*
)
=>
~
"Self"
,
ty_self
(
*
)
=>
~
"Self"
,
...
@@ -468,18 +473,20 @@ pub fn parameterized(cx: ctxt,
...
@@ -468,18 +473,20 @@ pub fn parameterized(cx: ctxt,
self_r
:
Option
<
ty
::
Region
>
,
self_r
:
Option
<
ty
::
Region
>
,
tps
:
&
[
ty
::
t
])
->
~
str
{
tps
:
&
[
ty
::
t
])
->
~
str
{
let
r_str
=
match
self_r
{
let
mut
strs
=
~
[];
None
=>
~
""
,
match
self_r
{
None
=>
(),
Some
(
r
)
=>
{
Some
(
r
)
=>
{
region_to_str
(
cx
,
r
)
strs
.push
(
region_to_str
(
cx
,
""
,
false
,
r
)
)
}
}
};
};
if
tps
.len
()
>
0u
{
strs
+=
vec
::
map
(
tps
,
|
t
|
ty_to_str
(
cx
,
*
t
));
let
strs
=
vec
::
map
(
tps
,
|
t
|
ty_to_str
(
cx
,
*
t
));
fmt!
(
"%s%s<%s>"
,
r_str
,
base
,
strs
.connect
(
","
))
if
strs
.len
()
>
0u
{
fmt!
(
"%s<%s>"
,
base
,
strs
.connect
(
","
))
}
else
{
}
else
{
fmt!
(
"%s
%s"
,
r_str
,
base
)
fmt!
(
"%s
"
,
base
)
}
}
}
}
...
@@ -597,7 +604,7 @@ fn repr(&self, tcx: ctxt) -> ~str {
...
@@ -597,7 +604,7 @@ fn repr(&self, tcx: ctxt) -> ~str {
impl
Repr
for
ty
::
Region
{
impl
Repr
for
ty
::
Region
{
fn
repr
(
&
self
,
tcx
:
ctxt
)
->
~
str
{
fn
repr
(
&
self
,
tcx
:
ctxt
)
->
~
str
{
region_to_str
(
tcx
,
*
self
)
region_to_str
(
tcx
,
""
,
false
,
*
self
)
}
}
}
}
...
...
src/test/compile-fail/regions-bounds.rs
浏览文件 @
761fc16c
...
@@ -16,11 +16,11 @@
...
@@ -16,11 +16,11 @@
struct
a_class
<
'self
>
{
x
:
&
'self
int
}
struct
a_class
<
'self
>
{
x
:
&
'self
int
}
fn
a_fn1
<
'a
,
'b
>
(
e
:
an_enum
<
'a
>
)
->
an_enum
<
'b
>
{
fn
a_fn1
<
'a
,
'b
>
(
e
:
an_enum
<
'a
>
)
->
an_enum
<
'b
>
{
return
e
;
//~ ERROR mismatched types: expected `an_enum
/&'b ` but found `an_enum/&'a
`
return
e
;
//~ ERROR mismatched types: expected `an_enum
<'b>` but found `an_enum<'a>
`
}
}
fn
a_fn3
<
'a
,
'b
>
(
e
:
a_class
<
'a
>
)
->
a_class
<
'b
>
{
fn
a_fn3
<
'a
,
'b
>
(
e
:
a_class
<
'a
>
)
->
a_class
<
'b
>
{
return
e
;
//~ ERROR mismatched types: expected `a_class
/&'b ` but found `a_class/&'a
`
return
e
;
//~ ERROR mismatched types: expected `a_class
<'b>` but found `a_class<'a>
`
}
}
fn
a_fn4
<
'a
,
'b
>
()
{
fn
a_fn4
<
'a
,
'b
>
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录