Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
ef5c439f
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,发现更多精彩内容 >>
提交
ef5c439f
编写于
7月 01, 2013
作者:
N
Niko Matsakis
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Correct merge errors, broken tests
上级
4a0469e3
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
47 addition
and
9 deletion
+47
-9
src/librustc/middle/typeck/check/mod.rs
src/librustc/middle/typeck/check/mod.rs
+1
-1
src/librustc/middle/typeck/infer/error_reporting.rs
src/librustc/middle/typeck/infer/error_reporting.rs
+39
-3
src/librustc/middle/typeck/infer/mod.rs
src/librustc/middle/typeck/infer/mod.rs
+1
-0
src/librustc/middle/typeck/infer/region_inference/mod.rs
src/librustc/middle/typeck/infer/region_inference/mod.rs
+3
-2
src/librustc/util/ppaux.rs
src/librustc/util/ppaux.rs
+1
-1
src/test/compile-fail/regions-bounds.rs
src/test/compile-fail/regions-bounds.rs
+2
-2
未找到文件。
src/librustc/middle/typeck/check/mod.rs
浏览文件 @
ef5c439f
...
...
@@ -686,7 +686,7 @@ pub fn search_in_scope_regions(&self,
result
::
Err
(
RegionError
{
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
(
...
...
src/librustc/middle/typeck/infer/error_reporting.rs
浏览文件 @
ef5c439f
...
...
@@ -59,7 +59,7 @@
*/
use
core
::
prelude
::
*
;
use
std
::
prelude
::
*
;
use
middle
::
ty
;
use
middle
::
ty
::
Region
;
use
middle
::
typeck
::
infer
;
...
...
@@ -80,10 +80,46 @@
use
util
::
ppaux
::
UserString
;
use
util
::
ppaux
::
note_and_explain_region
;
impl
InferCtxt
{
pub
trait
ErrorReporting
{
pub
fn
report_region_errors
(
@
mut
self
,
errors
:
&
OptVec
<
RegionResolutionError
>
);
pub
fn
report_and_explain_type_error
(
@
mut
self
,
trace
:
TypeTrace
,
terr
:
&
ty
::
type_err
);
fn
values_str
(
@
mut
self
,
values
:
&
ValuePairs
)
->
Option
<~
str
>
;
fn
expected_found_str
<
T
:
UserString
+
Resolvable
>
(
@
mut
self
,
exp_found
:
&
ty
::
expected_found
<
T
>
)
->
Option
<~
str
>
;
fn
report_concrete_failure
(
@
mut
self
,
origin
:
SubregionOrigin
,
sub
:
Region
,
sup
:
Region
);
fn
report_sub_sup_conflict
(
@
mut
self
,
var_origin
:
RegionVariableOrigin
,
sub_origin
:
SubregionOrigin
,
sub_region
:
Region
,
sup_origin
:
SubregionOrigin
,
sup_region
:
Region
);
fn
report_sup_sup_conflict
(
@
mut
self
,
var_origin
:
RegionVariableOrigin
,
origin1
:
SubregionOrigin
,
region1
:
Region
,
origin2
:
SubregionOrigin
,
region2
:
Region
);
}
impl
ErrorReporting
for
InferCtxt
{
pub
fn
report_region_errors
(
@
mut
self
,
errors
:
&
OptVec
<
RegionResolutionError
>
)
{
for
errors
.
each
|
error
|
{
for
errors
.
iter
()
.advance
|
error
|
{
match
*
error
{
ConcreteFailure
(
origin
,
sub
,
sup
)
=>
{
self
.report_concrete_failure
(
origin
,
sub
,
sup
);
...
...
src/librustc/middle/typeck/infer/mod.rs
浏览文件 @
ef5c439f
...
...
@@ -31,6 +31,7 @@
use
middle
::
typeck
::
infer
::
lub
::
Lub
;
use
middle
::
typeck
::
infer
::
to_str
::
InferStr
;
use
middle
::
typeck
::
infer
::
unify
::{
ValsAndBindings
,
Root
};
use
middle
::
typeck
::
infer
::
error_reporting
::
ErrorReporting
;
use
middle
::
typeck
::
isr_alist
;
use
util
::
common
::
indent
;
use
util
::
ppaux
::{
bound_region_to_str
,
ty_to_str
,
trait_ref_to_str
,
Repr
,
...
...
src/librustc/middle/typeck/infer/region_inference/mod.rs
浏览文件 @
ef5c439f
...
...
@@ -36,7 +36,8 @@
enum
Constraint
{
ConstrainVarSubVar
(
RegionVid
,
RegionVid
),
ConstrainRegSubVar
(
Region
,
RegionVid
),
ConstrainVarSubReg
(
RegionVid
,
Region
)
ConstrainVarSubReg
(
RegionVid
,
Region
),
ConstrainRegSubReg
(
Region
,
Region
),
}
#[deriving(Eq,
IterBytes)]
...
...
@@ -454,7 +455,7 @@ fn consider_adding_edge(result_set: ~[Region],
{
let
mut
result_set
=
result_set
;
if
r
==
r1
{
// Clearly, this is potentially inefficient.
if
!
result_set
.iter
()
.any_
(|
x
|
x
==
r2
)
{
if
!
result_set
.iter
()
.any_
(|
x
|
*
x
==
r2
)
{
result_set
.push
(
r2
);
}
}
...
...
src/librustc/util/ppaux.rs
浏览文件 @
ef5c439f
...
...
@@ -610,7 +610,7 @@ fn repr(&self, tcx: ctxt) -> ~str {
impl
Repr
for
ty
::
bound_region
{
fn
repr
(
&
self
,
tcx
:
ctxt
)
->
~
str
{
bound_region_to_str
(
tcx
,
*
self
)
bound_region_
ptr_
to_str
(
tcx
,
*
self
)
}
}
...
...
src/test/compile-fail/regions-bounds.rs
浏览文件 @
ef5c439f
...
...
@@ -16,12 +16,12 @@
struct
a_class
<
'self
>
{
x
:
&
'self
int
}
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>
`
//~^ ERROR cannot infer an appropriate lifetime
}
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>
`
//~^ ERROR cannot infer an appropriate lifetime
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录