Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
f3f27a5c
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,发现更多精彩内容 >>
提交
f3f27a5c
编写于
11月 21, 2015
作者:
V
Vadim Petrochenkov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rewrite VisiblePrivateTypesVisitor
上级
48700be9
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
258 addition
and
322 deletion
+258
-322
src/doc/reference.md
src/doc/reference.md
+0
-4
src/librustc_privacy/lib.rs
src/librustc_privacy/lib.rs
+139
-314
src/libsyntax/feature_gate.rs
src/libsyntax/feature_gate.rs
+1
-4
src/test/compile-fail/issue-28325.rs
src/test/compile-fail/issue-28325.rs
+39
-0
src/test/compile-fail/issue-28450.rs
src/test/compile-fail/issue-28450.rs
+54
-0
src/test/run-pass/issue-29668.rs
src/test/run-pass/issue-29668.rs
+25
-0
未找到文件。
src/doc/reference.md
浏览文件 @
f3f27a5c
...
...
@@ -2372,10 +2372,6 @@ The currently implemented features of the reference compiler are:
Such items should not be allowed by the compiler to exist,
so if you need this there probably is a compiler bug.
* `visible_private_types` - Allows public APIs to expose otherwise private
types, e.g. as the return type of a public function.
This capability may be removed in the future.
* `allow_internal_unstable` - Allows `macro_rules!` macros to be tagged with the
`#[allow_internal_unstable]` attribute, designed
to allow `std` macros to call
...
...
src/librustc_privacy/lib.rs
浏览文件 @
f3f27a5c
此差异已折叠。
点击以展开。
src/libsyntax/feature_gate.rs
浏览文件 @
f3f27a5c
...
...
@@ -82,7 +82,7 @@
(
"advanced_slice_patterns"
,
"1.0.0"
,
Some
(
23121
),
Active
),
(
"tuple_indexing"
,
"1.0.0"
,
None
,
Accepted
),
(
"associated_types"
,
"1.0.0"
,
None
,
Accepted
),
(
"visible_private_types"
,
"1.0.0"
,
Some
(
29627
),
Active
),
(
"visible_private_types"
,
"1.0.0"
,
None
,
Removed
),
(
"slicing_syntax"
,
"1.0.0"
,
None
,
Accepted
),
(
"box_syntax"
,
"1.0.0"
,
Some
(
27779
),
Active
),
(
"placement_in_syntax"
,
"1.0.0"
,
Some
(
27779
),
Active
),
...
...
@@ -514,7 +514,6 @@ pub enum AttributeGate {
pub
struct
Features
{
pub
unboxed_closures
:
bool
,
pub
rustc_diagnostic_macros
:
bool
,
pub
visible_private_types
:
bool
,
pub
allow_quote
:
bool
,
pub
allow_asm
:
bool
,
pub
allow_log_syntax
:
bool
,
...
...
@@ -551,7 +550,6 @@ pub fn new() -> Features {
Features
{
unboxed_closures
:
false
,
rustc_diagnostic_macros
:
false
,
visible_private_types
:
false
,
allow_quote
:
false
,
allow_asm
:
false
,
allow_log_syntax
:
false
,
...
...
@@ -1130,7 +1128,6 @@ fn check_crate_inner<F>(cm: &CodeMap, span_handler: &SpanHandler,
Features
{
unboxed_closures
:
cx
.has_feature
(
"unboxed_closures"
),
rustc_diagnostic_macros
:
cx
.has_feature
(
"rustc_diagnostic_macros"
),
visible_private_types
:
cx
.has_feature
(
"visible_private_types"
),
allow_quote
:
cx
.has_feature
(
"quote"
),
allow_asm
:
cx
.has_feature
(
"asm"
),
allow_log_syntax
:
cx
.has_feature
(
"log_syntax"
),
...
...
src/test/compile-fail/issue-28325.rs
0 → 100644
浏览文件 @
f3f27a5c
// 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.
// Checks for private types in public interfaces
mod
y
{
pub
struct
Foo
{
x
:
u32
}
struct
Bar
{
x
:
u32
}
impl
Foo
{
pub
fn
foo
(
&
self
,
x
:
Self
,
y
:
Bar
)
{
}
//~ ERROR private type in exported type signature
}
}
mod
x
{
pub
struct
Foo
{
pub
x
:
u32
}
struct
Bar
{
_
x
:
u32
}
impl
Foo
{
pub
fn
foo
(
&
self
,
_
x
:
Self
,
_
y
:
Bar
)
{
}
//~ ERROR private type in exported type signature
pub
fn
bar
(
&
self
)
->
Bar
{
Bar
{
_
x
:
self
.x
}
}
//~^ ERROR private type in exported type signature
}
}
pub
fn
main
()
{
let
f
=
x
::
Foo
{
x
:
4
};
let
b
=
f
.bar
();
f
.foo
(
x
::
Foo
{
x
:
5
},
b
);
}
src/test/compile-fail/issue-28450.rs
0 → 100644
浏览文件 @
f3f27a5c
// 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.
// Checks for private types in public interfaces
struct
Priv
;
pub
use
self
::
private
::
public
;
mod
private
{
pub
type
Priv
=
super
::
Priv
;
//~ ERROR private type in exported type signature
pub
fn
public
(
_
x
:
Priv
)
{
}
}
struct
__
CFArray
;
pub
type
CFArrayRef
=
*
const
__
CFArray
;
//~ ERROR private type in exported type signature
trait
Pointer
{
type
Pointee
;
}
impl
<
T
>
Pointer
for
*
const
T
{
type
Pointee
=
T
;
}
pub
type
__
CFArrayRevealed
=
<
CFArrayRef
as
Pointer
>
::
Pointee
;
//~^ ERROR private type in exported type signature
type
Foo
=
u8
;
pub
fn
foo
(
f
:
Foo
)
{}
//~ ERROR private type in exported type signature
pub
trait
Exporter
{
type
Output
;
}
pub
struct
Helper
;
pub
fn
block
()
->
<
Helper
as
Exporter
>
::
Output
{
struct
Inner
;
impl
Inner
{
fn
poke
(
&
self
)
{
println!
(
"Hello!"
);
}
}
impl
Exporter
for
Helper
{
type
Output
=
Inner
;
//~ ERROR private type in exported type signature
}
Inner
}
fn
main
()
{
block
()
.poke
();
}
src/test/run-pass/issue-29668.rs
0 → 100644
浏览文件 @
f3f27a5c
// 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.
// Functions can return unnameable types
mod
m1
{
mod
m2
{
#[derive(Debug)]
pub
struct
A
;
}
use
self
::
m2
::
A
;
pub
fn
x
()
->
A
{
A
}
}
fn
main
()
{
let
x
=
m1
::
x
();
println!
(
"{:?}"
,
x
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录