Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
09d073a4
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,发现更多精彩内容 >>
提交
09d073a4
编写于
1月 07, 2019
作者:
R
Ryan Leckey
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
stabilize extern_crate_self
上级
aea9f0aa
变更
10
显示空白变更内容
内联
并排
Showing
10 changed file
with
49 addition
and
28 deletion
+49
-28
src/librustc_resolve/build_reduced_graph.rs
src/librustc_resolve/build_reduced_graph.rs
+1
-5
src/libsyntax/feature_gate.rs
src/libsyntax/feature_gate.rs
+2
-3
src/test/ui/feature-gates/feature-gate-extern_crate_self.rs
src/test/ui/feature-gates/feature-gate-extern_crate_self.rs
+0
-3
src/test/ui/feature-gates/feature-gate-extern_crate_self.stderr
...st/ui/feature-gates/feature-gate-extern_crate_self.stderr
+0
-11
src/test/ui/imports/extern-crate-self/extern-crate-self-fail.rs
...st/ui/imports/extern-crate-self/extern-crate-self-fail.rs
+0
-2
src/test/ui/imports/extern-crate-self/extern-crate-self-fail.stderr
...i/imports/extern-crate-self/extern-crate-self-fail.stderr
+2
-2
src/test/ui/imports/extern-crate-self/extern-crate-self-macro-alias.rs
...mports/extern-crate-self/extern-crate-self-macro-alias.rs
+16
-0
src/test/ui/imports/extern-crate-self/extern-crate-self-macro-item.rs
...imports/extern-crate-self/extern-crate-self-macro-item.rs
+12
-0
src/test/ui/imports/extern-crate-self/extern-crate-self-macro-self.rs
...imports/extern-crate-self/extern-crate-self-macro-self.rs
+16
-0
src/test/ui/imports/extern-crate-self/extern-crate-self-pass.rs
...st/ui/imports/extern-crate-self/extern-crate-self-pass.rs
+0
-2
未找到文件。
src/librustc_resolve/build_reduced_graph.rs
浏览文件 @
09d073a4
...
...
@@ -30,7 +30,7 @@
use
syntax
::
ext
::
base
::
Determinacy
::
Undetermined
;
use
syntax
::
ext
::
hygiene
::
Mark
;
use
syntax
::
ext
::
tt
::
macro_rules
;
use
syntax
::
feature_gate
::
{
is_builtin_attr
,
emit_feature_err
,
GateIssue
}
;
use
syntax
::
feature_gate
::
is_builtin_attr
;
use
syntax
::
parse
::
token
::{
self
,
Token
};
use
syntax
::
std_inject
::
injected_crate_name
;
use
syntax
::
symbol
::
keywords
;
...
...
@@ -349,10 +349,6 @@ fn build_reduced_graph_for_item(&mut self, item: &Item, parent_scope: ParentScop
.emit
();
return
;
}
else
if
orig_name
==
Some
(
keywords
::
SelfLower
.name
())
{
if
!
self
.session
.features_untracked
()
.extern_crate_self
{
emit_feature_err
(
&
self
.session.parse_sess
,
"extern_crate_self"
,
item
.span
,
GateIssue
::
Language
,
"`extern crate self` is unstable"
);
}
self
.graph_root
}
else
{
let
crate_id
=
self
.crate_loader
.process_extern_crate
(
item
,
&
self
.definitions
);
...
...
src/libsyntax/feature_gate.rs
浏览文件 @
09d073a4
...
...
@@ -453,9 +453,6 @@ pub fn walk_feature_fields<F>(&self, mut f: F)
// Adds `reason` and `expect` lint attributes.
(
active
,
lint_reasons
,
"1.31.0"
,
Some
(
54503
),
None
),
// `extern crate self as foo;` puts local crate root into extern prelude under name `foo`.
(
active
,
extern_crate_self
,
"1.31.0"
,
Some
(
56409
),
None
),
// Allows paths to enum variants on type aliases.
(
active
,
type_alias_enum_variants
,
"1.31.0"
,
Some
(
49683
),
None
),
...
...
@@ -685,6 +682,8 @@ pub fn walk_feature_fields<F>(&self, mut f: F)
(
accepted
,
uniform_paths
,
"1.32.0"
,
Some
(
53130
),
None
),
// Allows `cfg(target_vendor = "...")`.
(
accepted
,
cfg_target_vendor
,
"1.33.0"
,
Some
(
29718
),
None
),
// `extern crate self as foo;` puts local crate root into extern prelude under name `foo`.
(
accepted
,
extern_crate_self
,
"1.34.0"
,
Some
(
56409
),
None
),
);
// If you change this, please modify `src/doc/unstable-book` as well. You must
...
...
src/test/ui/feature-gates/feature-gate-extern_crate_self.rs
已删除
100644 → 0
浏览文件 @
aea9f0aa
extern
crate
self
as
foo
;
//~ ERROR `extern crate self` is unstable
fn
main
()
{}
src/test/ui/feature-gates/feature-gate-extern_crate_self.stderr
已删除
100644 → 0
浏览文件 @
aea9f0aa
error[E0658]: `extern crate self` is unstable (see issue #56409)
--> $DIR/feature-gate-extern_crate_self.rs:1:1
|
LL | extern crate self as foo; //~ ERROR `extern crate self` is unstable
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(extern_crate_self)] to the crate attributes to enable
error: aborting due to previous error
For more information about this error, try `rustc --explain E0658`.
src/test/ui/imports/extern-crate-self-fail.rs
→
src/test/ui/imports/extern-crate-self
/extern-crate-self
-fail.rs
浏览文件 @
09d073a4
#![feature(extern_crate_self)]
extern
crate
self
;
//~ ERROR `extern crate self;` requires renaming
#[macro_use]
//~ ERROR `macro_use` is not supported on `extern crate self`
...
...
src/test/ui/imports/extern-crate-self-fail.stderr
→
src/test/ui/imports/extern-crate-self
/extern-crate-self
-fail.stderr
浏览文件 @
09d073a4
error: `extern crate self;` requires renaming
--> $DIR/extern-crate-self-fail.rs:
3
:1
--> $DIR/extern-crate-self-fail.rs:
1
:1
|
LL | extern crate self; //~ ERROR `extern crate self;` requires renaming
| ^^^^^^^^^^^^^^^^^^ help: try: `extern crate self as name;`
error: `macro_use` is not supported on `extern crate self`
--> $DIR/extern-crate-self-fail.rs:
5
:1
--> $DIR/extern-crate-self-fail.rs:
3
:1
|
LL | #[macro_use] //~ ERROR `macro_use` is not supported on `extern crate self`
| ^^^^^^^^^^^^
...
...
src/test/ui/imports/extern-crate-self/extern-crate-self-macro-alias.rs
0 → 100644
浏览文件 @
09d073a4
// run-pass
// Test that a macro can correctly expand the alias
// in an `extern crate self as ALIAS` item.
fn
the_answer
()
->
usize
{
42
}
macro_rules!
alias_self
{
(
$alias:ident
)
=>
{
extern
crate
self
as
$alias
;
}
}
alias_self!
(
the_alias
);
fn
main
()
{
assert_eq!
(
the_alias
::
the_answer
(),
42
);
}
src/test/ui/imports/extern-crate-self/extern-crate-self-macro-item.rs
0 → 100644
浏览文件 @
09d073a4
// compile-pass
// Test that `extern crate self;` is accepted
// syntactically as an item for use in a macro.
macro_rules!
accept_item
{
(
$x:item
)
=>
{}
}
accept_item!
{
extern
crate
self
;
}
fn
main
()
{}
src/test/ui/imports/extern-crate-self/extern-crate-self-macro-self.rs
0 → 100644
浏览文件 @
09d073a4
// run-pass
// Test that a macro can correctly expand `self` in
// an `extern crate self as ALIAS` item.
fn
the_answer
()
->
usize
{
42
}
macro_rules!
extern_something
{
(
$alias:ident
)
=>
{
extern
crate
$alias
as
the_alias
;
}
}
extern_something!
(
self
);
fn
main
()
{
assert_eq!
(
the_alias
::
the_answer
(),
42
);
}
src/test/ui/imports/extern-crate-self-pass.rs
→
src/test/ui/imports/extern-crate-self
/extern-crate-self
-pass.rs
浏览文件 @
09d073a4
// compile-pass
#![feature(extern_crate_self)]
extern
crate
self
as
foo
;
struct
S
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录