Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
bc48107a
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,发现更多精彩内容 >>
提交
bc48107a
编写于
2月 17, 2015
作者:
M
Manish Goregaokar
浏览文件
操作
浏览文件
下载
差异文件
Rollup merge of #22418 - japaric:diagnostics, r=nikomatsakis
closes #22388 r? @nikomatsakis cc @insaneinside
上级
23306de2
9462a207
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
46 addition
and
16 deletion
+46
-16
src/librustc_typeck/coherence/orphan.rs
src/librustc_typeck/coherence/orphan.rs
+3
-8
src/test/auxiliary/orphan_check_diagnostics.rs
src/test/auxiliary/orphan_check_diagnostics.rs
+11
-0
src/test/compile-fail/coherence-bigint-param.rs
src/test/compile-fail/coherence-bigint-param.rs
+1
-1
src/test/compile-fail/coherence-cow-no-cover.rs
src/test/compile-fail/coherence-cow-no-cover.rs
+1
-1
src/test/compile-fail/coherence-cross-crate-conflict.rs
src/test/compile-fail/coherence-cross-crate-conflict.rs
+1
-1
src/test/compile-fail/coherence-lone-type-parameter.rs
src/test/compile-fail/coherence-lone-type-parameter.rs
+2
-1
src/test/compile-fail/coherence-overlapping-pairs.rs
src/test/compile-fail/coherence-overlapping-pairs.rs
+1
-1
src/test/compile-fail/coherence-pair-covered-uncovered-1.rs
src/test/compile-fail/coherence-pair-covered-uncovered-1.rs
+2
-2
src/test/compile-fail/coherence-pair-covered-uncovered.rs
src/test/compile-fail/coherence-pair-covered-uncovered.rs
+1
-1
src/test/compile-fail/orphan-check-diagnostics.rs
src/test/compile-fail/orphan-check-diagnostics.rs
+23
-0
未找到文件。
src/librustc_typeck/coherence/orphan.rs
浏览文件 @
bc48107a
...
...
@@ -88,15 +88,10 @@ fn visit_item(&mut self, item: &'v ast::Item) {
Err
(
traits
::
OrphanCheckErr
::
UncoveredTy
(
param_ty
))
=>
{
if
!
ty
::
has_attr
(
self
.tcx
,
trait_def_id
,
"old_orphan_check"
)
{
span_err!
(
self
.tcx.sess
,
item
.span
,
E0210
,
"type parameter `{}`
is not constrained by any local type;
\
only traits defined in the current crate can be implemented
\
for a type parameter"
,
"type parameter `{}`
must be used as the type parameter for
\
some local type (e.g. `MyStruct<T>`); only traits defined in
\
the current crate can be implemented
for a type parameter"
,
param_ty
.user_string
(
self
.tcx
));
self
.tcx.sess
.span_note
(
item
.span
,
&
format!
(
"for a limited time, you can add
\
`#![feature(old_orphan_check)]` to your crate
\
to disable this rule"
));
}
}
}
...
...
src/test/auxiliary/orphan_check_diagnostics.rs
0 → 100644
浏览文件 @
bc48107a
// Copyright 2015 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.
pub
trait
RemoteTrait
{}
src/test/compile-fail/coherence-bigint-param.rs
浏览文件 @
bc48107a
...
...
@@ -16,6 +16,6 @@
pub
struct
BigInt
;
impl
<
T
>
Remote1
<
BigInt
>
for
T
{
}
//~^ ERROR type parameter `T`
is not constrained
//~^ ERROR type parameter `T`
must be used as the type parameter for some local type
fn
main
()
{
}
src/test/compile-fail/coherence-cow-no-cover.rs
浏览文件 @
bc48107a
...
...
@@ -18,6 +18,6 @@
pub
struct
Cover
<
T
>
(
T
);
impl
<
T
,
U
>
Remote
for
Pair
<
Cover
<
T
>
,
U
>
{
}
//~^ ERROR type parameter `U`
is not constrained by any
local type
//~^ ERROR type parameter `U`
must be used as the type parameter for some
local type
fn
main
()
{
}
src/test/compile-fail/coherence-cross-crate-conflict.rs
浏览文件 @
bc48107a
...
...
@@ -16,7 +16,7 @@
use
trait_impl_conflict
::
Foo
;
impl
<
A
>
Foo
for
A
{
//~^ ERROR type parameter `A`
is not constrained
//~^ ERROR type parameter `A`
must be used as the type parameter for some local type
//~^^ ERROR E0119
}
...
...
src/test/compile-fail/coherence-lone-type-parameter.rs
浏览文件 @
bc48107a
...
...
@@ -13,6 +13,7 @@
extern
crate
"coherence-lib"
as
lib
;
use
lib
::
Remote
;
impl
<
T
>
Remote
for
T
{
}
//~ ERROR type parameter `T` is not constrained
impl
<
T
>
Remote
for
T
{
}
//~^ ERROR type parameter `T` must be used as the type parameter for some local type
fn
main
()
{
}
src/test/compile-fail/coherence-overlapping-pairs.rs
浏览文件 @
bc48107a
...
...
@@ -16,6 +16,6 @@
struct
Foo
;
impl
<
T
>
Remote
for
lib
::
Pair
<
T
,
Foo
>
{
}
//~^ ERROR type parameter `T`
is not constrained
//~^ ERROR type parameter `T`
must be used as the type parameter for some local type
fn
main
()
{
}
src/test/compile-fail/coherence-pair-covered-uncovered-1.rs
浏览文件 @
bc48107a
...
...
@@ -18,7 +18,7 @@
pub
struct
Local
<
T
>
(
T
);
impl
<
T
,
U
>
Remote1
<
Pair
<
T
,
Local
<
U
>>>
for
i32
{
}
//~^ ERROR type parameter `T`
is not constrained
impl
<
T
,
U
>
Remote1
<
Pair
<
T
,
Local
<
U
>>>
for
i32
{
}
//~^ ERROR type parameter `T`
must be used as the type parameter for some local type
fn
main
()
{
}
src/test/compile-fail/coherence-pair-covered-uncovered.rs
浏览文件 @
bc48107a
...
...
@@ -16,6 +16,6 @@
struct
Local
<
T
>
(
T
);
impl
<
T
,
U
>
Remote
for
Pair
<
T
,
Local
<
U
>>
{
}
//~^ ERROR type parameter `T`
is not constrained
//~^ ERROR type parameter `T`
must be used as the type parameter for some local type
fn
main
()
{
}
src/test/compile-fail/orphan-check-diagnostics.rs
0 → 100644
浏览文件 @
bc48107a
// Copyright 2015 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.
// aux-build:orphan_check_diagnostics.rs
// see #22388
extern
crate
orphan_check_diagnostics
;
use
orphan_check_diagnostics
::
RemoteTrait
;
trait
LocalTrait
{}
impl
<
T
>
RemoteTrait
for
T
where
T
:
LocalTrait
{}
//~^ ERROR type parameter `T` must be used as the type parameter for some local type
fn
main
()
{}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录